Metadata-Version: 2.4
Name: statecall
Version: 0.1.0
Summary: A simple library to add memory to AI chatbots
Home-page: https://github.com/Kavish2040/StateCall.git
Author: Kavish Soningra
Author-email: kavishsoningra009@gmail.com
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: black>=21.0; extra == "dev"
Requires-Dist: flake8>=3.8; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# StateCall

A simple Python library that adds memory to AI chatbots. StateCall remembers your conversations so AI can reference previous messages.

What it does

Most AI chatbots forget everything when you start a new conversation. StateCall saves your chat history so the AI can remember what you talked about before.

Features

- Works with any AI service (OpenAI, Groq, Claude, etc.)
- Built-in Groq support
- Saves conversations locally on your computer
- No database or internet connection needed
- Simple to use

Installation

```bash
pip install statecall
```

Quick start

Basic usage

```python
from statecall.memory import append_to_history, load_context
import openai

openai.api_key = "your-openai-api-key"
session_id = "my-chat"

# Save a message
append_to_history(session_id, "user", "Tell me a joke.")
history = load_context(session_id)

# Get AI response
response = openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=history
)

assistant_msg = response["choices"][0]["message"]["content"]
append_to_history(session_id, "assistant", assistant_msg)

print("AI:", assistant_msg)
```

Using Groq

```python
from statecall.groq_client import GroqClient
from statecall.memory import append_to_history, get_session_history

session_id = "groq-chat"
client = GroqClient(api_key="your-groq-api-key")

append_to_history(session_id, "user", "Who won the World Cup in 2022?")
history = get_session_history(session_id)
response = client.chat(history)

append_to_history(session_id, "assistant", response)
print("AI:", response)
```

How it works

StateCall saves your conversations in two files on your computer:

- `.statecall_history.json` - stores all your messages
- `.statecall_sessions.json` - tracks your chat sessions

This way your conversations are saved between app restarts without needing a database.

Examples

Check the `examples/` folder:

- `custom_llm_openai_example.py` - using OpenAI
- `groq_chat_example.py` - using Groq

To run an example:

```bash
python examples/groq_chat_example.py
```

License

MIT License # StateCall
