
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
This is the partner package for tying Fireworks.ai and LangChain. Fireworks really strive to provide good support for LangChain use cases, so if you run into any issues please let us know. You can reach out to us in our Discord channel
To use the langchain-fireworks
package, follow these installation steps:
pip install langchain-fireworks
Sign in to Fireworks AI to obtain an API Key to access the models, and make sure it is set as the FIREWORKS_API_KEY
environment variable.
Once you've signed in and obtained an API key, follow these steps to set the FIREWORKS_API_KEY
environment variable:
export FIREWORKS_API_KEY='your_api_key'
Note: To make this environment variable persistent across terminal sessions, add the above line to your ~/.bashrc
, ~/.bash_profile
, or ~/.zshrc
file.
set FIREWORKS_API_KEY=your_api_key
Set up your model using a model id. If the model is not set, the default model is fireworks-llama-v2-7b-chat
. See the full, most up-to-date model list on fireworks.ai.
import getpass
import os
# Initialize a Fireworks model
llm = Fireworks(
model="accounts/fireworks/models/llama-v3p1-8b-instruct",
base_url="https://api.fireworks.ai/inference/v1/completions",
)
You can call the model directly with string prompts to get completions.
# Single prompt
output = llm.invoke("Who's the best quarterback in the NFL?")
print(output)
# Calling multiple prompts
output = llm.generate(
[
"Who's the best cricket player in 2016?",
"Who's the best basketball player in the league?",
]
)
print(output.generations)
Please checkout how to teach Fireworks function calling model to use a calculator here.
Fireworks focus on delivering the best experience for fast model inference as well as tool use. You can check out our blog for more details on how it fares compares to GPT-4, the punchline is that it is on par with GPT-4 in terms just function calling use cases, but it is way faster and much cheaper.
Please check out the cookbook here for an end to end flow
FAQs
An integration package connecting Fireworks and LangChain
We found that langchain-fireworks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.