mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-08 18:57:52 +02:00
* Adds support for `NativeOutput` via a new `NativeOutput` dataclass * Adds support for structured output specification via the following (pydantic models already supported) * dataclasses * typed dicts * json schemas * Adds mocking support to support native strategies with `FakeToolCallingModel` * Add new default tool message when `tool_message_content` not provided * Smart "selection" of native vs tool output based on provider support, necessitates profiles down the line Considered questions * do we want to enforce docstrings? -- decided on no for now * do we want to enforce names (titles) on json schemas? -- decided no for now, defaulting to `structured_output` * do we want to validate that json schemas coming in are valid? -- decided no for now * do we want to validate model results against a given json schema? we validate against all other types (typed dict, dataclass, etc) w/ pydantic -- decided no for now TODO in future PRs: * Figure out retry policy * Add standard testing (handed off to @casparb) * Further privatize certain structures (like the bindings) -- this is low prio --------- Co-authored-by: Sydney Runkle <sydneymarierunkle@gmail.com> Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>
46 lines
1.4 KiB
JSON
46 lines
1.4 KiB
JSON
[
|
|
{
|
|
"name": "updated structured response",
|
|
"responseFormat": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"name": { "type": "string" },
|
|
"role": { "type": "string" }
|
|
},
|
|
"required": ["name", "role"]
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"name": { "type": "string" },
|
|
"department": { "type": "string" }
|
|
},
|
|
"required": ["name", "department"]
|
|
}
|
|
],
|
|
"assertionsByInvocation": [
|
|
{
|
|
"prompt": "What is the role of Sabine?",
|
|
"toolsWithExpectedCalls": {
|
|
"getEmployeeRole": 1,
|
|
"getEmployeeDepartment": 0
|
|
},
|
|
"expectedLastMessage": "Returning structured response: {'name': 'Sabine', 'role': 'Developer'}",
|
|
"expectedStructuredResponse": { "name": "Sabine", "role": "Developer" },
|
|
"llmRequestCount": 2
|
|
},
|
|
{
|
|
"prompt": "In which department does Henrik work?",
|
|
"toolsWithExpectedCalls": {
|
|
"getEmployeeRole": 1,
|
|
"getEmployeeDepartment": 1
|
|
},
|
|
"expectedLastMessage": "Returning structured response: {'name': 'Henrik', 'department': 'IT'}",
|
|
"expectedStructuredResponse": { "name": "Henrik", "department": "IT" },
|
|
"llmRequestCount": 4
|
|
}
|
|
]
|
|
}
|
|
|
|
] |