Skip to content

[BUG] Streaming broken when Faraday default adapter set to :typhoeus #428

@jkogara

Description

@jkogara

Basic checks

  • I searched existing issues - this hasn't been reported
  • I can reproduce this consistently
  • This is a RubyLLM bug, not my application code

What's broken?

Streaming is broken when faraday is configured to use typhoeus as it's default adapter.

Env here https://github.com/crmne/ruby_llm/blob/main/lib/ruby_llm/streaming.rb#L76 is always nil

How to reproduce

Configure Faraday with

Faraday.default_adapter = :typhoeus

Faraday.default_connection = Faraday.new do |conn|
  conn.adapter Faraday.default_adapter
end

Do any streaming call

chat = RubyLLM.chat 
chat.ask("What is Watman") do |chunk|
  puts chunk.content
end

Expected behavior

Streaming works

What actually happened

Only blank lines will be emitted.

Environment

Think there's enough info here - I encountered a similar bug in another library - googleapis/google-api-ruby-client#24235 - may want to use the fix from there as inspiration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions