No project description provided
Project description
Assistant Base Extension
Use this library to add extension to https://github.com/samuelint/ai-assistant.
How to use
- Add the library to your project
poetry add base-assistant-extension
- At the base of your project export a class Called
Extension
# extension.py
from langchain_core.language_models import BaseChatModel
from langchain_core.runnables import Runnable
from base_assistant_extension.base_extension import (
BaseExtension,
)
from langchain_core.prompts import PromptTemplate
class Extension(BaseExtension):
def name(self) -> str:
return "joker"
def description(self) -> str:
return "Tell jokes."
def create_runnable(self, llm: BaseChatModel) -> Runnable:
prompt = PromptTemplate.from_template(
"You tell jokes. No matter the question. You have to tell a joke."
"{messages}"
)
return prompt | llm
# __init__.py
from .extension import Extension
__all__ = ["Extension"]
- Build
poetry build
will produce a .whl
file. Which is the extension to be used.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file base_assistant_extension-0.6.1.tar.gz
.
File metadata
- Download URL: base_assistant_extension-0.6.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 563f9a414b887c5788150f3eef0edc415bcea36270c39fcd4f2d25dd466f6be2 |
|
MD5 | a306197fff46c19f483ce8699451f955 |
|
BLAKE2b-256 | d81948c989c218d241d59550d718e172ba7eecdbf07b3305bda9d6d85139a93e |
File details
Details for the file base_assistant_extension-0.6.1-py3-none-any.whl
.
File metadata
- Download URL: base_assistant_extension-0.6.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe2dd0e435afe2581ed603484fe6b2f564544372d660367e68e3cfc22f956cd3 |
|
MD5 | 762b12c3e2680a35843001dab72fd043 |
|
BLAKE2b-256 | 3bc1925dadeedee2879fda04e0cc579345c0b3b18938c60d8c01c84e23e92de6 |