Skip to main content

maintain chat conversation state

Project description

simple chat context manager

  • override everything
  • works with any model
  • works with any prompt recovery system (simple history, embedding search, whatever)
  • chains functions well
  • uses ai-functions and executes them

install

poetry add or pip install this repo, for now

example:

from ai_chat import AiConfig

# only supports openai for now, todo: add other models
from ai_chat.openai import OpenaiChat
from ai_chat.store import SupabaseStore
from ai_functions import AIFunctions

# supports SqliteStore() as well as MemoryStore() for storing the chain of prompts

store = SupabaseStore()
conf = AiConfig(id="persona-id-1", system="You are a silly friend.")
session = OpenaiChat(store=store, ai=conf, thread_id="session-1")

def search_google():
    ...

def get_calendar():
    ...

def add_calendar():
    ...

session.functions = AIFunctions([search_google, get_calendar, add_calendar])

print(session.chat("hello").content)

# this contains the hello, and the reply in the context
print(session.chat("cool").content)

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

ai_chat_chain-0.2.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

ai_chat_chain-0.2.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file ai_chat_chain-0.2.1.tar.gz.

File metadata

  • Download URL: ai_chat_chain-0.2.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Windows/10

File hashes

Hashes for ai_chat_chain-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a8fb931bef27af4765538b54355f8164b9073c69461b34a1f22cdf3d3e6942e1
MD5 1b893d148511b54ed92ba6f1aec383cd
BLAKE2b-256 652a9bf15abfbce1741f8e546f3e82fd709ee5b1eac4be6eb85f3d0d8daecfe8

See more details on using hashes here.

File details

Details for the file ai_chat_chain-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ai_chat_chain-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Windows/10

File hashes

Hashes for ai_chat_chain-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c735adacb3066581698b6ad4e7259373c6c48a6f9fdb55a95896aa8522840037
MD5 ad811015ab5c42c5abc7835e56023093
BLAKE2b-256 7545774c961e0ace9587103c92e56627e26da2029d964bf72b158ed1e07bc877

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