Registry / llm-agents / langchain-fireworks

langchain-fireworks

JSON →
library1.6.1pypypi✓ verified 22d ago

An integration package connecting Fireworks AI with LangChain, providing functionalities for chat models (ChatFireworks) and embedding models (FireworksEmbeddings). The current version is 1.1.0, and the library follows a regular release cadence, often aligned with updates to the broader LangChain ecosystem.

pip install langchain-fireworks
INSTALL
IMPORT
SIG · LANGCHAIN-FIREWORK
L
langchain-fireworks
llm-agentspythonv1.6.1
Install
11.7s avg
Import
5741ms
Disk
108MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.6.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 5.906s · 105.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 11.7s · import 5.576s · 115MB
108MB installed
● package 108MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ChatFireworks
from langchain_fireworks import ChatFireworks
FireworksEmbeddings
from langchain_fireworks import FireworksEmbeddings

Demonstrates how to initialize `ChatFireworks` with a specific model and make a simple chat completion call, ensuring the API key is provided, preferably via an environment variable. The model `llama-v3p3-70b-instruct` is an example; refer to Fireworks AI for the latest model IDs.

import os from langchain_fireworks import ChatFireworks from langchain_core.messages import HumanMessage, SystemMessage # Ensure FIREWORKS_API_KEY environment variable is set. # For a real application, load your API key securely. # os.environ["FIREWORKS_API_KEY"] = "YOUR_FIREWORKS_API_KEY" llm = ChatFireworks( model="accounts/fireworks/models/llama-v3p3-70b-instruct", temperature=0, max_tokens=None, fireworks_api_key=os.environ.get("FIREWORKS_API_KEY", "") # Fallback for quickstart if not set ) messages = [ SystemMessage(content="You are a helpful assistant."), HumanMessage(content="What is the capital of France?"), ] response = llm.invoke(messages) print(response.content)
Debug
Known issues
breakingLangChain, as a rapidly evolving ecosystem, frequently undergoes API changes, especially with major version bumps of `langchain-core`. Code from older tutorials or examples may use deprecated patterns and require migration to newer interfaces (e.g., LCEL).
fix
Refer to the official LangChain documentation and migration guides for the latest API usage. Ensure `langchain-core` is updated to a compatible version.
affects: <1.0.0
gotchaThe `FIREWORKS_API_KEY` environment variable is the primary method for authenticating with Fireworks AI. Failure to set this variable correctly or pass it directly to the model constructor will result in authentication errors.
fix
Set the `FIREWORKS_API_KEY` environment variable or pass `fireworks_api_key='your-key'` directly during model instantiation.
affects: All versions
gotchaThe library explicitly requires Python versions `>=3.10.0` and `<4.0.0`. Using unsupported Python versions (e.g., older than 3.10 or Python 4.x) may lead to installation failures or runtime incompatibilities.
fix
Ensure your Python environment is running a compatible version (3.10, 3.11, or 3.12).
affects: All versions
gotchaWhen using advanced features like tool calling or structured output, some specific Fireworks models have historically exhibited issues with retaining `reasoning_content` in multi-turn conversations, potentially leading to incorrect responses or hallucinations.
fix
Thoroughly test tool use and structured output with your chosen model. Monitor Fireworks AI's release notes and LangChain's changelog for model-specific fixes and improvements. Ensure the latest version of `langchain-fireworks` is installed, as improvements for structured output have been released.
affects: Versions prior to `langchain-fireworks==1.1.0` and specific Fireworks AI models
Errors
Common errors & fixes
AuthenticationError({'fault': {'faultstring': 'Invalid ApiKey', 'detail': {'errorcode': 'oauth.v2.InvalidApiKey'}}})
The Fireworks AI API key is either missing, incorrectly set in your environment variables, or an invalid key was provided during model instantiation.
fix
Set the `FIREWORKS_API_KEY` environment variable with your valid Fireworks API key, or pass the `fireworks_api_key` argument directly when initializing `ChatFireworks` or `FireworksEmbeddings`.
Example: `os.environ["FIREWORKS_API_KEY"] = "your_api_key"` or `ChatFireworks(fireworks_api_key="your_api_key", ...)`
_pydantic_core.ValidationError: 1 validation error for ChatFireworks model. Field required [type=missing, input_value={'name': 'accounts/firewo...: 1, 'model_kwargs': {}}, input_type=dict]
This error typically occurs when a required parameter, most commonly the `model` name, is not provided during the instantiation of the `ChatFireworks` class, or there's a compatibility issue with `pydantic` and newer Python versions (e.g., 3.12/3.13).
fix
Ensure that the `model` parameter is explicitly passed when initializing `ChatFireworks` with a valid model identifier. If using Python 3.12 or 3.13, ensure all related `langchain` and `pydantic` packages are updated to compatible versions.
Example: `ChatFireworks(model="accounts/fireworks/models/llama-v3-70b-instruct", ...)`
ModuleNotFoundError: No module named 'langchain.chat_models.fireworks'
Due to the modularization of the LangChain ecosystem, `ChatFireworks` and `FireworksEmbeddings` are now part of the `langchain-fireworks` integration package and should be imported directly from it, not from the older `langchain` core paths.
fix
Import `ChatFireworks` (or `FireworksEmbeddings`) directly from `langchain_fireworks`.
For chat models: `from langchain_fireworks import ChatFireworks`
For embedding models: `from langchain_fireworks import FireworksEmbeddings`
Upgrade
Version history
1.6.1latest on PyPI · released Aug 27, 2026
Audit
Dependencies
langchain-corerequiredCore functionalities for LangChain integrations.
openairequiredUsed internally for interacting with the Fireworks AI API.
Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
langchain-fireworks — pip install langchain-fireworks · libregistry