We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73b82fb commit 5bd0adcCopy full SHA for 5bd0adc
lib/llm/providers/openai.rb
@@ -30,11 +30,16 @@ def complete(message, **params)
30
params = DEFAULT_PARAMS.merge(params)
31
body = {messages: messages.map(&:to_h)}.merge!(params)
32
req = preflight(req, body)
33
+ puts req.body
34
if params[:stream]
35
Fiber.new do
36
@http.request(req) do |res|
37
res.read_body do |chunk|
- Fiber.yield Response::Chunk.new(chunk[/{.*}/], self).extend(response_parser)
38
+ chunk.scan(/^data:(.+)$/).each do |match|
39
+ break if match[0].strip == "[DONE]"
40
+ next if match[0].strip.empty?
41
+ Fiber.yield Response::Chunk.new(match[0], self).extend(response_parser)
42
+ end
43
end
44
45
0 commit comments