llama-context
Llama Context (llama-context) is a toolkit within the LlamaSearch AI ecosystem designed for managing context in applications, particularly conversational AI or systems requiring state persistence. It likely handles storing, retrieving, and utilizing contextual information (like conversation history, user state, or session data) to inform application behavior.
Key Features
- Context Management: Core logic for storing, updating, and retrieving context (
main.py,core.py). - Session Tracking: Potential support for managing context across user sessions.
- History Management: Specifically handling conversational history or sequences of events.
- Contextualization: Using stored context to influence downstream tasks (e.g., LLM prompts, recommendations).
- Storage Backends (Potential): May support different storage mechanisms for context (memory, DB, file).
- Configurable: Allows defining context window size, storage options, expiration policies, etc. (
config.py).
Installation
pip install llama-context
# Or install directly from GitHub for the latest version:
# pip install git+https://github.com/llamasearchai/llama-context.git
Usage
(Usage examples demonstrating how to store, retrieve, and use context will be added here.)
# Placeholder for Python client usage
# from llama_context import ContextManager, ContextConfig
# config = ContextConfig.load("config.yaml")
# context_manager = ContextManager(config)
# session_id = "user123_sessionABC"
# # Add items to context
# context_manager.add_entry(session_id, {"role": "user", "content": "Hello there!"})
# context_manager.add_entry(session_id, {"role": "assistant", "content": "Hi! How can I help?"})
# # Retrieve context
# current_context = context_manager.get_context(session_id, max_length=10)
# print(current_context)
# # Use context (e.g., for an LLM prompt)
# # prompt = build_prompt_with_context(current_context, new_user_query="Tell me a joke")
# # llm_response = llm.generate(prompt)
# # context_manager.add_entry(session_id, {"role": "user", "content": "Tell me a joke"})
# # context_manager.add_entry(session_id, {"role": "assistant", "content": llm_response})
Architecture Overview
graph TD
A[Application / Service] --> B{Context Manager (main.py, core.py)};
B -- Read/Write --> C[(Context Store (Memory, DB, File))];
A -- Request Context --> B;
B -- Returns Context --> A;
A -- Add Context Entry --> B;
D[Configuration (config.py)] -- Configures --> B;
D -- Configures --> C;
style B fill:#f9f,stroke:#333,stroke-width:2px
style C fill:#ccf,stroke:#333,stroke-width:1px
- Interaction: An application interacts with the Context Manager to store or retrieve contextual information (e.g., for a specific user or session).
- Context Manager: Handles the logic for adding new entries, retrieving relevant context (potentially based on size limits or relevance), and managing the context lifecycle.
- Context Store: The actual storage backend where contextual data is persisted (e.g., in-memory dictionary, Redis, database).
- Configuration: Defines storage backend details, context window size, expiration rules, etc.
Configuration
(Details on configuring context storage backend (type, connection details), context length limits, expiration policies, session management, etc., will be added here.)
Development
Setup
# Clone the repository
git clone https://github.com/llamasearchai/llama-context.git
cd llama-context
# Install in editable mode with development dependencies
pip install -e ".[dev]"
Testing
pytest tests/
Contributing
Contributions are welcome! Please refer to CONTRIBUTING.md and submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for llama-context 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_context-0.1.0.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_context-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.7 kB
Release files / llama_context-0.1.0.tar.gz
| Download URL | llama_context-0.1.0.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a215f4ac7b455bb75464ac500d32473c60144a969f83812f708425c19b3de8b9
|
|
BLAKE2b-256 checksum How to use checksums |
d00fcb070cabbbc86c265036107a500f93a5a95b8d5afc9349cf660c1f48f621
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / llama_context-0.1.0-py3-none-any.whl
| Download URL | llama_context-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b64b07c7fe88b7230b96445e19d789abdeb5c64b5d8df0ee68749bbf10ae1fcb
|
|
BLAKE2b-256 checksum How to use checksums |
41031155bb7dfb45b55221b7838a6220e936aa4953274579958f26619452beb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|