4Z API

text embedding

Endpoint: POST https://4zapi.com/v1beta/models/gemini-embedding-001:embedContent

https://ai.google.dev/gemini-api/docs/embeddings?hl=zh-cn#rest_3 Official documentation

Parameters

  • Content-Type (header, string): Request body content type, usually application/json

Request body (application/json)

  • content (object, required): The content to embed.
  • output_dimensionality (integer): Optional dimensionality reduction of the output embedding.
  • taskType (string): Optional task type that the embedding will be used for.

Request example

{
  "content": {
    "parts": [
      {
        "text": "What is the meaning of life?"
      }
    ]
  },
  "output_dimensionality": 768,
  "taskType": "SEMANTIC_SIMILARITY"
}