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.4.tar.gz
.
File metadata
- Download URL: base_assistant_extension-0.6.4.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0810b4332058c8bda0d2bf4dd684261463b3e850540efbe7dc297289fecd6aab |
|
MD5 | a0bb0651d19e1a40685d3beb4fff424d |
|
BLAKE2b-256 | 874e050f4651ed7793d3802af683a4ea3ab93ccddc194a129448dd57234a19cf |
File details
Details for the file base_assistant_extension-0.6.4-py3-none-any.whl
.
File metadata
- Download URL: base_assistant_extension-0.6.4-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 | 860ed32abe0b0e3585cde32ea88548dce62085a7cb9bfa247f7d8944e005dc26 |
|
MD5 | efc6cbba3b07e4c7e97de2c8806e6fec |
|
BLAKE2b-256 | d958071989188e3b665d77d35194b22ea25bcd48953895ecb1f7218d402b692b |