Skip to main content

Fireworks AI Integration

Learn how to use Fireworks AI models with Airtrain.

Basic Chat

Here's how to use Fireworks AI's chat models:

from airtrain.integrations.fireworks.skills import FireworksChatSkill, FireworksInput

# Initialize the skill
skill = FireworksChatSkill()

# Create input for basic chat
input_data = FireworksInput(
user_input="Explain quantum computing in simple terms.",
system_prompt="You are a helpful teacher who explains complex topics simply.",
model="accounts/fireworks/models/deepseek-r1",
temperature=0.3,
max_tokens=500
)

# Get response
result = skill.process(input_data)
print(result.response)
print(f"Model Used: {result.used_model}")
print(f"Usage Statistics: {result.usage}")

Advanced Usage

For more specific use cases with additional parameters:

# Create input with specific parameters
input_data = FireworksInput(
user_input="What are the key differences between classical and quantum computers?",
system_prompt="You are a quantum computing expert. Provide clear, technical explanations.",
model="accounts/fireworks/models/deepseek-r1",
temperature=0.2,
max_tokens=1000,
context_length_exceeded_behavior="truncate"
)

result = skill.process(input_data)
print(result.response)
print(f"Model Used: {result.used_model}")
print(f"Usage Statistics: {result.usage}")