### Clone and Setup Repository Source: https://docs.fireworks.ai/fine-tuning/quickstart-math Commands to clone the GSM8K quickstart repository, navigate into the directory, and install the required Python dependencies from the requirements file. ```shellscript git clone https://github.com/eval-protocol/quickstart-gsm8k.git cd quickstart-gsm8k pip install -r requirements.txt ``` -------------------------------- ### Setup Eval Protocol Environment via CLI Source: https://docs.fireworks.ai/llms-full.txt Commands to clone the quickstart repository, install necessary dependencies, and initialize the required directory structure for GSM8K evaluation. ```bash git clone https://github.com/eval-protocol/quickstart-gsm8k.git cd quickstart-gsm8k pip install -r requirements.txt mkdir -p gsm8k_artifacts/{tests/pytest/gsm8k,development} cp evaluation.py gsm8k_artifacts/tests/pytest/gsm8k/test_pytest_math_example.py cp gsm8k_sample.jsonl gsm8k_artifacts/development/gsm8k_sample.jsonl ``` -------------------------------- ### Install and Configure Eval Protocol Source: https://docs.fireworks.ai/llms-full.txt Commands to clone the quickstart repository, install the necessary Python package, and set up the environment configuration file for API keys. ```bash git clone git@github.com:eval-protocol/quickstart.git cd quickstart pip install "eval-protocol[svgbench]" cp evaluator/env.example evaluator/.env ``` -------------------------------- ### GET /v1/accounts/{account_id}/supervisedFineTuningJobs Source: https://docs.fireworks.ai/tools-sdks/python-sdk Retrieves a list of all supervised fine-tuning jobs associated with the account. ```APIDOC ## GET /v1/accounts/{account_id}/supervisedFineTuningJobs ### Description Lists all supervised fine-tuning jobs for the given account. ### Method GET ### Endpoint /v1/accounts/{account_id}/supervisedFineTuningJobs ### Parameters #### Path Parameters - **account_id** (string) - Required - The unique identifier of the account. ### Response #### Success Response (200) - **jobs** (array) - A list of fine-tuning job objects. ``` -------------------------------- ### Fine-tuning Cookbook Examples Source: https://docs.fireworks.ai/deployments/benchmarking This section provides practical examples and guides for various fine-tuning techniques using the Fireworks AI training SDK. It covers general cookbook overviews, Reinforcement Learning (RL), Direct Preference Optimization (DPO), and Supervised Fine-Tuning (SFT) methodologies. ```json { "source": "/fine-tuning/training-sdk/cookbook-overview", "destination": "/fine-tuning/training-sdk/cookbook/overview" } ``` ```json { "source": "/fine-tuning/training-sdk/cookbook-rl", "destination": "/fine-tuning/training-sdk/cookbook/rl" } ``` ```json { "source": "/fine-tuning/training-sdk/cookbook-dpo", "destination": "/fine-tuning/training-sdk/cookbook/dpo" } ``` ```json { "source": "/fine-tuning/training-sdk/cookbook-sft", "destination": "/fine-tuning/training-sdk/cookbook/sft" } ``` ```json { "source": "/fine-tuning/training-sdk/cookbook-reference", "destination": "/fine-tuning/training-sdk/cookbook/reference" } ``` -------------------------------- ### Setup and API Request Logging in Python Source: https://docs.fireworks.ai/api-reference/audio-translations Demonstrates the installation of required Python packages and the implementation of a logging mechanism to track API response times and text output. This snippet uses the OpenAI SDK to interface with LLM endpoints. ```python !pip install openai requests from openai import OpenAI import requests from dotenv import import print(f"Took: {time.time() - start:.3f}s. Text: '{r.text}'") ``` -------------------------------- ### Install Fireworks AI Python SDK (Alpha) Source: https://docs.fireworks.ai/tools-sdks/python-sdk Installs the alpha version of the Fireworks AI Python SDK. Requires Python 3.9+ and an API key. Use the `--pre` flag for the latest pre-release versions. ```bash pip install --pre fireworks-ai ``` -------------------------------- ### Reservation Commands Source: https://docs.fireworks.ai/tools-sdks/python-sdk Commands for retrieving information about reservations. ```APIDOC ## firectl reservation get ### Description Prints information about a reservation. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl reservation list ### Description Prints active reservations. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified ``` -------------------------------- ### Deployments API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage and deploy models. ```APIDOC ## POST /v1/deployments ### Description Creates a new deployment. ### Method POST ### Endpoint /v1/deployments ### Parameters #### Request Body - **name** (string) - Required - The name of the deployment. - **model_id** (string) - Required - The ID of the model to deploy. - **scale_type** (string) - Optional - The type of scaling. ### Request Example ```json { "name": "my-llama-deployment", "model_id": "llama-v2-7b", "scale_type": "auto" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the deployment. - **name** (string) - The name of the deployment. - **status** (string) - The status of the deployment. #### Response Example ```json { "id": "dep_abc123", "name": "my-llama-deployment", "status": "creating" } ``` ``` ```APIDOC ## GET /v1/deployments ### Description Lists all deployments. ### Method GET ### Endpoint /v1/deployments ### Response #### Success Response (200) - **deployments** (array) - A list of deployments. #### Response Example ```json { "deployments": [ { "id": "dep_abc123", "name": "my-llama-deployment", "status": "running" } ] } ``` ``` ```APIDOC ## GET /v1/deployments/{deployment_id} ### Description Retrieves a specific deployment by its ID. ### Method GET ### Endpoint /v1/deployments/{deployment_id} ### Parameters #### Path Parameters - **deployment_id** (string) - Required - The ID of the deployment to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the deployment. - **name** (string) - The name of the deployment. - **status** (string) - The status of the deployment. #### Response Example ```json { "id": "dep_abc123", "name": "my-llama-deployment", "status": "running" } ``` ``` ```APIDOC ## PUT /v1/deployments/{deployment_id} ### Description Updates a specific deployment. ### Method PUT ### Endpoint /v1/deployments/{deployment_id} ### Parameters #### Path Parameters - **deployment_id** (string) - Required - The ID of the deployment to update. #### Request Body - **scale_type** (string) - Optional - The new scale type. ### Request Example ```json { "scale_type": "fixed" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the deployment. - **name** (string) - The name of the deployment. - **status** (string) - The status of the deployment. #### Response Example ```json { "id": "dep_abc123", "name": "my-llama-deployment", "status": "updating" } ``` ``` ```APIDOC ## DELETE /v1/deployments/{deployment_id} ### Description Deletes a specific deployment by its ID. ### Method DELETE ### Endpoint /v1/deployments/{deployment_id} ### Parameters #### Path Parameters - **deployment_id** (string) - Required - The ID of the deployment to delete. ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Deployment deleted successfully." } ``` ``` ```APIDOC ## POST /v1/deployments/{deployment_id}/undelete ### Description Undeletes a specific deployment. ### Method POST ### Endpoint /v1/deployments/{deployment_id}/undelete ### Parameters #### Path Parameters - **deployment_id** (string) - Required - The ID of the deployment to undelete. ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Deployment undeleted successfully." } ``` ``` ```APIDOC ## POST /v1/deployments/{deployment_id}/scale ### Description Scales a specific deployment. ### Method POST ### Endpoint /v1/deployments/{deployment_id}/scale ### Parameters #### Path Parameters - **deployment_id** (string) - Required - The ID of the deployment to scale. #### Request Body - **scale_type** (string) - Required - The new scale type. - **min_replicas** (integer) - Optional - Minimum number of replicas. - **max_replicas** (integer) - Optional - Maximum number of replicas. ### Request Example ```json { "scale_type": "fixed", "min_replicas": 1, "max_replicas": 5 } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Deployment scaling initiated." } ``` ``` -------------------------------- ### Audio Batch API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage batch requests for audio processing. ```APIDOC ## Audio Batch API Endpoints ### Description This section details the API endpoints for managing batch requests related to audio processing. ### Endpoints - **POST /api-reference/create-batch-request** - **Description**: Creates a new batch request for audio processing. - **GET /api-reference/get-batch-status** - **Description**: Retrieves the status of a batch request. ``` -------------------------------- ### Models API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage and interact with models. ```APIDOC ## POST /v1/models ### Description Creates a new model. ### Method POST ### Endpoint /v1/models ### Parameters #### Request Body - **name** (string) - Required - The name of the model. - **source_url** (string) - Required - The URL of the model source. ### Request Example ```json { "name": "my-custom-model", "source_url": "s3://my-bucket/my-model.gguf" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the model. - **name** (string) - The name of the model. - **status** (string) - The status of the model. #### Response Example ```json { "id": "model_xyz789", "name": "my-custom-model", "status": "uploading" } ``` ``` ```APIDOC ## GET /v1/models ### Description Lists all models. ### Method GET ### Endpoint /v1/models ### Response #### Success Response (200) - **models** (array) - A list of models. #### Response Example ```json { "models": [ { "id": "model_xyz789", "name": "my-custom-model", "status": "ready" } ] } ``` ``` ```APIDOC ## GET /v1/models/{model_id} ### Description Retrieves a specific model by its ID. ### Method GET ### Endpoint /v1/models/{model_id} ### Parameters #### Path Parameters - **model_id** (string) - Required - The ID of the model to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the model. - **name** (string) - The name of the model. - **status** (string) - The status of the model. #### Response Example ```json { "id": "model_xyz789", "name": "my-custom-model", "status": "ready" } ``` ``` ```APIDOC ## GET /v1/models/{model_id}/upload ### Description Gets the upload endpoint for a specific model. ### Method GET ### Endpoint /v1/models/{model_id}/upload ### Parameters #### Path Parameters - **model_id** (string) - Required - The ID of the model. ### Response #### Success Response (200) - **upload_url** (string) - The URL to upload the model files to. #### Response Example ```json { "upload_url": "https://s3.amazonaws.com/my-bucket/uploads/model_xyz789?signature=..." } ``` ``` ```APIDOC ## GET /v1/models/{model_id}/download ### Description Gets the download endpoint for a specific model. ### Method GET ### Endpoint /v1/models/{model_id}/download ### Parameters #### Path Parameters - **model_id** (string) - Required - The ID of the model. ### Response #### Success Response (200) - **download_url** (string) - The URL to download the model files from. #### Response Example ```json { "download_url": "https://s3.amazonaws.com/my-bucket/models/model_xyz789.gguf" } ``` ``` ```APIDOC ## PUT /v1/models/{model_id} ### Description Updates a specific model. ### Method PUT ### Endpoint /v1/models/{model_id} ### Parameters #### Path Parameters - **model_id** (string) - Required - The ID of the model to update. #### Request Body - **name** (string) - Optional - The new name for the model. ### Request Example ```json { "name": "my-updated-model-name" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the model. - **name** (string) - The updated name of the model. - **status** (string) - The status of the model. #### Response Example ```json { "id": "model_xyz789", "name": "my-updated-model-name", "status": "ready" } ``` ``` ```APIDOC ## DELETE /v1/models/{model_id} ### Description Deletes a specific model by its ID. ### Method DELETE ### Endpoint /v1/models/{model_id} ### Parameters #### Path Parameters - **model_id** (string) - Required - The ID of the model to delete. ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Model deleted successfully." } ``` ``` ```APIDOC ## POST /v1/models/{model_id}/prepare ### Description Prepares a model for use. ### Method POST ### Endpoint /v1/models/{model_id}/prepare ### Parameters #### Path Parameters - **model_id** (string) - Required - The ID of the model to prepare. ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Model preparation initiated." } ``` ``` ```APIDOC ## POST /v1/models/validate/upload ### Description Validates a model upload. ### Method POST ### Endpoint /v1/models/validate/upload ### Parameters #### Request Body - **model_id** (string) - Required - The ID of the model. - **file_url** (string) - Required - The URL of the uploaded model file. ### Request Example ```json { "model_id": "model_xyz789", "file_url": "s3://my-bucket/uploads/model_xyz789?signature=..." } ``` ### Response #### Success Response (200) - **message** (string) - Validation status message. #### Response Example ```json { "message": "Model upload validation successful." } ``` ``` -------------------------------- ### POST /v1/chat/completions Source: https://docs.fireworks.ai/tools-sdks/python-sdk Create a chat completion for the provided prompt and parameters using the OpenAI-compatible API. ```APIDOC ## POST /v1/chat/completions ### Description Create a completion for the provided prompt and parameters. ### Method POST ### Endpoint /v1/chat/completions ### Request Body - **model** (string) - Required - The ID of the model to use. - **messages** (array) - Required - A list of messages comprising the conversation so far. ### Request Example { "model": "accounts/fireworks/models/llama-v3-70b-instruct", "messages": [{"role": "user", "content": "Hello!"}] } ### Response #### Success Response (200) - **id** (string) - Unique identifier for the completion. - **choices** (array) - List of completion choices. #### Response Example { "id": "chatcmpl-123", "choices": [{"message": {"role": "assistant", "content": "Hello there!"}}] } ``` -------------------------------- ### Accounts API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage user accounts within the system. ```APIDOC ## Accounts API Endpoints ### Description This section provides endpoints for managing user accounts, including retrieval and listing of account information. ### Endpoints - **GET /api-reference/accounts** - **Description**: Retrieves a list of user accounts. ``` -------------------------------- ### POST /v1/accounts/{account_id}/supervisedFineTuningJobs Source: https://docs.fireworks.ai/tools-sdks/python-sdk Creates a new supervised fine-tuning job within the specified account. ```APIDOC ## POST /v1/accounts/{account_id}/supervisedFineTuningJobs ### Description Initiates a new supervised fine-tuning training process. ### Method POST ### Endpoint /v1/accounts/{account_id}/supervisedFineTuningJobs ### Parameters #### Path Parameters - **account_id** (string) - Required - The unique identifier of the account. ### Response #### Success Response (200) - **job_id** (string) - The unique identifier of the created job. ``` -------------------------------- ### Responses API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage and retrieve responses generated by the API. ```APIDOC ## POST /v1/responses ### Description Creates a new response. ### Method POST ### Endpoint /v1/responses ### Parameters #### Request Body - **content** (string) - Required - The content of the response. ### Request Example ```json { "content": "This is a sample response." } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the response. - **content** (string) - The content of the response. #### Response Example ```json { "id": "resp_abc123", "content": "This is a sample response." } ``` ``` ```APIDOC ## GET /v1/responses ### Description Lists all responses. ### Method GET ### Endpoint /v1/responses ### Response #### Success Response (200) - **responses** (array) - A list of responses. #### Response Example ```json { "responses": [ { "id": "resp_abc123", "content": "This is a sample response." } ] } ``` ``` ```APIDOC ## GET /v1/responses/{response_id} ### Description Retrieves a specific response by its ID. ### Method GET ### Endpoint /v1/responses/{response_id} ### Parameters #### Path Parameters - **response_id** (string) - Required - The ID of the response to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the response. - **content** (string) - The content of the response. #### Response Example ```json { "id": "resp_abc123", "content": "This is a sample response." } ``` ``` ```APIDOC ## DELETE /v1/responses/{response_id} ### Description Deletes a specific response by its ID. ### Method DELETE ### Endpoint /v1/responses/{response_id} ### Parameters #### Path Parameters - **response_id** (string) - Required - The ID of the response to delete. ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Response deleted successfully." } ``` ``` -------------------------------- ### Deployment Shapes API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Retrieve information about available deployment shapes and their versions. ```APIDOC ## Deployment Shapes API Endpoints ### Description This section provides endpoints to query available deployment shapes and their specific versions. ### Endpoints - **GET /api-reference/list-deployment-shape-versions** - **Description**: Lists all available versions for deployment shapes. - **GET /api-reference/get-deployment-shape** - **Description**: Retrieves details of a specific deployment shape. - **GET /api-reference/get-deployment-shape-version** - **Description**: Retrieves details of a specific version of a deployment shape. ``` -------------------------------- ### Datasets API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage datasets for fine-tuning, including creation, upload, and retrieval. ```APIDOC ## Datasets API Endpoints ### Description This section details the API endpoints for managing datasets used in fine-tuning processes, covering creation, file handling, and validation. ### Endpoints - **POST /api-reference/create-dataset** - **Description**: Creates a new dataset. - **GET /api-reference/list-datasets** - **Description**: Lists all available datasets. - **GET /api-reference/get-dataset** - **Description**: Retrieves details of a specific dataset. - **GET /api-reference/get-dataset-upload-endpoint** - **Description**: Gets the endpoint for uploading dataset files. - **GET /api-reference/get-dataset-download-endpoint** - **Description**: Gets the endpoint for downloading dataset files. - **PUT /api-reference/update-dataset** - **Description**: Updates an existing dataset. - **DELETE /api-reference/delete-dataset** - **Description**: Deletes a specified dataset. - **POST /api-reference/upload-dataset-files** - **Description**: Uploads files to a dataset. - **POST /api-reference/validate-dataset-upload** - **Description**: Validates a dataset upload. ``` -------------------------------- ### LoRA API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage LoRA (Low-Rank Adaptation) models. ```APIDOC ## POST /v1/lora/models ### Description Creates a new LoRA model. ### Method POST ### Endpoint /v1/lora/models ### Parameters #### Request Body - **name** (string) - Required - The name of the LoRA model. - **base_model_id** (string) - Required - The ID of the base model. - **lora_model_url** (string) - Required - The URL of the LoRA model weights. ### Request Example ```json { "name": "my-lora-model", "base_model_id": "llama-v2-7b", "lora_model_url": "s3://my-bucket/lora/my-lora.safetensors" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the LoRA model. - **name** (string) - The name of the LoRA model. #### Response Example ```json { "id": "lora_abc123", "name": "my-lora-model" } ``` ``` ```APIDOC ## GET /v1/lora/models ### Description Lists all LoRA models. ### Method GET ### Endpoint /v1/lora/models ### Response #### Success Response (200) - **lora_models** (array) - A list of LoRA models. #### Response Example ```json { "lora_models": [ { "id": "lora_abc123", "name": "my-lora-model" } ] } ``` ``` ```APIDOC ## GET /v1/lora/models/{lora_model_id} ### Description Retrieves a specific LoRA model by its ID. ### Method GET ### Endpoint /v1/lora/models/{lora_model_id} ### Parameters #### ``` -------------------------------- ### Reinforcement Fine-tuning Steps API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage individual steps within reinforcement fine-tuning processes. ```APIDOC ## Reinforcement Fine-tuning Steps API Endpoints ### Description This section covers the API endpoints for managing and executing individual steps within reinforcement fine-tuning. ### Endpoints - **POST /api-reference/create-reinforcement-fine-tuning-step** - **Description**: Creates a new step for reinforcement fine-tuning. - **GET /api-reference/list-reinforcement-fine-tuning-steps** - **Description**: Lists all reinforcement fine-tuning steps. - **GET /api-reference/get-reinforcement-fine-tuning-step** - **Description**: Retrieves details of a specific reinforcement fine-tuning step. - **DELETE /api-reference/delete-reinforcement-fine-tuning-step** - **Description**: Deletes a specified reinforcement fine-tuning step. - **POST /api-reference/resume-reinforcement-fine-tuning-step** - **Description**: Resumes a paused reinforcement fine-tuning step. - **POST /api-reference/execute-reinforcement-fine-tuning-step** - **Description**: Executes a reinforcement fine-tuning step. ``` -------------------------------- ### Audio API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Process audio data, including transcriptions and translations. ```APIDOC ## Audio API Endpoints ### Description This section covers the API endpoints for various audio processing tasks, such as real-time transcriptions, batch transcriptions, and translations. ### Endpoints - **POST /api-reference/audio-streaming-transcriptions** - **Description**: Performs streaming audio transcriptions. - **POST /api-reference/audio-transcriptions** - **Description**: Performs batch audio transcriptions. - **POST /api-reference/audio-translations** - **Description**: Translates audio content. ``` -------------------------------- ### Quota Management Commands Source: https://docs.fireworks.ai/tools-sdks/python-sdk Commands for retrieving and updating quota information. ```APIDOC ## firectl quota get ### Description Prints information about a quota. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl quota list ### Description Prints all quotas. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl quota update ### Description Updates a quota. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified ``` -------------------------------- ### Models API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage models, including creation, retrieval, updates, and deletion. ```APIDOC ## Models API Endpoints ### Description This section covers the API endpoints for managing machine learning models, including their lifecycle and associated endpoints. ### Endpoints - **POST /api-reference/create-model** - **Description**: Creates a new model. - **GET /api-reference/list-models** - **Description**: Lists all available models. - **GET /api-reference/get-model** - **Description**: Retrieves details of a specific model. - **GET /api-reference/get-model-upload-endpoint** - **Description**: Gets the endpoint for uploading model files. - **GET /api-reference/get-model-download-endpoint** - **Description**: Gets the endpoint for downloading model files. - **PUT /api-reference/update-model** - **Description**: Updates an existing model. - **DELETE /api-reference/delete-model** - **Description**: Deletes a specified model. - **POST /api-reference/prepare-model** - **Description**: Prepares a model for deployment or further processing. - **POST /api-reference/validate-model-upload** - **Description**: Validates a model upload. ``` -------------------------------- ### Image API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Generate and edit images using text prompts and context. ```APIDOC ## Image API Endpoints ### Description This section covers the API endpoints for image generation and editing, utilizing text prompts and contextual information. ### Endpoints - **POST /api-reference/generate-a-new-image-from-a-text-prompt** - **Description**: Generates a new image from a given text prompt. - **POST /api-reference/generate-or-edit-image-using-flux-kontext** - **Description**: Generates or edits an image using Flux context. - **GET /api-reference/get-generated-image-from-flux-kontex** - **Description**: Retrieves a generated image from Flux context. ``` -------------------------------- ### Batch API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage and interact with batch inference jobs for large language models. ```APIDOC ## Batch API Endpoints ### Description This section details the API endpoints for managing batch inference jobs, including creating, listing, retrieving, and deleting jobs. ### Endpoints - **POST /api-reference/create-batch-inference-job** - **Description**: Creates a new batch inference job. - **GET /api-reference/list-batch-inference-jobs** - **Description**: Lists all available batch inference jobs. - **GET /api-reference/get-batch-inference-job** - **Description**: Retrieves details of a specific batch inference job. - **DELETE /api-reference/delete-batch-inference-job** - **Description**: Deletes a specified batch inference job. ``` -------------------------------- ### Deployments API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage and control model deployments, including creation, updates, and scaling. ```APIDOC ## Deployments API Endpoints ### Description This section details the API endpoints for managing model deployments, including lifecycle management and scaling operations. ### Endpoints - **POST /api-reference/create-deployment** - **Description**: Creates a new model deployment. - **GET /api-reference/list-deployments** - **Description**: Lists all existing model deployments. - **GET /api-reference/get-deployment** - **Description**: Retrieves details of a specific model deployment. - **PUT /api-reference/update-deployment** - **Description**: Updates an existing model deployment. - **DELETE /api-reference/delete-deployment** - **Description**: Deletes a specified model deployment. - **POST /api-reference/undelete-deployment** - **Description**: Undeletes a previously deleted model deployment. - **POST /api-reference/scale-deployment** - **Description**: Scales a model deployment up or down. ``` -------------------------------- ### Model Management Commands Source: https://docs.fireworks.ai/tools-sdks/python-sdk Commands for loading, preparing, unloading, updating, and uploading models. ```APIDOC ## firectl model load-lora ### Description Loads a LoRA model. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl model prepare ### Description Prepare models for different precisions. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl model unload-lora ### Description Unloads a LoRA model. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl model update ### Description Updates a model. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl model upload ### Description Resumes or completes a model upload. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified ``` -------------------------------- ### Reinforcement Fine-tuning Jobs API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage reinforcement fine-tuning jobs, including creation, cancellation, and resumption. ```APIDOC ## Reinforcement Fine-tuning Jobs API Endpoints ### Description This section details the API endpoints for managing reinforcement fine-tuning jobs, including their lifecycle and control operations. ### Endpoints - **POST /api-reference/create-reinforcement-fine-tuning-job** - **Description**: Creates a new reinforcement fine-tuning job. - **GET /api-reference/list-reinforcement-fine-tuning-jobs** - **Description**: Lists all reinforcement fine-tuning jobs. - **GET /api-reference/get-reinforcement-fine-tuning-job** - **Description**: Retrieves details of a specific reinforcement fine-tuning job. - **DELETE /api-reference/delete-reinforcement-fine-tuning-job** - **Description**: Deletes a specified reinforcement fine-tuning job. - **POST /api-reference/cancel-reinforcement-fine-tuning-job** - **Description**: Cancels a running reinforcement fine-tuning job. - **POST /api-reference/resume-reinforcement-fine-tuning-job** - **Description**: Resumes a paused reinforcement fine-tuning job. ``` -------------------------------- ### POST /v1/chat/completions Source: https://docs.fireworks.ai/tools-sdks/python-sdk Creates a model response for the given chat conversation using an OpenAI-compatible interface. ```APIDOC ## POST /v1/chat/completions ### Description Generates a chat completion using the specified model. ### Method POST ### Endpoint /v1/chat/completions ### Request Body - **model** (string) - Required - The ID of the model to use. - **messages** (array) - Required - A list of messages comprising the conversation. ### Request Example { "model": "accounts/fireworks/models/llama-v3-70b-instruct", "messages": [{"role": "user", "content": "Hello!"}] } ### Response #### Success Response (200) - **id** (string) - Unique identifier for the completion. - **choices** (array) - List of generated completions. #### Response Example { "id": "chatcmpl-123", "choices": [{"message": {"role": "assistant", "content": "Hello! How can I help you?"}}] } ``` -------------------------------- ### POST /v1/messages Source: https://docs.fireworks.ai/tools-sdks/python-sdk Creates a message response using the Anthropic-compatible API format. ```APIDOC ## POST /v1/messages ### Description Sends a message to the model using the Anthropic-compatible API structure. ### Method POST ### Endpoint /v1/messages ### Request Body - **model** (string) - Required - The model to use. - **messages** (array) - Required - Input messages. ### Request Example { "model": "claude-3-opus", "messages": [{"role": "user", "content": "Explain quantum computing."}] } ### Response #### Success Response (200) - **content** (array) - The generated response content. #### Response Example { "content": [{"type": "text", "text": "Quantum computing is..."}] } ``` -------------------------------- ### Bootstrap Training Environment Source: https://docs.fireworks.ai/fine-tuning/training-sdk/training-and-sampling This snippet demonstrates the initial setup phase for a training job, involving the initialization of the DeploymentManager and TrainerJobManager to prepare the environment for iterative updates. ```python from fireworks.training import DeploymentManager, TrainerJobManager # Initialize managers for the training lifecycle deployment = DeploymentManager(shape_id="model-shape-v1") trainer = TrainerJobManager(shape_id="model-shape-v1") # Bootstrap resources deployment.create() trainer.create() ``` -------------------------------- ### Set API Key Command Source: https://docs.fireworks.ai/tools-sdks/python-sdk Sets the default API key in the configuration file. ```APIDOC ## firectl set-api-key ### Description Sets the default API key in ~/.fireworks/auth.ini. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified ``` -------------------------------- ### Example Dockerfile for Fireworks AI Source: https://docs.fireworks.ai/fine-tuning/quickstart-svg-agent A sample Dockerfile demonstrating the setup of a Python 3.11-slim environment. It includes instructions for installing system dependencies like Chromium and managing Python packages via requirements.txt. ```docker FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ chromium \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt ``` -------------------------------- ### Create a Datum from tokens and weights Source: https://docs.fireworks.ai/fine-tuning/training-sdk/introduction Demonstrates how to import the datum utility and prepare training data by tokenizing a prompt and response string. This snippet shows the initial setup required to create a Datum object for remote GPU training. ```python import torch from tinker_cookbook.supervised.common import datum_from_tokens_weights tokens = tokenizer.encode("What is 2+2? The answer is 4.") prompt_len = len(tokenizer.encode("What is 2+2?")) ``` -------------------------------- ### Supervised Fine-tuning Jobs API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Manage supervised fine-tuning jobs, including creation, listing, and status updates. ```APIDOC ## Supervised Fine-tuning Jobs API Endpoints ### Description This section covers the API endpoints for managing supervised fine-tuning jobs, from creation to deletion and resumption. ### Endpoints - **POST /api-reference/create-supervised-fine-tuning-job** - **Description**: Creates a new supervised fine-tuning job. - **GET /api-reference/list-supervised-fine-tuning-jobs** - **Description**: Lists all supervised fine-tuning jobs. - **GET /api-reference/get-supervised-fine-tuning-job** - **Description**: Retrieves details of a specific supervised fine-tuning job. - **DELETE /api-reference/delete-supervised-fine-tuning-job** - **Description**: Deletes a specified supervised fine-tuning job. - **POST /api-reference/resume-supervised-fine-tuning-job** - **Description**: Resumes a paused supervised fine-tuning job. ``` -------------------------------- ### OpenAI-compatible API Source: https://docs.fireworks.ai/tools-sdks/python-sdk Interact with models using an OpenAI-compatible API for chat completions and text generation. ```APIDOC ## POST /v1/chat/completions ### Description Creates a chat completion choice for the provided prompt and parameters. ### Method POST ### Endpoint /v1/chat/completions ### Parameters #### Request Body - **model** (string) - Required - The model to use for completion. - **messages** (array) - Required - A list of messages comprising the conversation so far. - **temperature** (number) - Optional - Controls randomness. Lower values make the output more deterministic. - **max_tokens** (integer) - Optional - The maximum number of tokens to generate. ### Request Example ```json { "model": "accounts/fireworks/models/llama-v2-7b-chat", "messages": [ {"role": "user", "content": "What is the capital of France?"} ], "max_tokens": 100, "temperature": 0.7 } ``` ### Response #### Success Response (200) - **choices** (array) - A list of chat completion choices. - **message** (object) - The message content. - **role** (string) - The role of the author. - **content** (string) - The content of the message. #### Response Example ```json { "choices": [ { "message": { "role": "assistant", "content": "The capital of France is Paris." } } ] } ``` ``` ```APIDOC ## POST /v1/completions ### Description Creates a completion choice for the provided prompt and parameters. ### Method POST ### Endpoint /v1/completions ### Parameters #### Request Body - **model** (string) - Required - The model to use for completion. - **prompt** (string) - Required - The prompt(s) to generate completions for. - **temperature** (number) - Optional - Controls randomness. Lower values make the output more deterministic. - **max_tokens** (integer) - Optional - The maximum number of tokens to generate. ### Request Example ```json { "model": "accounts/fireworks/models/llama-v2-7b", "prompt": "Once upon a time", "max_tokens": 50, "temperature": 0.8 } ``` ### Response #### Success Response (200) - **choices** (array) - A list of completion choices. - **text** (string) - The generated completion. #### Response Example ```json { "choices": [ { "text": " there was a brave knight who lived in a faraway kingdom." } ] } ``` ``` -------------------------------- ### Secret Management Commands Source: https://docs.fireworks.ai/tools-sdks/python-sdk Commands for creating, deleting, retrieving, listing, and updating secrets. ```APIDOC ## firectl secret create ### Description Creates a secret for the signed in user. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl secret delete ### Description Deletes a secret. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl secret get ### Description Retrieves a secret by name. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl secret list ### Description Lists all secrets for the signed in user. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified --- ## firectl secret update ### Description Updates an existing secret. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified ### Request Example Not applicable ### Response Not specified ``` -------------------------------- ### Configure Model Deployment and Training Source: https://docs.fireworks.ai/fine-tuning/training-sdk/training-and-sampling This snippet illustrates setting up model deployment configurations, including replica counts, waiting for service readiness, and initializing a training job with a specific base model. ```python base_model = "accounts/fireworks/models/qwen3-8b", min_replica_count = 0, max_replica_count = 1 deploy_mgr.wait_for_ready("research-serving") # This is the only shape-specific value you choose profile = rlor_mgr.resolve_training_profile(shape_id) # Create trainer (polls until healthy) endpoint = rlor_mgr.create_and_wait(TrainerJobConfig( base_model = "accounts/fireworks/models/qwen3-8b" ```