Skip to main content

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

  1. Add the library to your project
poetry add base-assistant-extension
  1. 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"]
  1. Build
poetry build

will produce a .whl file. Which is the extension to be used.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

base_assistant_extension-0.6.5.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file base_assistant_extension-0.6.5.tar.gz.

File metadata

File hashes

Hashes for base_assistant_extension-0.6.5.tar.gz
Algorithm Hash digest
SHA256 09e4a4b1932c5e2421467ae3ac6d806ea024382183c627f835762c86307f506c
MD5 a064b24f1435536cb2501620c20cab8e
BLAKE2b-256 7bb4d9eaf8b7a676140ac9e7052ea7171c30617184e3d6971a603c1394c5ec7b

See more details on using hashes here.

File details

Details for the file base_assistant_extension-0.6.5-py3-none-any.whl.

File metadata

File hashes

Hashes for base_assistant_extension-0.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3ec10296877ddedb1991788fe3100592271c32f0a9e174b2bfbe19c33d2ff4ca
MD5 369eb750a23bbb45e7e55e1934a70707
BLAKE2b-256 f07ab3a7e64ef36035af85150b88078f241df79221e80cf0219b1c424fe44212

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page