Add record chat sheet with OpenAI streaming

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claudio Ortolina
2026-02-22 10:13:05 +00:00
parent 5868fa0219
commit 6e6e419801
9 changed files with 621 additions and 114 deletions
+8
View File
@@ -16,6 +16,14 @@ defmodule OpenAI do
{:ok, result}
end
def chat_stream(messages, opts \\ []) do
model = Keyword.get(opts, :model, "gpt-4o-mini")
temperature = Keyword.get(opts, :temperature, 0.7)
on_chunk = Keyword.fetch!(opts, :on_chunk)
API.chat_stream(messages, model, temperature, api_key(), on_chunk)
end
def embeddings(text) do
API.get_embeddings(text, api_key())
end