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
def embed(text: str, model: Optional[str]) -> List[float]Parameters
ParamField
strText 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
agent = EmbeddingAgent()
embedding = agent.embed("Hello world")
print(f"Dimension: {len(embedding)}")Uses
embedding
Source
View on GitHubpraisonaiagents/agent/embedding_agent.py at line 184