Fireworks
This page covers how to use Fireworks models within Langchain.
Installation and setupβ
Install the Fireworks client library.
pip install fireworks-ai
Get a Fireworks API key by signing up at app.fireworks.ai.
Authenticate by setting the FIREWORKS_API_KEY environment variable.
Authenticationβ
There are two ways to authenticate using your Fireworks API key:
Setting the
FIREWORKS_API_KEY
environment variable.os.environ["FIREWORKS_API_KEY"] = "<KEY>"
Setting
fireworks_api_key
field in the Fireworks LLM module.llm = Fireworks(fireworks_api_key="<KEY>")
Using the Fireworks LLM moduleβ
Fireworks integrates with Langchain through the LLM module. In this example, we will work the llama-v2-13b-chat model.
from langchain.llms.fireworks import Fireworks
llm = Fireworks(
fireworks_api_key="<KEY>",
model="accounts/fireworks/models/llama-v2-13b-chat",
max_tokens=256)
llm("Name 3 sports.")
For a more detailed walkthrough, see here.