Add your description here
Project description
AAF
AAF is a powerful and flexible framework for building and managing conversational AI models. It provides a unified interface for various language model providers and implements advanced virtual models for complex conversational scenarios.
Features
- Support for multiple LLM providers (OpenAI, Anthropic, Ollama)
- Advanced conversation management with Threads and Sessions
- Virtual models for complex scenarios (TwoPhase, Multiphase, Router)
- Tool integration for function calling capabilities
- Cost and token usage tracking
Installation
(Add installation instructions here)
Quick Start
from aaf.threads import Session
thread = Session().create_thread("gpt-4o", system="You are a helpful assistant.")
thread.add_message("user", "What is the capital of France?")
async with thread.run() as stream:
async for chunk in stream.text_chunks():
print(chunk.content, end="", flush=True)
print()
print(thread.cost_and_usage().pretty())
LLM Providers
AAF supports the following LLM providers:
- OpenAI
- Anthropic
- Ollama
To use a specific provider, specify the model name when creating a thread:
thread = session.create_thread("gpt-4o") # OpenAI
thread = session.create_thread("claude-3-5-sonnet-20240620") # Anthropic
thread = session.create_thread("llama3:instruct") # Ollama
Virtual Models
AAF implements several virtual models for advanced use cases:
- TwoPhase: Generates a prompt and then uses it to create a response
- Multiphase: Multi-step process for complex questions, including drafting, feedback, and refinement
- Router: Selects the appropriate model based on the user's request
Using a virtual model is same as with standard models:
from aaf.virtual_models.two_phase import TwoPhaseModel
from aaf.threads import Session
thread = Session().create_thread(model="two-phase", runner=TwoPhaseModel())
thread.add_message("user", "What is the capital of France?")
async with thread.run() as stream:
async for chunk in stream.text_chunks():
print(chunk.content, end="", flush=True)
print()
print(thread.cost_and_usage().pretty())
Project Structure
aaf/: Main package directoryllms/: LLM provider implementationsvirtual_models/: Virtual model implementationsthreads.py: Thread and Session managementlogging.py: Custom logging implementationutils.py: Utility functions
License
(Add license information)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aaf-0.3.0.tar.gz.
File metadata
- Download URL: aaf-0.3.0.tar.gz
- Upload date:
- Size: 51.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dee3d7cb6a2d699962e9563905a3375573e175fc018fd8cc20bf992aabca795
|
|
| MD5 |
7b56307aea9857798e006eda2370f28f
|
|
| BLAKE2b-256 |
ad2b2dff5a83664afa110772e5ed615dbe1ca122ac9b61543c01a9a19b374979
|
File details
Details for the file aaf-0.3.0-py3-none-any.whl.
File metadata
- Download URL: aaf-0.3.0-py3-none-any.whl
- Upload date:
- Size: 35.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37c41de1a4acdade463852169caf248a8ef5d4378d8f7df3e070cdc502cd6b1f
|
|
| MD5 |
83e0e924a995939af542964bef384f53
|
|
| BLAKE2b-256 |
905109fc7939a2e4a48bcd79752a600b7308a4bee7bb5eb8f68cc3cb1b83f1ac
|