Skip to content

Commit

Permalink
Update test_agent_llmfx_process.py
Browse files Browse the repository at this point in the history
Consider adding try-except blocks to handle any potential errors that might occur during the execution of the various tools and functions
Implement a logging mechanism to track the progress of the agent process and any important events or errors that occur. This can be useful for debugging and monitoring purposes.
Add the ability to save and load the state of the agent process, allowing users to pick up where they left off or share their work with others
 Design the agent process to be easily extensible, so that new tools or functionality can be added without requiring major changes to the existing codebase.
Investigate ways to optimize the performance of the agent process, such as caching results or parallelizing the execution of certain tools.
  • Loading branch information
Yash-2707 authored Oct 30, 2024
1 parent d463d19 commit 224b3ad
Showing 1 changed file with 26 additions and 34 deletions.
60 changes: 26 additions & 34 deletions tests/models/test_agent_llmfx_process.py
Original file line number Diff line number Diff line change
@@ -1,74 +1,66 @@

""" Tests the execution of a multi-step Agent process using multiple SLIM models. """
"""Tests the execution of a multi-step Agent process using multiple SLIM models."""

from llmware.agents import LLMfx


def test_multistep_agent_process():
# Sample customer transcript
customer_transcript = "My name is Michael Jones, and I am a long-time customer. The Mixco product is not working currently, and it is having a negative impact on my business, as we can not deliver our products while it is down. This is the fourth time that I have called. My account number is 93203, and my user name is mjones. Our company is based in Tampa, Florida."

# sample customer transcript

customer_transcript = "My name is Michael Jones, and I am a long-time customer. " \
"The Mixco product is not working currently, and it is having a negative impact " \
"on my business, as we can not deliver our products while it is down. " \
"This is the fourth time that I have called. My account number is 93203, and " \
"my user name is mjones. Our company is based in Tampa, Florida."

# create an agent using LLMfx class
# Create an agent using LLMfx class
agent = LLMfx()

# Load the work
agent.load_work(customer_transcript)

# load tools individually
# Load tools individually
agent.load_tool("sentiment")
agent.load_tool("ner")

# load multiple tools
# Load multiple tools
agent.load_tool_list(["emotions", "topics", "intent", "tags", "ratings", "answer"])

# start deploying tools and running various analytics

# first conduct three 'soft skills' initial assessment using 3 different models
# Start deploying tools and running various analytics
# First, conduct three 'soft skills' initial assessment using 3 different models
agent.sentiment()
agent.emotions()
agent.intent()

# alternative way to execute a tool, passing the tool name as a string
# Alternative way to execute a tool, passing the tool name as a string
agent.exec_function_call("ratings")

# call multiple tools concurrently
agent.exec_multitool_function_call(["ner","topics","tags"])
# Call multiple tools concurrently
agent.exec_multitool_function_call(["ner", "topics", "tags"])

# the 'answer' tool is a quantized question-answering model - ask an 'inline' question
# the optional 'key' assigns the output to a dictionary key for easy consolidation
agent.answer("What is a short summary?",key="summary")
# The 'answer' tool is a quantized question-answering model - ask an 'inline' question
# The optional 'key' assigns the output to a dictionary key for easy consolidation
agent.answer("What is a short summary?", key="summary")

# prompting tool to ask a quick question as part of the analytics
# Prompting tool to ask a quick question as part of the analytics
response = agent.answer("What is the customer's account number and user name?", key="customer_info")

# you can 'unload_tool' to release it from memory
# You can 'unload_tool' to release it from memory
agent.unload_tool("ner")
agent.unload_tool("topics")

# at end of processing, show the report that was automatically aggregated by key
# At the end of processing, show the report that was automatically aggregated by key
report = agent.show_report()

# displays a summary of the activity in the process
# Display a summary of the activity in the process
activity_summary = agent.activity_summary()

# list of the responses gathered
# List of the responses gathered
for i, entries in enumerate(agent.response_list):
print("update: response analysis: ", i, entries)

print(f"Update: response analysis {i}: {entries}")
assert entries is not None

assert activity_summary is not None
assert agent.journal is not None
assert report is not None

output = {"report": report, "activity_summary": activity_summary, "journal": agent.journal}
output = {
"report": report,
"activity_summary": activity_summary,
"journal": agent.journal
}

return output



0 comments on commit 224b3ad

Please sign in to comment.