feat(llm): log structured LLM response and extra_body

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Woody 2026-04-28 16:50:26 +08:00
parent 091fa84443
commit 48e15f8232
1 changed files with 8 additions and 0 deletions

View File

@ -128,12 +128,20 @@ class LLMClient:
self.logger.info("[%s] Structured LLM request started. Prompt: %s", step_name, prompt_preview) self.logger.info("[%s] Structured LLM request started. Prompt: %s", step_name, prompt_preview)
start_time = time.perf_counter() start_time = time.perf_counter()
extra_body = self._build_extra_body()
self.logger.info("[%s] Structured LLM Extra Body: %s", step_name, str(extra_body))
try: try:
model = self._get_langchain_model() model = self._get_langchain_model()
structured = model.with_structured_output(pydantic_model, method="json_schema") structured = model.with_structured_output(pydantic_model, method="json_schema")
result = await structured.ainvoke(prompt) result = await structured.ainvoke(prompt)
elapsed_ms = (time.perf_counter() - start_time) * 1000 elapsed_ms = (time.perf_counter() - start_time) * 1000
self.logger.info(
"[%s] Structured LLM Response: %s",
step_name,
getattr(result, "model_dump", lambda: result)(),
)
self.logger.info( self.logger.info(
"[%s] Structured LLM request completed in %.2fms", "[%s] Structured LLM request completed in %.2fms",
step_name, step_name,