mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: [BREAKING] Make response_format validation errors visible to users (#3274)
* Make response_format validation errors visible to users * Small fix * Addressed comments
This commit is contained in:
committed by
GitHub
Unverified
parent
3c1be2a713
commit
83e8965c8e
@@ -44,11 +44,16 @@ async def main() -> None:
|
||||
client.get_streaming_response(message, tools=get_weather, options={"response_format": OutputStruct}),
|
||||
output_format_type=OutputStruct,
|
||||
)
|
||||
print(f"Assistant: {response.value}")
|
||||
|
||||
if result := response.try_parse_value(OutputStruct):
|
||||
print(f"Assistant: {result}")
|
||||
else:
|
||||
print(f"Assistant: {response.text}")
|
||||
else:
|
||||
response = await client.get_response(message, tools=get_weather, options={"response_format": OutputStruct})
|
||||
print(f"Assistant: {response.value}")
|
||||
if result := response.try_parse_value(OutputStruct):
|
||||
print(f"Assistant: {result}")
|
||||
else:
|
||||
print(f"Assistant: {response.text}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user