dhisana 0.0.1.dev267__py3-none-any.whl → 0.0.1.dev269__py3-none-any.whl
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.
- dhisana/utils/generate_structured_output_internal.py +41 -50
- {dhisana-0.0.1.dev267.dist-info → dhisana-0.0.1.dev269.dist-info}/METADATA +1 -1
- {dhisana-0.0.1.dev267.dist-info → dhisana-0.0.1.dev269.dist-info}/RECORD +6 -6
- {dhisana-0.0.1.dev267.dist-info → dhisana-0.0.1.dev269.dist-info}/WHEEL +0 -0
- {dhisana-0.0.1.dev267.dist-info → dhisana-0.0.1.dev269.dist-info}/entry_points.txt +0 -0
- {dhisana-0.0.1.dev267.dist-info → dhisana-0.0.1.dev269.dist-info}/top_level.txt +0 -0
|
@@ -330,22 +330,12 @@ async def _get_structured_output_with_web_search(
|
|
|
330
330
|
"- After gathering information, provide your response in the required JSON format."
|
|
331
331
|
)
|
|
332
332
|
|
|
333
|
-
|
|
333
|
+
# Build conversation history that we'll extend with tool calls/results
|
|
334
|
+
conversation_history = [
|
|
334
335
|
{"role": "system", "content": system_content},
|
|
335
336
|
{"role": "user", "content": prompt},
|
|
336
337
|
]
|
|
337
338
|
|
|
338
|
-
base_request = {
|
|
339
|
-
"input": input_messages,
|
|
340
|
-
"model": model,
|
|
341
|
-
"text": {"format": json_schema_format},
|
|
342
|
-
"tools": tools,
|
|
343
|
-
"store": False,
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
if model.startswith("o"):
|
|
347
|
-
base_request["reasoning"] = {"effort": effort}
|
|
348
|
-
|
|
349
339
|
max_tool_iterations = 10
|
|
350
340
|
tool_iteration = 0
|
|
351
341
|
completion = None
|
|
@@ -353,10 +343,22 @@ async def _get_structured_output_with_web_search(
|
|
|
353
343
|
while tool_iteration < max_tool_iterations:
|
|
354
344
|
tool_iteration += 1
|
|
355
345
|
|
|
346
|
+
# Build request with current conversation history
|
|
347
|
+
request = {
|
|
348
|
+
"input": conversation_history,
|
|
349
|
+
"model": model,
|
|
350
|
+
"text": {"format": json_schema_format},
|
|
351
|
+
"tools": tools,
|
|
352
|
+
"store": False,
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if model.startswith("o"):
|
|
356
|
+
request["reasoning"] = {"effort": effort}
|
|
357
|
+
|
|
356
358
|
# Retry logic for rate limits
|
|
357
359
|
for attempt in range(2):
|
|
358
360
|
try:
|
|
359
|
-
completion = await client_async.responses.create(**
|
|
361
|
+
completion = await client_async.responses.create(**request)
|
|
360
362
|
break
|
|
361
363
|
except (RateLimitError, OpenAIError) as e:
|
|
362
364
|
is_rl = (
|
|
@@ -386,46 +388,35 @@ async def _get_structured_output_with_web_search(
|
|
|
386
388
|
# No tool calls, we have the final response
|
|
387
389
|
break
|
|
388
390
|
|
|
389
|
-
#
|
|
391
|
+
# Add the model's complete output to conversation history (includes function_call items)
|
|
392
|
+
# Per OpenAI docs: "input_list += response.output"
|
|
393
|
+
for item in (completion.output or []):
|
|
394
|
+
conversation_history.append(item)
|
|
395
|
+
|
|
396
|
+
# Execute tool calls and add results to conversation history
|
|
390
397
|
logging.info(f"Processing {len(tool_calls)} web search tool call(s) in iteration {tool_iteration}")
|
|
391
398
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
"text": {"format": json_schema_format},
|
|
397
|
-
"tools": tools,
|
|
398
|
-
"store": False,
|
|
399
|
-
"previous_response_id": completion.id,
|
|
400
|
-
"input": [],
|
|
401
|
-
}
|
|
402
|
-
if model.startswith("o"):
|
|
403
|
-
base_request["reasoning"] = {"effort": effort}
|
|
399
|
+
for tc in tool_calls:
|
|
400
|
+
func_name = getattr(tc, "name", "")
|
|
401
|
+
call_id = getattr(tc, "call_id", "")
|
|
402
|
+
args_str = getattr(tc, "arguments", "{}")
|
|
404
403
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
"call_id": call_id,
|
|
422
|
-
"output": tool_result
|
|
423
|
-
})
|
|
424
|
-
|
|
425
|
-
logging.info(f"Executed web search tool {func_name}, result length: {len(tool_result)}")
|
|
426
|
-
else:
|
|
427
|
-
logging.warning("No response ID available, breaking tool call loop")
|
|
428
|
-
break
|
|
404
|
+
try:
|
|
405
|
+
args = json.loads(args_str) if args_str else {}
|
|
406
|
+
except json.JSONDecodeError:
|
|
407
|
+
args = {}
|
|
408
|
+
|
|
409
|
+
# Execute the tool
|
|
410
|
+
tool_result = await _execute_web_search_tool(func_name, args, tool_config)
|
|
411
|
+
|
|
412
|
+
# Add tool result to conversation history (only function_call_output, not function_call)
|
|
413
|
+
conversation_history.append({
|
|
414
|
+
"type": "function_call_output",
|
|
415
|
+
"call_id": call_id,
|
|
416
|
+
"output": tool_result,
|
|
417
|
+
})
|
|
418
|
+
|
|
419
|
+
logging.info(f"Executed web search tool {func_name}, result length: {len(tool_result)}")
|
|
429
420
|
|
|
430
421
|
# Parse and return the final response
|
|
431
422
|
return _parse_completion_response(completion, response_format, cache_key)
|
|
@@ -45,7 +45,7 @@ dhisana/utils/generate_flow.py,sha256=QMn6bWo0nH0fBvy2Ebub1XfH5udnVAqsPsbIqCtQPX
|
|
|
45
45
|
dhisana/utils/generate_leads_salesnav.py,sha256=FG7q6GSm9IywZ9TgQnn5_N3QNfiI-Qk2gaO_3GS99nY,12236
|
|
46
46
|
dhisana/utils/generate_linkedin_connect_message.py,sha256=QxsxDiT-3eQOqAAbW13d0HGJXV36WYPvC-7Zsw_2VTI,10208
|
|
47
47
|
dhisana/utils/generate_linkedin_response_message.py,sha256=mWoSs5p2JSTIoFZFGm86x1kgs67J7dHPvGKZPzcdGdU,14569
|
|
48
|
-
dhisana/utils/generate_structured_output_internal.py,sha256=
|
|
48
|
+
dhisana/utils/generate_structured_output_internal.py,sha256=G9eqgT5SYI60rlOi6qQTndtsUpaLDuNM509limO8Zfs,31061
|
|
49
49
|
dhisana/utils/google_custom_search.py,sha256=5rQ4uAF-hjFpd9ooJkd6CjRvSmhZHhqM0jfHItsbpzk,10071
|
|
50
50
|
dhisana/utils/google_oauth_tools.py,sha256=ReG5lCpXL3_e_s0yn6ai4U7B4-feOWHJVtbv_c0g0rE,28525
|
|
51
51
|
dhisana/utils/google_workspace_tools.py,sha256=fuV0UcvAqF9drLzj7-p6D5zh7d5jMXl1jNJTICk4XOo,50224
|
|
@@ -95,8 +95,8 @@ dhisana/workflow/agent.py,sha256=esv7_i_XuMkV2j1nz_UlsHov_m6X5WZZiZm_tG4OBHU,565
|
|
|
95
95
|
dhisana/workflow/flow.py,sha256=xWE3qQbM7j2B3FH8XnY3zOL_QXX4LbTW4ArndnEYJE0,1638
|
|
96
96
|
dhisana/workflow/task.py,sha256=HlWz9mtrwLYByoSnePOemBUBrMEcj7KbgNjEE1oF5wo,1830
|
|
97
97
|
dhisana/workflow/test.py,sha256=E7lRnXK0PguTNzyasHytLzTJdkqIPxG5_4qk4hMEeKc,3399
|
|
98
|
-
dhisana-0.0.1.
|
|
99
|
-
dhisana-0.0.1.
|
|
100
|
-
dhisana-0.0.1.
|
|
101
|
-
dhisana-0.0.1.
|
|
102
|
-
dhisana-0.0.1.
|
|
98
|
+
dhisana-0.0.1.dev269.dist-info/METADATA,sha256=i3l5OJUWJmr3y9sB2pfoTA2w9jTPSFgVCHqTIu8SiLA,1190
|
|
99
|
+
dhisana-0.0.1.dev269.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
100
|
+
dhisana-0.0.1.dev269.dist-info/entry_points.txt,sha256=jujxteZmNI9EkEaK-pOCoWuBujU8TCevdkfl9ZcKHek,49
|
|
101
|
+
dhisana-0.0.1.dev269.dist-info/top_level.txt,sha256=NETTHt6YifG_P7XtRHbQiXZlgSFk9Qh9aR-ng1XTf4s,8
|
|
102
|
+
dhisana-0.0.1.dev269.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|