Member Junction
    Preparing search index...

    Fireworks.ai implementation of the BaseLLM class Fireworks.ai provides an OpenAI-compatible API, so we use the OpenAI SDK with a custom baseURL

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _additionalSettings: Record<string, any>

    Protected property to store additional provider-specific settings

    thinkingStreamState: ThinkingStreamState

    State tracking for streaming thinking extraction Providers should initialize this if they support thinking models

    Accessors

    • get AdditionalSettings(): Record<string, any>

      Get the current additional settings

      Returns Record<string, any>

    • get apiKey(): string

      Only sub-classes can access the API key

      Returns string

    • get SupportsPrefill(): boolean

      Whether this LLM provider supports assistant prefill (pre-seeding the start of the model's response). Providers that support prefill should override this to return true. This is used as a code-level default when database metadata (AIModelType/AIModel/AIModelVendor.SupportsPrefill) is null. Database values of true/false override this getter.

      Returns boolean

    Methods

    • Process a chat completion request. If streaming is enabled and supported, this will route to the streaming implementation.

      Parameters

      Returns Promise<ChatResult>

    • Process multiple chat completion requests in parallel. This is useful for:

      • Generating multiple variations with different parameters (temperature, etc.)
      • Getting multiple responses to compare or select from
      • Improving reliability by sending the same request multiple times

      Parameters

      Returns Promise<ChatResult[]>

      Promise resolving to an array of ChatResults in the same order as the input params

    • Clear all additional settings This is useful for resetting the state of the provider or when switching between different configurations.

      Returns void

    • Utility method to map a MemberJunction role to OpenAI role

      Parameters

      • role: string

      Returns "system" | "user" | "assistant"

    • Extract thinking content from non-streaming content This method handles case-insensitive extraction of thinking blocks

      Parameters

      • content: string

      Returns { content: string; thinking?: string }

    • Create the final response from streaming results for Fireworks.ai

      Parameters

      • accumulatedContent: string
      • lastChunk: ChatCompletionChunk
      • usage: { completionTokens: number; promptTokens: number; totalTokens: number }

      Returns ChatResult

    • Returns the native file input capabilities of this LLM driver, or null if the driver does not support file attachments. Subclasses that accept files (PDFs, images, etc.) should override this method.

      Returns FileCapabilities

    • Get the thinking tag format for this provider Providers can override this to customize the thinking tag format

      Returns { close: string; open: string }

    • Template method for handling streaming chat completion This implements the common pattern across providers while delegating provider-specific logic to abstract methods.

      Parameters

      Returns Promise<ChatResult>

    • Initialize thinking stream state for streaming extraction

      Returns void

    • Process streaming chunk with thinking extraction This method handles case-insensitive extraction across chunk boundaries

      Parameters

      • rawContent: string

      Returns string

    • Process a streaming chunk from Fireworks.ai

      Parameters

      • chunk: ChatCompletionChunk

      Returns {
          content: string;
          finishReason?: string;
          usage?: {
              completionTokens: number;
              promptTokens: number;
              totalTokens: number;
          };
      }

    • Reset thinking stream state

      Returns void

    • Set additional provider-specific settings Subclasses should override this method to validate required settings

      Parameters

      • settings: Record<string, any>

        Provider-specific settings

      Returns void

    • Check if the provider supports thinking models Providers should override this to return true if they support thinking extraction

      Returns boolean