AIML Docs

Using AIML with Fireworks

Learn how to use AIML with Fireworks AI API

Using AIML with Fireworks API

This guide will help you run your AIML agents using the Fireworks AI API.

Important: Currently requires the enable-api-preview=true header to be set while AIML is still in preview.

Prerequisites

Before you begin, you'll need:

  1. A Fireworks AI account
  2. An API key from Fireworks AI
  3. Your AIML prompt

That's it. No Special SDKs or anything. In fact, if you are already using an SDK such as the Vercel AI SDK or another such tool you absolutely do not need to change anything except adding the enable-api-preview=true header and sending the AIML content as a system prompt.

API Integration

To use AIML with Fireworks, you'll send your AIML content as a system prompt to the Fireworks API. The API will process the AIML workflow and return the results.

API Examples

Here are examples of how to call the Fireworks API with AIML loaded from a file, assuming you have a file called my-first-agent.aiml containing your AIML prompt:

 
# Then use the file in the API call
curl --request POST \
  --url https://api.fireworks.ai/inference/v1/chat/completions \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --header 'enable-api-preview: true' \
  --data "{
  \"model\": \"accounts/fireworks/models/llama-v3p1-8b-instruct\",
  \"messages\": [
    {
      \"role\": \"system\",
      \"content\": \"$(cat my-first-agent.aiml)\"
    },
    {
      \"role\": \"user\",
      \"content\": \"What is AIML?\"
    }
  ],
}"

Next Steps

On this page