v1

latestOpenAPI 3.0.2Apache-2.02026-07-142963051.0 MB
AI

Extract metadata (freeform)

Sends an AI request to supported Large Language Models (LLMs) and extracts metadata in form of key-value pairs. In this request, both the prompt and the output can be freeform. Metadata template setup before sending the request is not required.

post/ai/extract

Request body

promptstring required

The prompt provided to a Large Language Model (LLM) in the request. The prompt can be up to 10000 characters long and it can be an XML or a JSON schema.

Example request

{
  "prompt": "\\\"fields\\\":[{\\\"type\\\":\\\"string\\\",\\\"key\\\":\\\"name\\\",\\\"displayName\\\":\\\"Name\\\",\\\"description\\\":\\\"The customer name\\\",\\\"prompt\\\":\\\"Name is always the first word in the document\\\"},{\\\"type\\\":\\\"date\\\",\\\"key\\\":\\\"last_contacted_at\\\",\\\"displayName\\\":\\\"Last Contacted At\\\",\\\"description\\\":\\\"When this customer was last contacted at\\\"}]",
  "items": [
    {
      "id": "123",
      "type": "file",
      "content": "This is file content."
    }
  ],
  "ai_agent": {
    "type": "ai_agent_id",
    "id": "14031"
  }
}

Response

A response including the answer from the LLM.

answerstring required

The answer provided by the LLM.

created_atstring date-time required

The ISO date formatted timestamp of when the answer to the prompt was created.

completion_reasonstring

The reason the response finishes.

Example response

{
  "answer": "Public APIs are important because of key and important reasons.",
  "created_at": "2012-12-12T10:53:43-08:00",
  "completion_reason": "done",
  "ai_agent_info": {
    "models": [
      {
        "name": "azure__openai__text_embedding_ada_002",
        "provider": "azure",
        "supported_purpose": "embedding"
      }
    ],
    "processor": "basic_text"
  }
}