Skip to content

Commit f3761d0

Browse files
committed
bug fixes
1 parent 3385a50 commit f3761d0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/idp_common_pkg/idp_common/extraction/agentic_idp.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,13 @@ def extraction_tool(
222222
When you call this tool it overwrites the previous extraction, if you want to expand the extraction use jsonpatch.
223223
This tool needs to be Successfully invoked before the patch tool can be used."""
224224

225-
logger.info("extraction_tool called", extra={"models_extraction": extraction})
226225
# Note: The @tool decorator passes data as a dict, not as a model instance
227226
# We need to validate it manually using the Pydantic model
228227
extraction_model = model_class.model_validate(extraction) # pyright: ignore[reportAssignmentType]
229228
extraction_dict = extraction_model.model_dump(mode="json")
229+
logger.info(
230+
"extraction_tool called", extra={"models_extraction": extraction_dict}
231+
)
230232
agent.state.set(key="current_extraction", value=extraction_dict)
231233
logger.debug(
232234
"Successfully stored extraction in state",
@@ -863,7 +865,9 @@ async def structured_output_async(
863865
state={
864866
"current_extraction": None,
865867
"images": {},
866-
"existing_data": existing_data.model_dump() if existing_data else None,
868+
"existing_data": existing_data.model_dump(mode="json")
869+
if existing_data
870+
else None,
867871
"extraction_schema_json": schema_json, # Store for schema reminder tool
868872
},
869873
conversation_manager=SummarizingConversationManager(

lib/idp_common_pkg/idp_common/extraction/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ def _invoke_extraction_model(
927927
context="Extraction",
928928
)
929929

930-
extracted_fields = structured_data.model_dump()
930+
extracted_fields = structured_data.model_dump(mode="json")
931931
metering = response_with_metering["metering"]
932932
parsing_succeeded = True
933933
else:

0 commit comments

Comments
 (0)