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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for base_assistant_extension-0.6.6.tar.gz
Algorithm Hash digest
SHA256 aa9709d1a7911ad27a250f06bf230d28ea355e674b23dd5d7e7930c61e52eb40
MD5 b03b96c32d44493aef8ec3d0b06f4350
BLAKE2b-256 59493406d099e0db9fda25d084b88645df4f8ae2b65c8ef16f1ec2ed7d4751f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for base_assistant_extension-0.6.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9c499d1650089ebdc9dac4877997685804dcbfa41c1d7dfcef7ce4bdae39e2a4
MD5 d328b63b3381697fc4ce9dc2c5475a1e
BLAKE2b-256 d3cd263d330ffcbf3bafcf11d92ced7094f5d964f5fbb992774279f3e23f75fd

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