baml icon indicating copy to clipboard operation
baml copied to clipboard

Support Fireworks AI endpoint

Open arunbahl opened this issue 1 year ago • 5 comments

Fireworks.ai clients previously worked using an openai-type provider, but have since stopped working with a 400 Bad Request error:

Request failed: {"error":{"object":"error","type":"invalid_request_error","message":"Extra inputs are not permitted, field: 'stream_options'"}}

Is it possible to:

  • prevent stream_options from being sent by setting a field in options? or
  • can we have a specific provider for FireworksAI that doesn't set a value for stream_options?

Fireworks generally has excellent token rates, it would be great to be able to use BAML with them.

arunbahl avatar Aug 15 '24 17:08 arunbahl

oh yes for fireworks, can you try the "ollama" provider?

that one doesn't include "stream_options"

if that works, then I'll update the docs

hellovai avatar Aug 15 '24 18:08 hellovai

Great idea! I tried it, but got {"error":"unauthorized"}. Looks like ollama doesn't forward along the value for api_key.

You can set it manually using headers { "Authorization" "Bearer api_key" } but because string concatenation isn't supported there, you'd have to either save the API key in the .baml file itself, or use an environment variable with Bearer prepended to it.

arunbahl avatar Aug 15 '24 18:08 arunbahl

yes our current workaround is to add the header with an environment variable like that, we'll see if we just add a quick provider for fireworks that works out-of-the-box in a cleaner way.

aaronvg avatar Aug 15 '24 21:08 aaronvg

@arunbahl to unblock you i think we can have an env variable thats something like FIREWORKS_API_KEY="Bearer <key>"

But we'll look into a way to prevent and likely remove teh stream_options parameter

Oops, just realized you noted that already.

hellovai avatar Aug 15 '24 22:08 hellovai

Makes sense and the workaround is great for now. Thanks for your responsiveness and all your work on this project, we're fans :)

arunbahl avatar Aug 15 '24 22:08 arunbahl