Provider-agnostic wrappers around OpenAI and Mistral SDKs to power LLM-based agents in games or simulations.
Project description
nikitas-agents
Provider-agnostic wrappers around OpenAI and Mistral SDKs to power LLM-based agents in games or simulations.
Installation
This package is currently distributed straight from GitHub:
pip install git+https://github.com/NikitaDmitrieff/nikitas-agents.git
Quick Start
from nikitas_agents.agents import BaseAgent
agent = BaseAgent(
name="Strategist",
description="Keeps track of board state",
provider="openai",
model="gpt-4o-mini",
)
reply = agent.invoke("Give me one word hint.")
print(reply)
Set OPENAI_API_KEY or MISTRAL_API_KEY in your environment before invoking agents.
Features
- Multi-provider support: Works with both OpenAI and Mistral APIs
- Model validation: Ensures you're using supported models for each provider
- Environment-based configuration: Automatically loads API keys from environment variables
- Flexible prompting: Support for both system and user prompts with customizable parameters
Supported Providers and Models
OpenAI
- gpt-4o-mini
- gpt-4o
- gpt-4-turbo
- gpt-4
- gpt-3.5-turbo
Mistral
- mistral-small-latest
- mistral-medium-latest
- mistral-large-latest
- mistral-tiny
- open-mistral-7b
- open-mixtral-8x7b
- open-mixtral-8x22b
Usage
Basic Agent Creation
from nikitas_agents import BaseAgent
# Create an OpenAI agent
openai_agent = BaseAgent(
name="Assistant",
description="A helpful assistant",
provider="openai",
model="gpt-4o-mini"
)
# Create a Mistral agent
mistral_agent = BaseAgent(
name="Strategist",
description="A strategic thinking agent",
provider="mistral",
model="mistral-small-latest"
)
Advanced Usage
response = agent.invoke(
user_prompt="What's the best strategy for this situation?",
system_prompt="You are an expert game strategist",
temperature=0.7,
max_output_tokens=512,
timeout=30.0
)
Provider and Model Validation
from nikitas_agents import schema
# Check supported providers
providers = schema.supported_providers()
print(providers) # {'openai', 'mistral'}
# Check supported models for a provider
models = schema.supported_models('openai')
print(models) # {'gpt-4o-mini', 'gpt-4o', ...}
# Validate a provider/model combination
validated_model = schema.validate_model('openai', 'gpt-4o-mini')
Environment Setup
Create a .env file in your project root:
OPENAI_API_KEY=your_openai_api_key_here
MISTRAL_API_KEY=your_mistral_api_key_here
Or set environment variables directly:
export OPENAI_API_KEY="your_openai_api_key_here"
export MISTRAL_API_KEY="your_mistral_api_key_here"
Development
To contribute to this project:
- Clone the repository
- Install in development mode:
pip install -e . - Run tests:
python -m pytest tests/
License
MIT License - see LICENSE file for details.
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 nikitas_agents-0.1.0.tar.gz.
File metadata
- Download URL: nikitas_agents-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffb99622212d4957226a738c53408071ecebb77bf41e7c6367a53ff9e15df624
|
|
| MD5 |
878d124ae323d0c762ed102025fc2f48
|
|
| BLAKE2b-256 |
ab11512b3d39352b5f4ebe89b381bc4710ae0f7f91d4d2263ff0ef6cdbd6c399
|
File details
Details for the file nikitas_agents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nikitas_agents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed5159235c9033c4e9a98dc348555f49127d5627d15869b96124b2f1262482f2
|
|
| MD5 |
d22bdb27cf5c188bc32b0d8f4aa2751b
|
|
| BLAKE2b-256 |
e85c23e839177373bb1b3b54187071dcd9034a3fdacf040092b48ddfc6fb81d0
|