An agent wrapper over OpenAI Compatible API
Project description
MinAgent
An agent wrapper over OpenAI Compatible API.
Features
Implemented
- Chat Completion API
- Assistant API
And tools
- Function call (Parallel execution)
- File search
Usage
Create an Agent
from openai import OpenAI
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',
sentences=['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?' },
]
)
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.0.1.tar.gz
(12.6 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.0.1.tar.gz.
File metadata
- Download URL: minagent-0.0.1.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32026d92a4e5277c1800afda19a5654be84057fe73ee7ec3208c3d5ef464565c
|
|
| MD5 |
e818d00b89e727e33ce815c6b06a16bb
|
|
| BLAKE2b-256 |
30c2797b49a2ecac00c478d464e172d07a4bfce7f3d8a82713b054569d5c9214
|
File details
Details for the file minagent-0.0.1-py3-none-any.whl.
File metadata
- Download URL: minagent-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.9 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 |
d8580dd6e5c71501a461eedcb38eef9eac163ee977041d566b33294cf68cd0f9
|
|
| MD5 |
1184558aa1d0360fe0f075e367122cf5
|
|
| BLAKE2b-256 |
0fff566a348287da92ad15228669023974896e865210dd3dadd442ff5c2eacf2
|