You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Clean up LangSmith sample per PR #292 review
- basic/starter.py: move `@traceable` decorator directly onto `main`,
removing the nested `run_workflow` closure (addresses reviewer comment)
- basic/worker.py, chatbot/worker.py: move `LangSmithPlugin` from the
`Client` to the `Worker`, matching our recommended pattern (plugin on
the worker in worker code; on the client in client code)
* Return workflow result from basic starter's main
@Traceable captures the decorated function's return value as the
LangSmith trace output, so implicitly returning None left the trace's
output field empty. Return `result` (and annotate the return type) so
the trace shows the workflow response.
* Return minimal ChatResponse from chatbot call_openai activity
The activity previously returned `openai.types.responses.Response`
directly. The OpenAI API currently returns
`"prompt_cache_retention": "in_memory"` (underscore), but openai SDK
v2.32.0 declares that field as `Literal["in-memory", "24h"]`. The openai
client parses laxly so the activity succeeds, but Temporal's
`pydantic_data_converter` uses strict `TypeAdapter(Response).validate_json`
on the way into the workflow and rejects the underscore value, failing
every workflow task.
Define minimal `ChatResponse` and `ToolCall` pydantic models in
`activities.py` exposing only the fields the workflow uses (id,
output_text, tool_calls). The activity projects the openai Response
down to this shape so the sample is no longer coupled to SDK drift in
fields it doesn't use.
Update the workflow loop to iterate `response.tool_calls` directly and
the test mocks/helpers to build `ChatResponse` instead of constructing
openai Response objects.
0 commit comments