A wrapper on top of OpenAI chat completion and assistant API. It handles `tool_call`, `file_search` within the class.
Project description
MinAgent
Agent is a wrapper on top of OpenAI chat completion and assistant API.
It handles tool_call, file_search within the class
Features
Implemented
- Chat Completion API
- Assistant API
And tools
- Function call (Parallel execution)
- File search
Usage
pip install minagent
Create an Agent
from openai import OpenAI
from minagent import Agent
openai_client = OpenAI(
api_key="00000"
)
def current_utc_datetime(**args) -> str:
from datetime import datetime, timezone
return datetime.now(timezone.utc).isoformat()
clock = Agent(
openai_client,
name='clock',
model='gpt-4o',
instructions=['You are a time aware assistant.',],
# optional: only add below if using assistant api
openai_asst_id='asst_0000'
# optional: tool for file_search, and function
tools=[
{
'type': 'file_search',
}, {
'type': 'function',
'function': {"name": 'current_utc_datetime'},
},
],
tool_functions={'current_utc_datetime': current_utc_datetime},
tool_resources={'file_search': {'vector_store_ids': ['vs_0000']}},
)
Use of Chat completion API
response = clock.chat_completion(
user='john',
messages=[
{ 'role': 'user', 'content': 'what time is it now?' },
],
)
Use of Assistant API
thread = openai_client.beta.threads.create()
response = clock.ask_assistant(
user='john',
asst_thread_id=thread.id,
message=[
{ 'role': 'user', 'content': 'what time is it now?' },
]
)
Future
- Support for Response API
- Add test cases
- Release pipeline
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
minagent-0.1.1.tar.gz
(5.3 kB
view details)
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 minagent-0.1.1.tar.gz.
File metadata
- Download URL: minagent-0.1.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63ee42519f3d08d92f57175badcbb3970a5c34eea03bfbb50ade4974a1cceda9
|
|
| MD5 |
cd380eb4cae8443f2bd95879c707e3bf
|
|
| BLAKE2b-256 |
d084feeb053494ce6204ef8a572969c4b9cf9f07563b8c167e7b1e73f002faf3
|
File details
Details for the file minagent-0.1.1-py3-none-any.whl.
File metadata
- Download URL: minagent-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87d5136a51a4b39e78ce584557429282414af2b686818183bfab254354079c9d
|
|
| MD5 |
27788ca98fc9ed97ca6f24004fdfba64
|
|
| BLAKE2b-256 |
fcc7f805a45098cf927849058cbcc71e38afbdd4289014e005a9d19cdab5502e
|