A brief description of the package.
Project description
Quickstart
First install the packages:
pip install pure_agent
setup your config.yaml
env:
api_key: xxx
infer_params:
model: gpt-4o-mini
temperature: 0.8
top_p: 0.8
max_tokens: 512
write your first agent based on pure_agent!
from pure_agent import BaseAgent, RoleCtx, append_msg
class MyAgent(BaseAgent):
@append_msg()
def greeting(self, sys_name, prompt):
with RoleCtx('system'):
yield f"You are a helpful assistant, your name is {sys_name}."
with RoleCtx('user'):
yield prompt
agent = MyAgent(client_config='config.yaml')
response = agent.greeting('agent0', 'who are u?')
print(response)
use multi-thread:
from pure_agent import *
class MyAgent(BaseAgent):
@append_msg(return_async_task=True)
def greeting(self, sys_name, prompt):
with RoleCtx('system'):
yield f"You are a helpful assistant, your name is {sys_name}."
with RoleCtx('user'):
yield prompt
sys_names = ['pbot0', 'pbot1']
prompts = ['who are u?', 'who are u?']
with MultiThreadExecutor(10, '.cache') as pool:
for i in range(len(sys_names)):
agent = MyAgent(client_config='config.yaml')
task = agent.greeting(sys_names[i], prompts[i])
# print(pretty_print_nested(msgs))
pool.submit(task)
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
pure_agent-0.1.3.tar.gz
(8.4 kB
view details)
File details
Details for the file pure_agent-0.1.3.tar.gz.
File metadata
- Download URL: pure_agent-0.1.3.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40404e58320a35ac03f1cdcccabf5f0e46f19989f754d8652b8df683c5942707
|
|
| MD5 |
91b2efcc0ad65fa437e355636928fc2b
|
|
| BLAKE2b-256 |
ff8fb23d08666e53bedcd941246e52138fbe970fa7c96dd6c8375d49757d6d33
|