{"id":4971,"library":"langchain-fireworks","title":"Fireworks LangChain Integration","description":"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.","status":"active","version":"1.1.0","language":"en","source_language":"en","source_url":"https://github.com/langchain-ai/langchain/tree/master/libs/partners/fireworks","tags":["langchain","llm","embeddings","fireworks.ai","partner package","ai"],"install":[{"cmd":"pip install langchain-fireworks","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core functionalities for LangChain integrations.","package":"langchain-core","optional":false},{"reason":"Used internally for interacting with the Fireworks AI API.","package":"openai","optional":false}],"imports":[{"symbol":"ChatFireworks","correct":"from langchain_fireworks import ChatFireworks"},{"symbol":"FireworksEmbeddings","correct":"from langchain_fireworks import FireworksEmbeddings"}],"quickstart":{"code":"import os\nfrom langchain_fireworks import ChatFireworks\nfrom langchain_core.messages import HumanMessage, SystemMessage\n\n# Ensure FIREWORKS_API_KEY environment variable is set.\n# For a real application, load your API key securely.\n# os.environ[\"FIREWORKS_API_KEY\"] = \"YOUR_FIREWORKS_API_KEY\"\n\nllm = ChatFireworks(\n    model=\"accounts/fireworks/models/llama-v3p3-70b-instruct\",\n    temperature=0,\n    max_tokens=None,\n    fireworks_api_key=os.environ.get(\"FIREWORKS_API_KEY\", \"\") # Fallback for quickstart if not set\n)\n\nmessages = [\n    SystemMessage(content=\"You are a helpful assistant.\"),\n    HumanMessage(content=\"What is the capital of France?\"),\n]\n\nresponse = llm.invoke(messages)\nprint(response.content)\n","lang":"python","description":"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."},"warnings":[{"fix":"Refer to the official LangChain documentation and migration guides for the latest API usage. Ensure `langchain-core` is updated to a compatible version.","message":"LangChain, 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).","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Set the `FIREWORKS_API_KEY` environment variable or pass `fireworks_api_key='your-key'` directly during model instantiation.","message":"The `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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your Python environment is running a compatible version (3.10, 3.11, or 3.12).","message":"The 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"When 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.","severity":"gotcha","affected_versions":"Versions prior to `langchain-fireworks==1.1.0` and specific Fireworks AI models"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}