Skip to content

Commit 5af4540

Browse files
committed
[7.6.3] -- [FEAT][Agent.run() acceleration] [FIX][Groupchat]
1 parent 57eca9b commit 5af4540

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2444
-1172
lines changed

.env.example

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ BRAVESEARCH_API_KEY=""
2929
TAVILY_API_KEY=""
3030
YOU_API_KEY=""
3131

32-
## Analytics & Monitoring
33-
AGENTOPS_API_KEY=""
3432
EXA_API_KEY=""
3533

3634
## Browser Automation

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,6 @@ We provide vast array of features to save agent states using json, yaml, toml, u
427427
| `tokens_checks()` | Performs token checks for the agent. |
428428
| `print_dashboard()` | Prints the dashboard of the agent. |
429429
| `get_docs_from_doc_folders()` | Fetches all the documents from the doc folders. |
430-
| `activate_agentops()` | Activates agent operations. |
431-
| `check_end_session_agentops()` | Checks the end of the session for agent operations. |
432430

433431

434432

@@ -480,8 +478,6 @@ agent.print_dashboard()
480478
agent.get_docs_from_doc_folders()
481479

482480
# Activate agent ops
483-
agent.activate_agentops()
484-
agent.check_end_session_agentops()
485481

486482
# Dump the model to a JSON file
487483
agent.model_dump_json()

agent_tools_dict_example.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from swarms.prompts.finance_agent_sys_prompt import (
55
FINANCIAL_AGENT_SYS_PROMPT,
66
)
7-
from swarms.utils.str_to_dict import str_to_dict
7+
88

99
load_dotenv()
1010

@@ -49,16 +49,11 @@
4949
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
5050
max_loops=1,
5151
tools_list_dictionary=tools,
52+
output_type="final",
5253
)
5354

5455
out = agent.run(
5556
"What is the current stock price for Apple Inc. (AAPL)? Include historical price data.",
5657
)
5758

58-
print(out)
59-
6059
print(type(out))
61-
62-
print(str_to_dict(out))
63-
64-
print(type(str_to_dict(out)))

docs/applications/discord.md

-105
This file was deleted.

docs/blogs/blog.md

+765
Large diffs are not rendered by default.

docs/mkdocs.yml

+32
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ plugins:
4545
# include_requirejs: true
4646
extra_css:
4747
- assets/css/extra.css
48+
4849
extra:
4950
social:
5051
- icon: fontawesome/brands/twitter
@@ -60,6 +61,20 @@ extra:
6061
provider: google
6162
property: G-MPE9C65596
6263

64+
alternate:
65+
- name: English
66+
link: /
67+
lang: en
68+
- name: 简体中文
69+
link: /zh/
70+
lang: zh
71+
- name: 日本語
72+
link: /ja/
73+
lang: ja
74+
- name: 한국어
75+
link: /ko/
76+
lang: ko
77+
6378
theme:
6479
name: material
6580
custom_dir: overrides
@@ -90,6 +105,23 @@ theme:
90105
code: "Fira Code" # Modern look for code snippets
91106

92107

108+
# Add language selector
109+
language: en
110+
alternate:
111+
- name: English
112+
link: /
113+
lang: en
114+
- name: 简体中文
115+
link: /zh/
116+
lang: zh
117+
- name: 日本語
118+
link: /ja/
119+
lang: ja
120+
- name: 한국어
121+
link: /ko/
122+
lang: ko
123+
124+
93125
# Extensions
94126
markdown_extensions:
95127
- abbr

docs/swarms/install/env.md

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ Swarms uses environment variables for configuration management and secure creden
5858
- `YOU_API_KEY`: You.com search integration
5959

6060
2. **Analytics & Monitoring**
61-
- `AGENTOPS_API_KEY`: AgentOps monitoring
6261
- `EXA_API_KEY`: Exa.ai services
6362

6463
3. **Browser Automation**

docs/swarms/structs/agent.md

-6
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ graph TD
183183
| `remove_tool(tool)` | Removes a tool from the agent's toolset. | `tool` (Callable): Tool to remove. | `agent.remove_tool(my_custom_tool)` |
184184
| `remove_tools(tools)` | Removes multiple tools from the agent's toolset. | `tools` (List[Callable]): List of tools to remove. | `agent.remove_tools([tool1, tool2])` |
185185
| `get_docs_from_doc_folders()` | Retrieves and processes documents from the specified folder. | None | `agent.get_docs_from_doc_folders()` |
186-
| `check_end_session_agentops()` | Checks and ends the AgentOps session if enabled. | None | `agent.check_end_session_agentops()` |
187186
| `memory_query(task, *args, **kwargs)` | Queries the long-term memory for relevant information. | `task` (str): The task or query.<br>`*args`, `**kwargs`: Additional arguments. | `result = agent.memory_query("Find information about X")` |
188187
| `sentiment_analysis_handler(response)` | Performs sentiment analysis on the given response. | `response` (str): The response to analyze. | `agent.sentiment_analysis_handler("Great job!")` |
189188
| `count_and_shorten_context_window(history, *args, **kwargs)` | Counts tokens and shortens the context window if necessary. | `history` (str): The conversation history.<br>`*args`, `**kwargs`: Additional arguments. | `shortened_history = agent.count_and_shorten_context_window(history)` |
@@ -195,7 +194,6 @@ graph TD
195194
| `truncate_string_by_tokens(input_string, limit)` | Truncates a string to fit within a token limit. | `input_string` (str): String to truncate.<br>`limit` (int): Token limit. | `truncated_string = agent.truncate_string_by_tokens("Long string", 100)` |
196195
| `tokens_operations(input_string)` | Performs various token-related operations on the input string. | `input_string` (str): String to process. | `processed_string = agent.tokens_operations("Input string")` |
197196
| `parse_function_call_and_execute(response)` | Parses a function call from the response and executes it. | `response` (str): Response containing the function call. | `result = agent.parse_function_call_and_execute(response)` |
198-
| `activate_agentops()` | Activates AgentOps functionality. | None | `agent.activate_agentops()` |
199197
| `llm_output_parser(response)` | Parses the output from the language model. | `response` (Any): Response from the LLM. | `parsed_response = agent.llm_output_parser(llm_output)` |
200198
| `log_step_metadata(loop, task, response)` | Logs metadata for each step of the agent's execution. | `loop` (int): Current loop number.<br>`task` (str): Current task.<br>`response` (str): Agent's response. | `agent.log_step_metadata(1, "Analyze data", "Analysis complete")` |
201199
| `to_dict()` | Converts the agent's attributes to a dictionary. | None | `agent_dict = agent.to_dict()` |
@@ -484,10 +482,6 @@ agent.print_dashboard()
484482
# Fetch all the documents from the doc folders
485483
agent.get_docs_from_doc_folders()
486484

487-
# Activate agent ops
488-
agent.activate_agentops()
489-
agent.check_end_session_agentops()
490-
491485
# Dump the model to a JSON file
492486
agent.model_dump_json()
493487
print(agent.to_toml())

docs/swarms/structs/agent_docs_v1.md

-2
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,6 @@ agent.print_dashboard()
528528
agent.get_docs_from_doc_folders()
529529

530530
# Activate agent ops
531-
agent.activate_agentops()
532-
agent.check_end_session_agentops()
533531

534532
# Dump the model to a JSON file
535533
agent.model_dump_json()

example.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,23 @@
1212
agent_name="Financial-Analysis-Agent",
1313
agent_description="Personal finance advisor agent",
1414
system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
15-
max_loops="auto",
15+
max_loops=2,
1616
model_name="gpt-4o",
1717
dynamic_temperature_enabled=True,
1818
user_name="swarms_corp",
1919
retry_attempts=3,
2020
context_length=8192,
2121
return_step_meta=False,
22-
output_type="str", # "json", "dict", "csv" OR "string" "yaml" and
22+
output_type="all", # "json", "dict", "csv" OR "string" "yaml" and
2323
auto_generate_prompt=False, # Auto generate prompt for the agent based on name, description, and system prompt, task
2424
max_tokens=4000, # max output tokens
2525
saved_state_path="agent_00.json",
2626
interactive=False,
2727
role="director",
2828
)
2929

30-
agent.run(
31-
"Create a table of super high growth opportunities for AI. I have $40k to invest in ETFs, index funds, and more. Please create a table in markdown.",
30+
print(
31+
agent.run(
32+
"Conduct an analysis of the best real undervalued ETFs. Think for 2 loops internally"
33+
)
3234
)
File renamed without changes.

agent_judge_example.py renamed to examples/reasoning_agent_examples/agent_judge_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from swarms.agents.agent_judge import AgentJudge
22

33

4-
judge = AgentJudge(model_name="gpt-4o", max_loops=1)
4+
judge = AgentJudge(model_name="gpt-4o-mini", max_loops=1)
55

66

77
outputs = [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from swarms.agents.gkp_agent import GKPAgent
2+
3+
# Initialize the GKP Agent
4+
agent = GKPAgent(
5+
agent_name="gkp-agent",
6+
model_name="gpt-4o-mini", # Using OpenAI's model
7+
num_knowledge_items=6, # Generate 6 knowledge items per query
8+
)
9+
10+
# Example queries
11+
queries = [
12+
"What are the implications of quantum entanglement on information theory?",
13+
]
14+
15+
# Run the agent
16+
results = agent.run(queries)
17+
18+
# Print results
19+
for i, result in enumerate(results):
20+
print(f"\nQuery {i+1}: {queries[i]}")
21+
print(f"Answer: {result}")

0 commit comments

Comments
 (0)