from mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.embeddings.embed(input="The quick brown fox jumps over the lazy dog.", model="auto", encoding_format="float")
# Handle response
print(res){
"data": [
{
"object": "embedding",
"embedding": [
0.0023,
-0.0091,
0.0156,
-0.0042,
0.0089
],
"index": 0
}
],
"model": "auto",
"object": "list",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}Generates vector embeddings for single or multiple text inputs. Returns floating-point vectors along with token usage statistics.
from mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.embeddings.embed(input="The quick brown fox jumps over the lazy dog.", model="auto", encoding_format="float")
# Handle response
print(res){
"data": [
{
"object": "embedding",
"embedding": [
0.0023,
-0.0091,
0.0156,
-0.0042,
0.0089
],
"index": 0
}
],
"model": "auto",
"object": "list",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.
Request parameters for creating embeddings. Generates vector representations of the input text(s).
The input text or array of texts to generate embeddings for. Can be a single string or an array of strings. Note: batch size and input length limits vary by model. See GET /embeddings/models for model-specific limits.
1 - 100000ID of the model to use for generating embeddings. Use provider:model format. See GET /embeddings/models for available models and their limits.
1The number of dimensions the resulting output embeddings should have. Only supported in certain models.
1 <= x <= 9007199254740991The format to return the embeddings in. Can be either 'float' (array of numbers) or 'base64' (base64-encoded binary).
float, base64 A unique identifier representing your end-user.
OK
Response from the embeddings endpoint containing the generated embeddings and usage information.
A list of embedding objects. Each object contains the embedding vector as an array of floating point numbers or base64-encoded string representing the semantic meaning of the input text.
Show child attributes
The model used for generating the embeddings
Usage statistics for the embeddings request
Show child attributes
Was this page helpful?