Skip to content

Commit 2cbcd1f

Browse files
committed
linting
1 parent b93bdc3 commit 2cbcd1f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: defog/llm/utils.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,16 @@ def _build_anthropic_params(
156156
"stop_sequences": stop,
157157
"timeout": timeout,
158158
}
159-
159+
160160
# Handle structured output for Anthropic models
161161
if response_format:
162162
# Add instructions to the system message to enforce structured output
163-
if isinstance(response_format, type) and hasattr(response_format, 'model_json_schema'):
163+
if isinstance(response_format, type) and hasattr(
164+
response_format, "model_json_schema"
165+
):
164166
schema = response_format.model_json_schema()
165167
schema_str = json.dumps(schema, indent=2)
166-
168+
167169
# Append structured output instructions to system prompt
168170
structured_instruction = f"""
169171
IMPORTANT: You must respond with ONLY a valid, properly formatted JSON object that conforms to the following JSON schema:
@@ -184,7 +186,7 @@ def _build_anthropic_params(
184186
params["system"] = sys_msg + "\n\n" + structured_instruction
185187
else:
186188
params["system"] = structured_instruction
187-
189+
188190
if tools:
189191
function_specs = get_function_specs(tools, model)
190192
params["tools"] = function_specs
@@ -359,7 +361,7 @@ async def _process_anthropic_response(
359361
else:
360362
# No tools provided
361363
content = response.content[0].text
362-
364+
363365
# Parse structured output if response_format is provided
364366
if response_format and not tools:
365367
# Check if response_format is a Pydantic model

0 commit comments

Comments
 (0)