Fireworks

Use Fireworks AI models with Kern agents.

Fireworks is a platform for providing endpoints for Large Language models.

Authentication

Set your FIREWORKS_API_KEY environment variable. Get your key from here.

1export FIREWORKS_API_KEY=***
1setx FIREWORKS_API_KEY ***

Prompt caching

Prompt caching will happen automatically using our Fireworks model. You can read more about how Fireworks handle caching in their docs.

Example

Use Fireworks with your Agent:

1from kern.agent import Agent
2from kern.models.fireworks import Fireworks
3
4agent = Agent(
5 model=Fireworks(id="accounts/fireworks/models/firefunction-v2"),
6 markdown=True
7)
8
9# Print the response in the terminal
10agent.print_response("Share a 2 sentence horror story.")
Note View more examples here.

Parameters

ParameterTypeDefaultDescription
idstr"accounts/fireworks/models/llama-v3p1-405b-instruct"The id of the Fireworks model to use
namestr"Fireworks"The name of the model
providerstr"Fireworks"The provider of the model
api_keyOptional[str]NoneThe API key for Fireworks (defaults to FIREWORKS_API_KEY env var)
base_urlstr"https://api.fireworks.ai/inference/v1"The base URL for the Fireworks API

Fireworks extends the OpenAI-compatible interface and supports most parameters from the OpenAI model.