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.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for base_assistant_extension-0.6.0.tar.gz
Algorithm Hash digest
SHA256 9f6f7677deb7482fddd7457b3dcf2b6c7c4e3aab2a3236eec1fdc0244b2fb953
MD5 1dbdfb601e6b665c5d22b156797af9d5
BLAKE2b-256 cfada4d918019fc95a1359c30d3524bd6bc694bd52efe8bac1cbab238a7d18af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for base_assistant_extension-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ef8cdea44f92afbcc56d4f47d4319593a3d6eb281dad01d5646597ad5bbeb03
MD5 4fe15895d9efdde6f580d8892f2d4b1c
BLAKE2b-256 7b8fb09e2e6c53c14a3e230ed34f629919c7f7515929ac018ce91641c15f7700

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