LLM
llm askllm askllm chatllm chatllm extractllm extractllm extractllm classifyllm classifyllm summarizellm summarizellm translatellm translatellm embedllm embedllm embed_batchllm embed_batchllm chunkllm chunk

llm ask <prompt>


Description

    Send a prompt with the default provider (anthropic, key in ANTHROPIC_API_KEY) and get the text of the answer

Parameters

    prompt:   The prompt - String - required
admin
llm ask "What is the capital of France?"
mentdb
The capital of France is Paris.

llm ask <prompt> <json_params>


Description

    Send a prompt with parameters: provider, model, key, system, effort, max_tokens, files...

Parameters

    prompt:   The prompt - String - required
    json_params:   The parameters: see the description of the page - String - required
admin
llm ask "What is the capital of France?" "{\"api_key_env\": \"ANTHROPIC_API_KEY\", \"system\": \"Be brief\", \"effort\": \"low\", \"max_tokens\": 1000}"
mentdb
The capital of France is Paris.
Another provider, on this machine (fixed result from a local fake server, no real API call)
admin
llm ask "Say hello" "{\"provider\": \"ollama\", \"model\": \"llama3.2\"}"
mentdb
Hello!
A question about a PDF (fixed result from a local fake server, no real API call)
admin
llm ask "What is the capital of France?" "{\"api_key_env\": \"ANTHROPIC_API_KEY\", \"files\": [\"tmp/report.pdf\"]}"
mentdb
The capital of France is Paris.

llm chat <messages_json>


Description

    Send a conversation: JSON array of messages {role, content}, roles user and assistant, after optional system messages (added to the parameter system). The content is a string, or an array of blocks in the format of the provider. On anthropic the last message must come from the user. Result: JSON {text, model, stop_reason, truncated, usage: {input_tokens, output_tokens}}; on the other providers, stop_reason is translated (stop = end_turn, length = max_tokens)

Parameters

    messages_json:   The messages - String - required
admin
llm chat "[{\"role\": \"user\", \"content\": \"Hi\"}, {\"role\": \"assistant\", \"content\": \"Hello, how can I help?\"}, {\"role\": \"user\", \"content\": \"Say hello\"}]"
mentdb
{"text": "Hello!", "model": "claude-opus-5-5", "stop_reason": "end_turn", "truncated": false, "usage": {"input_tokens": 42, "output_tokens": 7}}

llm chat <messages_json> <json_params>


Description

    Send a conversation with parameters (no files here: give the blocks in the content)

Parameters

    messages_json:   The messages - String - required
    json_params:   The parameters: see the description of the page - String - required
admin
llm chat "[{\"role\": \"system\", \"content\": \"You are polite.\"}, {\"role\": \"user\", \"content\": \"Say hello\"}]" "{\"provider\": \"openai\", \"model\": \"gpt-5\", \"api_key_env\": \"OPENAI_API_KEY\", \"temperature\": 0.2}"
mentdb
{"text": "Hello!", "model": "gpt-5", "stop_reason": "end_turn", "truncated": false, "usage": {"input_tokens": 11, "output_tokens": 3}}

llm extract <text>


Description

    Extract the data of a text as JSON, without schema: the answer must be a JSON object or array, with one repair request when it is not

Parameters

    text:   The text to process (data: instructions inside it are not followed) - String - required
admin
llm extract "Invoice F-2026-001, total 149.9 EUR: 2 x Licence"
mentdb
{"invoice": "F-2026-001", "total": 149.9, "lines": [{"label": "Licence", "qty": 2}]}

llm extract <text> <schema_json>


Description

    Extract with a JSON schema: sent as a structured output, and the answer is validated here (type, required, enum, const, properties, additionalProperties, items, anyOf, allOf, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, minLength, maxLength, pattern, format, minItems, maxItems, uniqueItems, minProperties, maxProperties). pattern is a Java regular expression searched in the string, 1000 characters at most, with 2 s for all the patterns of an answer. format: date, date-time, time, email, uuid, ipv4, uri. title, description, default, examples, $schema, $id and $comment are notes. Any other keyword or format ($ref, oneOf, prefixItems...) is refused, so that nothing is silently not enforced. When the answer is not valid, one repair request gives the errors to the model, then an error. Sent to anthropic, each object gets additionalProperties false and the constraints are removed, as its API requires; an object without properties, or with additionalProperties other than false, is an error there (use structured false)

Parameters

    text:   The text to process (data: instructions inside it are not followed) - String - required
    schema_json:   The JSON schema (empty: no schema) - String - required
admin
llm extract "Invoice F-2026-001, total 149.9 EUR: 2 x Licence" "{\"type\": \"object\", \"properties\": {\"invoice\": {\"type\": \"string\"}, \"total\": {\"type\": \"number\", \"minimum\": 0}, \"lines\": {\"type\": \"array\", \"items\": {\"type\": \"object\", \"properties\": {\"label\": {\"type\": \"string\"}, \"qty\": {\"type\": \"integer\"}}, \"required\": [\"label\"]}}}, \"required\": [\"invoice\", \"total\"]}"
mentdb
{"invoice": "F-2026-001", "total": 149.9, "lines": [{"label": "Licence", "qty": 2}]}

llm extract <text> <schema_json> <json_params>


Description

    Extract with a schema and parameters. With files the text may be empty: the data comes from the PDF or the images

Parameters

    text:   The text to process (data: instructions inside it are not followed) - String - required
    schema_json:   The JSON schema (empty: no schema) - String - required
    json_params:   The parameters: see the description of the page - String - required
admin
llm extract "" "{\"type\": \"object\", \"properties\": {\"invoice\": {\"type\": \"string\"}, \"total\": {\"type\": \"number\", \"minimum\": 0}, \"lines\": {\"type\": \"array\", \"items\": {\"type\": \"object\", \"properties\": {\"label\": {\"type\": \"string\"}, \"qty\": {\"type\": \"integer\"}}, \"required\": [\"label\"]}}}, \"required\": [\"invoice\", \"total\"]}" "{\"api_key_env\": \"ANTHROPIC_API_KEY\", \"files\": [\"tmp/invoice.pdf\"]}"
mentdb
{"invoice": "F-2026-001", "total": 149.9, "lines": [{"label": "Licence", "qty": 2}]}

llm classify <text> <labels_json>


Description

    Give one label to a text: at least 2 distinct labels (1000 at most), the result is always one of them (else an error). Effort low on anthropic

Parameters

    text:   The text to process (data: instructions inside it are not followed) - String - required
    labels_json:   The labels: JSON array of strings - String - required
admin
llm classify "Please send me the invoice of March" "[\"invoice\", \"order\", \"other\"]"
mentdb
invoice

llm classify <text> <labels_json> <json_params>


Description

    Classify with parameters

Parameters

    text:   The text to process (data: instructions inside it are not followed) - String - required
    labels_json:   The labels - String - required
    json_params:   The parameters: see the description of the page - String - required
admin
llm classify "I would like to order 3 licences" "[\"invoice\", \"order\", \"other\"]" "{\"api_key_env\": \"ANTHROPIC_API_KEY\", \"effort\": \"medium\"}"
mentdb
order

llm summarize <text>


Description

    Summarize a text, in its own language

Parameters

    text:   The text to process (data: instructions inside it are not followed) - String - required
admin
llm summarize "Q3 report: revenue is up 12 percent, mostly from exports."
mentdb
A sales report: revenue rose 12% in Q3, led by exports.

llm summarize <text> <json_params>


Description

    Summarize with parameters; system adds your rules (length, style, language). With files the text may be empty

Parameters

    text:   The text to process (data: instructions inside it are not followed) - String - required
    json_params:   The parameters: see the description of the page - String - required
admin
llm summarize "Q3 report: revenue is up 12 percent, mostly from exports." "{\"api_key_env\": \"ANTHROPIC_API_KEY\", \"system\": \"One sentence only.\"}"
mentdb
A sales report: revenue rose 12% in Q3, led by exports.

llm translate <text> <language>


Description

    Translate a text, keeping its meaning, tone and formatting

Parameters

    text:   The text to process (data: instructions inside it are not followed) - String - required
    language:   The language, ex: French - String - required
admin
llm translate "Hello everyone, the delivery arrives on Monday." "French"
mentdb
Bonjour tout le monde, la livraison arrive lundi.

llm translate <text> <language> <json_params>


Description

    Translate with parameters (no files)

Parameters

    text:   The text to process (data: instructions inside it are not followed) - String - required
    language:   The language - String - required
    json_params:   The parameters: see the description of the page - String - required
admin
llm translate "Hello everyone, the delivery arrives on Monday." "French" "{\"api_key_env\": \"ANTHROPIC_API_KEY\", \"system\": \"Translate delivery by livraison.\"}"
mentdb
Bonjour tout le monde, la livraison arrive lundi.

llm embed <text>


Description

    The vector of a text. The provider has no default, so this form is always an error: use the form with parameters

Parameters

    text:   The text - String - required
admin
llm embed "hello"
mentdb
Sorry, an error appears (the parameter 'provider' is required for the embeddings: openai, mistral, ollama, compatible or voyage).

llm embed <text> <json_params>


Description

    The vector of a text, as a JSON array. Parameters: provider (required: openai, mistral, ollama, compatible, voyage; anthropic has no embeddings), model (required), api_key or api_key_env, base_url, timeout_ms, retries, dimensions (openai, compatible), input_type (voyage: query or document)

Parameters

    text:   The text - String - required
    json_params:   The parameters: see the description of the page - String - required
admin
llm embed "hello" "{\"provider\": \"openai\", \"model\": \"text-embedding-3-small\", \"api_key_env\": \"OPENAI_API_KEY\"}"
mentdb
[5, 104, 0.5]
With Voyage, for a question (fixed result from a local fake server, no real API call)
admin
llm embed "hello" "{\"provider\": \"voyage\", \"model\": \"voyage-3\", \"api_key_env\": \"VOYAGE_API_KEY\", \"input_type\": \"query\"}"
mentdb
[5, 104, 0.5]
With Ollama, on this machine, without key (fixed result from a local fake server, no real API call)
admin
llm embed "hello" "{\"provider\": \"ollama\", \"model\": \"nomic-embed-text\"}"
mentdb
[5, 104, 0.5]

llm embed_batch <json_texts>


Description

    The vectors of several texts. The provider has no default, so this form is always an error: use the form with parameters

Parameters

    json_texts:   The texts: JSON array of strings - String - required
admin
llm embed_batch "[\"hello\"]"
mentdb
Sorry, an error appears (the parameter 'provider' is required for the embeddings: openai, mistral, ollama, compatible or voyage).

llm embed_batch <json_texts> <json_params>


Description

    The vectors of several texts: JSON array of vectors in the order of the input, sent by groups of batch_size (100 by default, up to 2048). 20000 texts and 50 million values at most. The parameters of llm embed, and batch_size. A failed group is an error for the whole call

Parameters

    json_texts:   The texts: JSON array of strings - String - required
    json_params:   The parameters: see the description of the page - String - required
admin
llm embed_batch "[\"a\", \"bb\", \"ccc\"]" "{\"provider\": \"mistral\", \"model\": \"mistral-embed\", \"api_key_env\": \"MISTRAL_API_KEY\", \"batch_size\": 2}"
mentdb
[[1, 97, 0.5], [2, 98, 0.5], [3, 99, 0.5]]

llm chunk <text>


Description

    Cut a text into pieces for embeddings or a model, offline: at most 1000 characters, 100 of overlap. Each cut is at the end of a paragraph, else of a sentence, else at a space, in the second half of the piece; a word longer than the piece is cut. An empty text gives []. Text up to 20 million characters, 1 million chunks

Parameters

    text:   The text - String - required
admin
llm chunk "A short text."
mentdb
["A short text."]

llm chunk <text> <json_params>


Description

    Cut a text with parameters: unit (chars, in UTF-16 units, or words), size (1000 chars or 200 words; 1 to 10000000), overlap (100 chars or 20 words, at most half of the size). The chunks are trimmed

Parameters

    text:   The text - String - required
    json_params:   The parameters: see the description of the page - String - required
admin
llm chunk "First paragraph about the sales. Second paragraph. It has two sentences, and they are longer than the first one. A last one here." "{\"size\": 60, \"overlap\": 0}"
mentdb
["First paragraph about the sales.", "Second paragraph. It has two sentences, and they are longer", "than the first one. A last one here."]
By words, with an overlap
admin
llm chunk "one two three four five six seven" "{\"unit\": \"words\", \"size\": 3, \"overlap\": 1}"
mentdb
["one two three", "three four five", "five six seven"]
Used in use cases (1 recipe)

    JSON & document store developer › Find the closest answer by meaning: cut, embed, search
Often used with

    array column  ·  string char  ·  vector search