Skip to main content

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)

Metadata

Release files for ai-chat-chain 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-chat-chain 0.2.4
File Size Uploaded
ai_chat_chain-0.2.4.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-chat-chain 0.2.4
File Interpreter ABI Platform
ai_chat_chain-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / ai_chat_chain-0.2.4.tar.gz

Download URL ai_chat_chain-0.2.4.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
903615f03baf55199004572e953bc99c675f916a2e3651e9f7fc1104187a59c5
BLAKE2b-256 checksum
How to use checksums
f83f6a68424b4b05e42f71a0ee3af9fd613f0e3d5bf891e85a34171542c2468e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.3 Windows/10

Release files / ai_chat_chain-0.2.4-py3-none-any.whl

Download URL ai_chat_chain-0.2.4-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b586e07325e662b77f6ce7a241283ac28f7593488821c11d7001f0d2287f4489
BLAKE2b-256 checksum
How to use checksums
fc36e82ea67e56faae78afeb9efe6791041c89fe6d3da16554d35c7a2ed709b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.3 Windows/10

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page