The FireworksEmbedder can be used to embed text data into vectors using the Fireworks API. Fireworks uses the OpenAI API specification, so the FireworksEmbedder class is similar to the OpenAIEmbedder class, incorporating adjustments to ensure compatibility with the Fireworks platform. Get your key from here.

Usage

from phi.agent import Agent, AgentKnowledge
from phi.vectordb.pgvector import PgVector
from phi.embedder.fireworks import FireworksEmbedder

# Create knowledge base
knowledge_base=AgentKnowledge(
    vector_db=PgVector(
        db_url=db_url,
        table_name=embeddings_table,
        embedder=FireworksEmbedder(api_key=***),
    ),
    # 2 references are added to the prompt
    num_documents=2,
),

# Add information to the knowledge base
knowledge_base.load_text("The sky is blue")

# Add the knowledge base to the Agent
agent = Agent(knowledge_base=knowledge_base)

Params

ParameterTypeDefaultDescription
modelstr"nomic-ai/nomic-embed-text-v1.5"The name of the model used for generating embeddings.
dimensionsint768The dimensionality of the embeddings generated by the model.
api_keystr-The API key used for authenticating requests.
base_urlstr"https://api.fireworks.ai/inference/v1"The base URL for the API endpoint.