embed • AI Agent SDK

embed: Generate embedding for a single text.

embed

Method

</div>

This is a method of the EmbeddingAgent class in the embedding_agent module.

Generate embedding for a single text.

Signature

python
def embed(text: str, model: Optional[str]) -> List[float]

Parameters

ParamField str

Text to embed

ParamField Optional[str]

Override model for this call **kwargs: Additional provider-specific parameters

Returns

ResponseField List[float]

List of floats representing the embedding vector

Usage

python
agent = EmbeddingAgent()
    embedding = agent.embed("Hello world")
    print(f"Dimension: {len(embedding)}")

Uses

  • embedding

Source

View on GitHub

praisonaiagents/agent/embedding_agent.py at line 184