|
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.""" |
3 | 2 |
|
4 | 3 | from llmware.agents import LLMfx
|
5 | 4 |
|
6 |
| - |
7 | 5 | 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." |
8 | 8 |
|
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 |
18 | 10 | agent = LLMfx()
|
19 | 11 |
|
| 12 | + # Load the work |
20 | 13 | agent.load_work(customer_transcript)
|
21 | 14 |
|
22 |
| - # load tools individually |
| 15 | + # Load tools individually |
23 | 16 | agent.load_tool("sentiment")
|
24 | 17 | agent.load_tool("ner")
|
25 | 18 |
|
26 |
| - # load multiple tools |
| 19 | + # Load multiple tools |
27 | 20 | agent.load_tool_list(["emotions", "topics", "intent", "tags", "ratings", "answer"])
|
28 | 21 |
|
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 |
32 | 24 | agent.sentiment()
|
33 | 25 | agent.emotions()
|
34 | 26 | agent.intent()
|
35 | 27 |
|
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 |
37 | 29 | agent.exec_function_call("ratings")
|
38 | 30 |
|
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"]) |
41 | 33 |
|
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") |
45 | 37 |
|
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 |
47 | 39 | response = agent.answer("What is the customer's account number and user name?", key="customer_info")
|
48 | 40 |
|
49 |
| - # you can 'unload_tool' to release it from memory |
| 41 | + # You can 'unload_tool' to release it from memory |
50 | 42 | agent.unload_tool("ner")
|
51 | 43 | agent.unload_tool("topics")
|
52 | 44 |
|
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 |
54 | 46 | report = agent.show_report()
|
55 | 47 |
|
56 |
| - # displays a summary of the activity in the process |
| 48 | + # Display a summary of the activity in the process |
57 | 49 | activity_summary = agent.activity_summary()
|
58 | 50 |
|
59 |
| - # list of the responses gathered |
| 51 | + # List of the responses gathered |
60 | 52 | for i, entries in enumerate(agent.response_list):
|
61 |
| - print("update: response analysis: ", i, entries) |
62 |
| - |
| 53 | + print(f"Update: response analysis {i}: {entries}") |
63 | 54 | assert entries is not None
|
64 | 55 |
|
65 | 56 | assert activity_summary is not None
|
66 | 57 | assert agent.journal is not None
|
67 | 58 | assert report is not None
|
68 | 59 |
|
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 | + } |
70 | 65 |
|
71 | 66 | return output
|
72 |
| - |
73 |
| - |
74 |
| - |
0 commit comments