move connect debug prints
This commit is contained in:
@@ -312,37 +312,54 @@ class ClaudeCode(PrecompiledProgram):
|
||||
"""
|
||||
prompt_parts = []
|
||||
|
||||
# add signature docstring if present
|
||||
# add signature docstring if present (skip auto-generated dspy docs)
|
||||
if self.signature.__doc__:
|
||||
doc = self.signature.__doc__.strip()
|
||||
if doc:
|
||||
prompt_parts.append(f"Task: {doc}")
|
||||
prompt_parts.append(doc)
|
||||
|
||||
# add input field description if present
|
||||
# DSPy fields store desc in json_schema_extra
|
||||
# extract input field info from FieldInfo
|
||||
input_desc = None
|
||||
input_prefix = None
|
||||
if (
|
||||
hasattr(self.input_field, "json_schema_extra")
|
||||
and self.input_field.json_schema_extra
|
||||
):
|
||||
input_desc = self.input_field.json_schema_extra.get("desc")
|
||||
input_prefix = self.input_field.json_schema_extra.get("prefix")
|
||||
|
||||
# add the actual input value
|
||||
prompt_parts.append(f"{self.input_field_name}: {input_value}")
|
||||
# format input field with prefix if available, otherwise use field name
|
||||
if input_prefix:
|
||||
input_label = input_prefix.rstrip(":")
|
||||
else:
|
||||
input_label = f"{self.input_field_name.replace('_', ' ').title()}:"
|
||||
|
||||
# add input with description on same line if available
|
||||
if input_desc:
|
||||
prompt_parts.append(f"({input_desc})")
|
||||
|
||||
# add output field description if present
|
||||
prompt_parts.append(f"{input_label}: {input_value}\nDescription: {input_desc}")
|
||||
else:
|
||||
prompt_parts.append(f"{input_label}: {input_value}")
|
||||
|
||||
# extract output field info from FieldInfo
|
||||
output_desc = None
|
||||
output_prefix = None
|
||||
if (
|
||||
hasattr(self.output_field, "json_schema_extra")
|
||||
and self.output_field.json_schema_extra
|
||||
):
|
||||
output_desc = self.output_field.json_schema_extra.get("desc")
|
||||
output_prefix = self.output_field.json_schema_extra.get("prefix")
|
||||
|
||||
# format output field with prefix if available, otherwise use field name
|
||||
if output_prefix:
|
||||
output_label = output_prefix.rstrip(":")
|
||||
else:
|
||||
output_label = f"{self.output_field_name.replace('_', ' ').title()}:"
|
||||
|
||||
# add output field with description
|
||||
if output_desc:
|
||||
prompt_parts.append(f"\nPlease produce the following output: {output_desc}")
|
||||
prompt_parts.append(f"{output_label}:\nDescription: {output_desc}")
|
||||
else:
|
||||
prompt_parts.append(f"{output_label}")
|
||||
|
||||
# the schema is passed through ClaudeAgentOptions and enforced by the SDK
|
||||
|
||||
|
||||
Reference in New Issue
Block a user