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

Uploaded Source

Built Distribution

ai_chat_chain-0.2.4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai_chat_chain-0.2.4.tar.gz
  • Upload date:
  • Size: 6.6 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.4.tar.gz
Algorithm Hash digest
SHA256 903615f03baf55199004572e953bc99c675f916a2e3651e9f7fc1104187a59c5
MD5 407c8172247edb16be19d453b6b55857
BLAKE2b-256 f83f6a68424b4b05e42f71a0ee3af9fd613f0e3d5bf891e85a34171542c2468e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ai_chat_chain-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 9.0 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b586e07325e662b77f6ce7a241283ac28f7593488821c11d7001f0d2287f4489
MD5 20ecef59f965e4dba6f9a5968f52eaa3
BLAKE2b-256 fc36e82ea67e56faae78afeb9efe6791041c89fe6d3da16554d35c7a2ed709b6

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