clap-agents 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. {clap_agents-0.3.0 → clap_agents-0.3.1}/PKG-INFO +1 -1
  2. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/google_team.py +1 -0
  3. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/mcp_team_agent.py +1 -0
  4. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/weth_test.py +0 -3
  5. {clap_agents-0.3.0 → clap_agents-0.3.1}/pyproject.toml +1 -1
  6. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/embedding/fastembed_embedding.py +1 -1
  7. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/llm_services/__init__.py +0 -1
  8. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/llm_services/base.py +0 -1
  9. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/llm_services/ollama_service.py +8 -0
  10. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/mcp_client/client.py +1 -1
  11. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/multiagent_pattern/agent.py +3 -1
  12. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/tool_pattern/tool.py +2 -0
  13. {clap_agents-0.3.0 → clap_agents-0.3.1}/.gitignore +0 -0
  14. {clap_agents-0.3.0 → clap_agents-0.3.1}/Dockerfile.full +0 -0
  15. {clap_agents-0.3.0 → clap_agents-0.3.1}/Dockerfile.minimal +0 -0
  16. {clap_agents-0.3.0 → clap_agents-0.3.1}/GITCLAP.png +0 -0
  17. {clap_agents-0.3.0 → clap_agents-0.3.1}/LICENSE +0 -0
  18. {clap_agents-0.3.0 → clap_agents-0.3.1}/PIP CLAP.png +0 -0
  19. {clap_agents-0.3.0 → clap_agents-0.3.1}/README.md +0 -0
  20. {clap_agents-0.3.0 → clap_agents-0.3.1}/changelog.md +0 -0
  21. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/CLAP-TEST-SUITE.py +0 -0
  22. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/all_func.py +0 -0
  23. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/autonomous_rebalancer.py +0 -0
  24. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/create_wallet.py +0 -0
  25. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/document_ingestion.py +0 -0
  26. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/email_test.py +0 -0
  27. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/google_agent.py +0 -0
  28. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/google_mcp.py +0 -0
  29. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/handsonml.pdf +0 -0
  30. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/huge_rag.py +0 -0
  31. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/local_rag.py +0 -0
  32. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/mcp_test_agent.py +0 -0
  33. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/mcp_test_suite.py +0 -0
  34. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/ollama_test.py +0 -0
  35. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/qdrant_ingestion.py +0 -0
  36. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/rag_all_functionalities.py +0 -0
  37. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/rag_test.py +0 -0
  38. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/react_test.py +0 -0
  39. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/rebalancer_agent.py +0 -0
  40. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/requirements.txt +0 -0
  41. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/scraping_test.py +0 -0
  42. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/simple_react_agent.py +0 -0
  43. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/smart_contract_agent.py +0 -0
  44. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/team_test.py +0 -0
  45. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/test_agent.py +0 -0
  46. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/tool_agent_rag.py +0 -0
  47. {clap_agents-0.3.0 → clap_agents-0.3.1}/examples/web3_agent_test.py +0 -0
  48. {clap_agents-0.3.0 → clap_agents-0.3.1}/googleopenaicompat.md +0 -0
  49. {clap_agents-0.3.0 → clap_agents-0.3.1}/simple2_mcp.py +0 -0
  50. {clap_agents-0.3.0 → clap_agents-0.3.1}/simple_mcp.py +0 -0
  51. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/__init__.py +0 -0
  52. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/embedding/__init__.py +0 -0
  53. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/embedding/base_embedding.py +0 -0
  54. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/embedding/ollama_embedding.py +0 -0
  55. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/embedding/sentence_transformer_embedding.py +0 -0
  56. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/llm_services/google_openai_compat_service.py +0 -0
  57. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/llm_services/groq_service.py +0 -0
  58. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/mcp_client/__init__.py +0 -0
  59. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/multiagent_pattern/__init__.py +0 -0
  60. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/multiagent_pattern/team.py +0 -0
  61. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/react_pattern/__init__.py +0 -0
  62. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/react_pattern/react_agent.py +0 -0
  63. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/tool_pattern/__init__.py +0 -0
  64. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/tool_pattern/tool_agent.py +0 -0
  65. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/tools/__init__.py +0 -0
  66. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/tools/email_tools.py +0 -0
  67. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/tools/web3_tools.py +0 -0
  68. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/tools/web_crawler.py +0 -0
  69. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/tools/web_search.py +0 -0
  70. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/utils/__init__.py +0 -0
  71. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/utils/completions.py +0 -0
  72. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/utils/extraction.py +0 -0
  73. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/utils/logging.py +0 -0
  74. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/utils/rag_utils.py +0 -0
  75. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/vector_stores/__init__.py +0 -0
  76. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/vector_stores/base.py +0 -0
  77. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/vector_stores/chroma_store.py +0 -0
  78. {clap_agents-0.3.0 → clap_agents-0.3.1}/src/clap/vector_stores/qdrant_store.py +0 -0
  79. {clap_agents-0.3.0 → clap_agents-0.3.1}/web3.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clap-agents
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A Python framework for building cognitive agentic patterns including ReAct agents, Multi-Agent Teams, native tool calling, and MCP client integration.
5
5
  Project-URL: Homepage, https://github.com/MaitreyaM/CLAP-AGENTS.git
6
6
  Project-URL: Repository, https://github.com/MaitreyaM/CLAP-AGENTS.git
@@ -21,6 +21,7 @@ async def run_google_team():
21
21
  task_expected_output="A 3-item bullet list.",
22
22
  llm_service=google_llm_service,
23
23
  model=gemini_model,
24
+ max_rounds=10
24
25
 
25
26
  )
26
27
 
@@ -42,6 +42,7 @@ async def run_agile_team_with_mcp():
42
42
  task_description="Analyze the provided context (search results and addition result) and extract the main benefits. Also count the words in the addition result.",
43
43
  task_expected_output="A concise bullet-point list summarizing key benefits, and the word count.",
44
44
  tools=[count_words],
45
+ max_rounds=10
45
46
  )
46
47
  reporter = Agent(
47
48
  name="Report_Writer",
@@ -1,9 +1,7 @@
1
- # examples/verify_weth_balance.py
2
1
  import os
3
2
  from dotenv import load_dotenv
4
3
  from web3 import Web3
5
4
 
6
- # --- Configuration ---
7
5
  load_dotenv()
8
6
  WEB3_PROVIDER_URL = os.getenv("WEB3_PROVIDER_URL")
9
7
  if not WEB3_PROVIDER_URL:
@@ -14,7 +12,6 @@ ADDRESS_WITH_WETH = "0x785239105435919318a804391305417B62657e05" # An address kn
14
12
  AGENT_ADDRESS = Web3().eth.account.from_key(os.getenv("AGENT_PRIVATE_KEY")).address
15
13
 
16
14
 
17
- # Standard ERC20 ABI to check balance and decimals
18
15
  ERC20_ABI = """
19
16
  [
20
17
  {"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"type":"function"},
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "clap-agents"
9
- version = "0.3.0"
9
+ version = "0.3.1"
10
10
  description = "A Python framework for building cognitive agentic patterns including ReAct agents, Multi-Agent Teams, native tool calling, and MCP client integration."
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.10"
@@ -57,7 +57,7 @@ class FastEmbedEmbeddings(EmbeddingFunctionInterface):
57
57
  except Exception as e:
58
58
  raise RuntimeError(f"Failed to initialize fastembed model '{self.model_name}': {e}")
59
59
 
60
- async def __call__(self, input: List[str]) -> List[List[float]]: # Changed to 'input'
60
+ async def __call__(self, input: List[str]) -> List[List[float]]:
61
61
  if not input: return []
62
62
  if not _FASTEMBED_LIB_AVAILABLE: raise RuntimeError("FastEmbed library not available.")
63
63
 
@@ -1,4 +1,3 @@
1
- # src/clap/llm_services/__init__.py
2
1
  from .base import LLMServiceInterface, StandardizedLLMResponse, LLMToolCall
3
2
  from .groq_service import GroqService
4
3
  from .google_openai_compat_service import GoogleOpenAICompatService
@@ -32,7 +32,6 @@ class LLMServiceInterface(abc.ABC):
32
32
  messages: List[Dict[str, Any]],
33
33
  tools: Optional[List[Dict[str, Any]]] = None,
34
34
  tool_choice: str = "auto",
35
- # Optional:
36
35
  # temperature: Optional[float] = None,
37
36
  # max_tokens: Optional[int] = None,
38
37
  ) -> StandardizedLLMResponse:
@@ -64,27 +64,35 @@ class OllamaOpenAICompatService(LLMServiceInterface):
64
64
  if not request_model: raise ValueError("Ollama model name not specified.")
65
65
  try:
66
66
  api_kwargs: Dict[str, Any] = {"messages": messages, "model": request_model}
67
+
67
68
  if tools and tool_choice != "none":
68
69
  api_kwargs["tools"] = tools
69
70
  if isinstance(tool_choice, dict) or tool_choice in ["auto", "required", "none"]: api_kwargs["tool_choice"] = tool_choice
70
71
  else: api_kwargs["tools"] = None; api_kwargs["tool_choice"] = None
72
+
71
73
  if temperature is not None: api_kwargs["temperature"] = temperature
72
74
  if max_tokens is not None: api_kwargs["max_tokens"] = max_tokens
73
75
  api_kwargs = {k: v for k, v in api_kwargs.items() if v is not None}
74
76
  # print(f"OllamaService: Sending request to model '{request_model}'")
75
77
  response = await self._client.chat.completions.create(**api_kwargs)
78
+
76
79
  message = response.choices[0].message
80
+
77
81
  text_content = message.content
78
82
  tool_calls_std: List[LLMToolCall] = []
83
+
79
84
  if message.tool_calls:
80
85
  for tc in message.tool_calls:
81
86
  if tc.id and tc.function and tc.function.name and tc.function.arguments is not None:
82
87
  tool_calls_std.append(LLMToolCall(id=tc.id, function_name=tc.function.name, function_arguments_json_str=tc.function.arguments))
83
88
  else: print(f"{Fore.YELLOW}Warning: Incomplete tool_call from Ollama: {tc}{Fore.RESET}")
89
+
84
90
  return StandardizedLLMResponse(text_content=text_content, tool_calls=tool_calls_std)
91
+
85
92
  except _OpenAIError_Placeholder_Type as e: # Use placeholder
86
93
  err_msg = f"Ollama (OpenAI Compat) API Error: {e}"
87
94
  if hasattr(e, 'response') and e.response and hasattr(e.response, 'text'): err_msg += f" - Details: {e.response.text}"
95
+
88
96
  print(f"{Fore.RED}{err_msg}{Fore.RESET}")
89
97
  return StandardizedLLMResponse(text_content=err_msg)
90
98
  except Exception as e:
@@ -39,7 +39,7 @@ class MCPClientManager:
39
39
  self._connect_locks: Dict[str, asyncio.Lock] = {
40
40
  name: asyncio.Lock() for name in server_configs
41
41
  }
42
- self._manager_lock = asyncio.Lock() # General lock for manager state
42
+ self._manager_lock = asyncio.Lock()
43
43
 
44
44
  async def _ensure_connected(self, server_name: str):
45
45
  """
@@ -74,6 +74,7 @@ class Agent:
74
74
  mcp_server_names: Optional[List[str]] = None,
75
75
  vector_store: Optional[VectorStoreInterface] = None,
76
76
  parallel_tool_calls: bool = True ,
77
+ **kwargs
77
78
  # embedding_function: Optional[EmbeddingFunction] = None,
78
79
 
79
80
  ):
@@ -86,6 +87,7 @@ class Agent:
86
87
  self.local_tools = tools or []
87
88
 
88
89
  self.vector_store = vector_store
90
+ self.react_agent_kwargs = kwargs
89
91
  # self.embedding_function = embedding_function
90
92
 
91
93
  llm_service_instance = llm_service or GroqService()
@@ -193,7 +195,7 @@ class Agent:
193
195
  self.task_description = original_task_description
194
196
 
195
197
  print(f"Agent {self.name}: Running ReactAgent...")
196
- raw_output = await self.react_agent.run(user_msg=msg)
198
+ raw_output = await self.react_agent.run(user_msg=msg,**self.react_agent_kwargs)
197
199
  output_data = {"output": raw_output}
198
200
 
199
201
  print(f"Agent {self.name}: Passing context to {len(self.dependents)} dependents...")
@@ -16,9 +16,11 @@ def get_fn_signature(fn: Callable) -> dict:
16
16
  sig = inspect.signature(fn)
17
17
  for name, type_hint in fn.__annotations__.items():
18
18
  if name == "return": continue
19
+
19
20
  param_type_name = getattr(type_hint, "__name__", str(type_hint))
20
21
  schema_type = type_mapping.get(param_type_name.lower(), "string")
21
22
  parameters["properties"][name] = {"type": schema_type}
23
+
22
24
  if sig.parameters[name].default is inspect.Parameter.empty:
23
25
  parameters["required"].append(name)
24
26
  if not parameters.get("required"):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes