Skip to content

Commit e30b0d3

Browse files
authored
Merge pull request #1092 from Yash-2707/patch-1
Update test_agent_llmfx_process.py
2 parents 6055a6c + 224b3ad commit e30b0d3

File tree

1 file changed

+26
-34
lines changed

1 file changed

+26
-34
lines changed
Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,66 @@
1-
2-
""" Tests the execution of a multi-step Agent process using multiple SLIM models. """
1+
"""Tests the execution of a multi-step Agent process using multiple SLIM models."""
32

43
from llmware.agents import LLMfx
54

6-
75
def test_multistep_agent_process():
6+
# Sample customer transcript
7+
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."
88

9-
# sample customer transcript
10-
11-
customer_transcript = "My name is Michael Jones, and I am a long-time customer. " \
12-
"The Mixco product is not working currently, and it is having a negative impact " \
13-
"on my business, as we can not deliver our products while it is down. " \
14-
"This is the fourth time that I have called. My account number is 93203, and " \
15-
"my user name is mjones. Our company is based in Tampa, Florida."
16-
17-
# create an agent using LLMfx class
9+
# Create an agent using LLMfx class
1810
agent = LLMfx()
1911

12+
# Load the work
2013
agent.load_work(customer_transcript)
2114

22-
# load tools individually
15+
# Load tools individually
2316
agent.load_tool("sentiment")
2417
agent.load_tool("ner")
2518

26-
# load multiple tools
19+
# Load multiple tools
2720
agent.load_tool_list(["emotions", "topics", "intent", "tags", "ratings", "answer"])
2821

29-
# start deploying tools and running various analytics
30-
31-
# first conduct three 'soft skills' initial assessment using 3 different models
22+
# Start deploying tools and running various analytics
23+
# First, conduct three 'soft skills' initial assessment using 3 different models
3224
agent.sentiment()
3325
agent.emotions()
3426
agent.intent()
3527

36-
# alternative way to execute a tool, passing the tool name as a string
28+
# Alternative way to execute a tool, passing the tool name as a string
3729
agent.exec_function_call("ratings")
3830

39-
# call multiple tools concurrently
40-
agent.exec_multitool_function_call(["ner","topics","tags"])
31+
# Call multiple tools concurrently
32+
agent.exec_multitool_function_call(["ner", "topics", "tags"])
4133

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

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

49-
# you can 'unload_tool' to release it from memory
41+
# You can 'unload_tool' to release it from memory
5042
agent.unload_tool("ner")
5143
agent.unload_tool("topics")
5244

53-
# at end of processing, show the report that was automatically aggregated by key
45+
# At the end of processing, show the report that was automatically aggregated by key
5446
report = agent.show_report()
5547

56-
# displays a summary of the activity in the process
48+
# Display a summary of the activity in the process
5749
activity_summary = agent.activity_summary()
5850

59-
# list of the responses gathered
51+
# List of the responses gathered
6052
for i, entries in enumerate(agent.response_list):
61-
print("update: response analysis: ", i, entries)
62-
53+
print(f"Update: response analysis {i}: {entries}")
6354
assert entries is not None
6455

6556
assert activity_summary is not None
6657
assert agent.journal is not None
6758
assert report is not None
6859

69-
output = {"report": report, "activity_summary": activity_summary, "journal": agent.journal}
60+
output = {
61+
"report": report,
62+
"activity_summary": activity_summary,
63+
"journal": agent.journal
64+
}
7065

7166
return output
72-
73-
74-

0 commit comments

Comments
 (0)