mbxai 2.1.2__tar.gz → 2.1.3__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.
- {mbxai-2.1.2 → mbxai-2.1.3}/PKG-INFO +1 -1
- {mbxai-2.1.2 → mbxai-2.1.3}/pyproject.toml +1 -1
- {mbxai-2.1.2 → mbxai-2.1.3}/setup.py +1 -1
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/__init__.py +1 -1
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/agent/client.py +35 -3
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/mcp/server.py +1 -1
- {mbxai-2.1.2 → mbxai-2.1.3}/.gitignore +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/LICENSE +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/README.md +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/agent/__init__.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/agent/models.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/core.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/agent_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/agent_iterations_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/agent_logging_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/agent_tool_registration_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/agent_validation_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/auto_schema_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/conversation_history_test.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/dialog_agent_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/mcp/mcp_client_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/mcp/mcp_server_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/openrouter_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/optional_prompt_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/parse_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/parse_tool_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/request.json +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/response.json +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/send_request.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/simple_agent_test.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/tool_client_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/examples/unified_interface_example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/mcp/__init__.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/mcp/client.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/mcp/example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/openrouter/__init__.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/openrouter/client.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/openrouter/config.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/openrouter/models.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/openrouter/schema.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/tools/__init__.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/tools/client.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/tools/example.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/src/mbxai/tools/types.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/tests/test_mcp_tool_registration.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/tests/test_real_mcp_schema.py +0 -0
- {mbxai-2.1.2 → mbxai-2.1.3}/tests/test_schema_conversion.py +0 -0
@@ -134,6 +134,35 @@ class AgentClient:
|
|
134
134
|
logger.debug(f"🔗 AI call with {len(messages)} messages (no history)")
|
135
135
|
return self._ai_client.parse(full_messages, response_format)
|
136
136
|
|
137
|
+
def _validate_answers(self, answers: Any) -> bool:
|
138
|
+
"""
|
139
|
+
Validate that answers parameter is a proper AnswerList with content.
|
140
|
+
|
141
|
+
Args:
|
142
|
+
answers: The answers parameter to validate
|
143
|
+
|
144
|
+
Returns:
|
145
|
+
True if answers is valid and has content, False otherwise
|
146
|
+
"""
|
147
|
+
# Check if answers is the correct type
|
148
|
+
if not isinstance(answers, AnswerList):
|
149
|
+
logger.warning(f"Invalid answers type: {type(answers)}. Expected AnswerList, treating as no answers.")
|
150
|
+
return False
|
151
|
+
|
152
|
+
# Check if answers has content
|
153
|
+
if not hasattr(answers, 'answers') or not answers.answers:
|
154
|
+
logger.info(f"Empty answers list provided, proceeding without answers processing.")
|
155
|
+
return False
|
156
|
+
|
157
|
+
# Check if answers list contains valid Answer objects
|
158
|
+
for answer in answers.answers:
|
159
|
+
if not hasattr(answer, 'key') or not hasattr(answer, 'answer'):
|
160
|
+
logger.warning(f"Invalid answer object in list: {answer}. Treating as no answers.")
|
161
|
+
return False
|
162
|
+
|
163
|
+
logger.debug(f"Validated {len(answers.answers)} answers")
|
164
|
+
return True
|
165
|
+
|
137
166
|
def _extract_token_usage(self, response: Any) -> TokenUsage:
|
138
167
|
"""Extract token usage information from an AI response."""
|
139
168
|
try:
|
@@ -188,7 +217,7 @@ class AgentClient:
|
|
188
217
|
final_response_structure: Type[BaseModel] = None,
|
189
218
|
ask_questions: bool = True,
|
190
219
|
agent_id: str = None,
|
191
|
-
answers: AnswerList = None
|
220
|
+
answers: AnswerList | None = None
|
192
221
|
) -> AgentResponse:
|
193
222
|
"""
|
194
223
|
Process a prompt through the agent's thinking process.
|
@@ -252,8 +281,11 @@ class AgentClient:
|
|
252
281
|
|
253
282
|
# Handle answers provided (skip question generation and process directly)
|
254
283
|
if answers is not None:
|
255
|
-
|
256
|
-
|
284
|
+
if self._validate_answers(answers):
|
285
|
+
logger.info(f"📝 Agent {agent_id}: Processing with provided answers, skipping question generation")
|
286
|
+
return self._process_answers_directly(agent_id, prompt, final_response_structure, answers, token_summary, history_for_ai)
|
287
|
+
else:
|
288
|
+
logger.info(f"📝 Agent {agent_id}: Invalid or empty answers provided, proceeding with normal flow")
|
257
289
|
|
258
290
|
# Step 1: Generate questions (if ask_questions is True)
|
259
291
|
if ask_questions:
|
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
|
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
|
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
|
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
|
File without changes
|