Research, Coding and Planning agents used by Sirji.
Project description
sirji-agents
sirji-agents
is a Python package designed to handle messages for Coding Agent, Planning Agent and Research Agent.
Installation
Install sirji-agents
quickly with pip:
pip install sirji-agents
Usages
Research Agent
Initialization
from sirji_agents import ResearchAgent
# Initialize Researcher without assistant ID
researcher = ResearchAgent('openai_assistant', 'openai_assistant')
# init_payload fetched from researcher object should be persisted
init_payload = researcher.init_payload
# Initialize Researcher with assistant ID
researcher = ResearchAgent('openai_assistant', 'openai_assistant', init_payload)
Some example message handling usages are given below.
Train using URL
from sirji_messages import MessageFactory, ActionEnum
message_class = MessageFactory[ActionEnum.TRAIN_USING_URL.name]
message_str = message_class().generate({"url": "https://finance.yahoo.com/quote/API/"})
researcher.message(message_str)
Infer
from sirji_messages import MessageFactory, ActionEnum
message_class = MessageFactory[ActionEnum.INFER.name]
message_str = message_class().generate({"details": "How to use yahoo finance api?"})
researcher.message(message_str)
Coding Agent
from sirji_agents import CodingAgent
# Initialize Coding Agent
coder = CodingAgent()
# Construct a message for problem statement
from sirji_messages import MessageFactory, ActionEnum
message_class = MessageFactory[ActionEnum.PROBLEM_STATEMENT.name]
message_str = message_class().generate({"details": "Create a python executable file to find out the factorial of a number"})
# At the beginning, history is empty
coder_history = []
# call the Coder and update the history variable
response_message, coder_history = coder.message(message_str, coder_history)
# Now in the new history:
# coder_history[0] is the system prompt
# coder_history[1] is the message from User to Coder passing the problem statement
# coder_history[2] is the response from the LLM inference
# Persist the history variable for future use.
Planning Agent
from sirji_agents import PlanningAgent
# Initialize Planning Agent
planner = PlanningAgent()
# Construct a message for generate steps message
from sirji_messages import MessageFactory, ActionEnum
message_class = MessageFactory[ActionEnum.GENERATE_STEPS.name]
message_str = message_class().generate({"details": "Create a python executable file to find out the factorial of a number"})
# In the actual flow, this message_str will be obtained as a response from Coder.
# At the beginning, history is empty
planner_history = []
# call the Planner and update the history variable
response_message, planner_history = planner.message(message_str, planner_history)
License
sirji-agents
is made available under the MIT License. See the included LICENSE file for more 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
sirji-agents-0.0.3.tar.gz
(9.0 kB
view hashes)
Built Distribution
Close
Hashes for sirji_agents-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64a04eea91ac97a6588d0d50f2c567198014ab4b2e6e8eeb7b2cc5a6f8480c26 |
|
MD5 | 663dbc846eca9c5e0722db7e770f606c |
|
BLAKE2b-256 | b0d2a0947efd54cbc0f65dde3b3ae108c13c016dff99dc1166246504d34e5393 |