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
In this example we use a different Req's streaming style. Instead of setting `into: :self` and decoding a stream of incoming messages, we equip Req with 2-arity callback that is called on each chunk. In the callback, we use `ServerSentEvents.Parser` to parse incoming chunks while maintaining parser state in request struct. For each parsed `response.output_text.delta` event, we pass it to a client-provided callback, which can, for example, send delta to a LiveView process. Finally, once we receive `response.completed` event with a complete response body, we use this body as a final request result. This is useful if the caller wants to access final response body in addition to streamed deltas.
107
+
108
+
```elixir
109
+
%{
110
+
model:"gpt-5.4-nano",
111
+
reasoning: %{effort:"none"},
112
+
instructions:"You are a poet, fluent in multiple languages and emoji usage.",
113
+
input:"Write a poem across multiple languages and emojis!"
0 commit comments