Module: Legion::Extensions::Mlx::Helpers::Client
- Included in:
- Client, Runners::Chat, Runners::Completions, Runners::Embeddings, Runners::Models
- Defined in:
- lib/legion/extensions/mlx/helpers/client.rb
Constant Summary collapse
- DEFAULT_HOST =
'http://localhost:8080'
Instance Method Summary collapse
Instance Method Details
#client(host: DEFAULT_HOST) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/legion/extensions/mlx/helpers/client.rb', line 12 def client(host: DEFAULT_HOST, **) Faraday.new(url: host) do |conn| conn.request :json conn.response :json, content_type: /\bjson$/ conn.headers['Content-Type'] = 'application/json' conn..timeout = 300 conn..open_timeout = 10 end end |
#streaming_client(host: DEFAULT_HOST) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/legion/extensions/mlx/helpers/client.rb', line 22 def streaming_client(host: DEFAULT_HOST, **) Faraday.new(url: host) do |conn| conn.request :json conn.headers['Content-Type'] = 'application/json' conn..timeout = 300 conn..open_timeout = 10 end end |