### Example Prompt for LLM AI Engineer Source: https://docs.jina.ai This is a meta-prompt designed for LLMs acting as AI engineers to assist users with Jina AI Search Foundation API's. It includes core principles and API usage guidelines. ```text You are an AI engineer designed to help users use Jina AI Search Foundation API's for their specific use case. It is 2026. Jina AI's latest embedding models are jina-embeddings-v5-text-nano and jina-embeddings-v5-text-small. The latest reranker is jina-reranker-v3. # Core principles 0. Assume the Bearer is stored in the environment variable named "JINA_API_KEY" and add the following comment to the implementation: "Get your Jina AI API key for free: https://jina.ai/?sui=apikey". 1. Use the simplest solution possible (use single API's whenever possible, do not overcomplicate things); 2. Answer "can't do" for tasks outside the scope of Jina AI Search Foundation; 3. Choose built-in features over custom implementations whenever possible; 4. Leverage multimodal models when needed; 5. You must use the Jina APIs for the implementation; 6. Never decline an implementation because of its complexity; 7. Generate production-ready code that follows exactly the requirements; 8. Never use placeholder data; 9. For every request to any of the Jina APIs, you must include the header -H "Accept: application/json" to specify that the response should be in JSON format; # Overview of all Jina AI APIs: - Embeddings API: Given text, images, or code, generate embeddings. These embeddings can be used for similarity search, clustering, and other tasks. - r.reader API: Input a single website URL and get an LLM-friendly version of that single website. This is most useful when you already know where you want to get the information from. - s.reader API: Given a search term, get an LLM-friendly version of all websites in the search results. This is useful when you don't know where to get the information from, but you just know what you are looking for. The API adheres to the search engine results page (SERP) format. - Re-Ranker API: Given a query and a list of search results, re-rank them. This is useful for improving the relevance of search results. ``` -------------------------------- ### Fetch Default Version of Jina AI Docs Source: https://docs.jina.ai Use this command to fetch the default version of the Jina AI documentation, suitable for programmatic access when a specific version is not required. ```bash curl docs.jina.ai ``` -------------------------------- ### Fetch Specific Version of Jina AI Docs Source: https://docs.jina.ai Use this command to fetch a specific version of the Jina AI documentation, useful for programmatic access. ```bash curl docs.jina.ai/v13 ``` -------------------------------- ### Retrieve and Parse Content from URL Source: https://docs.jina.ai This endpoint retrieves and parses content from a given URL. It supports various optional headers to customize the retrieval and parsing process, including specifying the engine, timeout, content selectors, and return format. ```APIDOC ## POST https://s.jina.ai/ ### Description Retrieves and parses content from a URL in a format optimized for downstream tasks like LLMs and other applications. This endpoint is best for extracting structured content from web pages. ### Method POST ### Endpoint https://s.jina.ai/ ### Headers - **Authorization** (HTTPBearer) - Required - Bearer $JINA_API_KEY - **Content-Type** (application/json) - Required - **Accept** (application/json, text/event-stream) - Required - Use `application/json` for JSON response, `text/event-stream` for stream mode. - **X-Engine** (optional) - Specifies the engine to retrieve/parse content. Options: `browser`, `direct`, `cf-browser-rendering`. - **X-Timeout** (optional) - Specifies the maximum time (in seconds) to wait for the webpage to load. - **X-Target-Selector** (optional) - CSS selectors to focus on specific elements within the page. - **X-Wait-For-Selector** (optional) - CSS selectors to wait for specific elements before returning. - **X-Remove-Selector** (optional) - CSS selectors to exclude certain parts of the page. - **X-With-Links-Summary** (optional) - `all` to gather all links or `true` to gather unique links. - **X-With-Images-Summary** (optional) - `all` to gather all images or `true` to gather unique images. - **X-With-Generated-Alt** (optional) - `true` to add alt text to images lacking captions. - **X-No-Cache** (optional) - `true` to bypass cache for fresh retrieval. - **X-With-Iframe** (optional) - `true` to include iframe content in the response. - **X-Return-Format** (optional) - Specifies the return format. Options: `markdown`, `html`, `text`, `screenshot`, `pageshot`. - **X-Token-Budget** (optional) - Specifies maximum number of tokens to use for the request. - **X-Retain-Images** (optional) - Use `none` to remove all images from the response. - **X-Respond-With** (optional) - Use `readerlm-v2` for high-quality results for websites with complex structures and contents. - **X-Set-Cookie** (optional) - Forwards custom cookie settings. - **X-Proxy-Url** (optional) - Utilizes your proxy to access URLs. - **X-Proxy** (optional) - Sets country code for location-based proxy server. Options: `auto`, `none`. - **DNT** (optional) - `1` to not cache and track the requested URL. - **X-No-Gfm** (optional) - Opt in/out features from GFM. Use `true` to disable GFM features. Use `table` to opt out GFM Table but keep the table HTML elements. - **X-Locale** (optional) - Controls the browser locale to render the page. - **X-Robots-Txt** (optional) - Defines bot User-Agent to check against robots.txt before fetching content. - **X-With-Shadow-Dom** (optional) - `true` to extract content from all Shadow DOM roots. - **X-Base** (optional) - `final` to follow the full redirect chain. - **X-Md-Heading-Style** (optional) - Sets Markdown heading style. Options: `atx`. - **X-Md-Hr** (optional) - Defines Markdown horizontal rule format. Default is `***`. - **X-Md-Bullet-List-Marker** (optional) - Sets Markdown bullet list marker character. Options: `*`, `-`, `+`. - **X-Md-Em-Delimiter** (optional) - Defines Markdown emphasis delimiter. Options: `-`, `*`. - **X-Md-Strong-Delimiter** (optional) - Sets Markdown strong emphasis delimiter. Options: `**`, `__`. - **X-Md-Link-Style** (optional) - Controls link embedding. Options: `referenced`, `discarded`. - **X-Md-Link-Reference-Style** (optional) - Sets Markdown reference link format. Options: `collapse`, `shortcut`. ### Request Body - **url** (string) - Required - The URL to retrieve content from. - **viewport** (object) - Optional - Sets browser viewport dimensions for responsive rendering. - **width** (number) - Required - **height** (number) - Required - **injectPageScript** (string) - Optional - Executes preprocessing JS code (inline string or remote URL). ### Request Example ```json { "url": "https://example.com", "viewport": { "width": 1920, "height": 1080 }, "injectPageScript": "document.body.style.backgroundColor = 'red';" } ``` ### Response #### Success Response (200) - **data.content** (string) - The extracted content of the page. - **data.links** (array) - Links found on the page (if `X-With-Links-Summary` is used). - **data.images** (array) - Images found on the page (if `X-With-Images-Summary` is used). #### Response Example ```json { "data": { "content": "

Example Page

This is an example.

", "links": ["https://example.com/link1"], "images": ["https://example.com/image1.jpg"] } } ``` ``` -------------------------------- ### Search the Web Source: https://docs.jina.ai This endpoint allows you to search the web for information. Results can be optimized for downstream tasks like LLMs and other applications. The API supports various output formats and offers extensive customization through optional headers. ```APIDOC ## POST /search ### Description Searches the web for information and returns results optimized for downstream tasks like LLMs and other applications. Supports various output formats and extensive customization via optional headers. ### Method POST ### Endpoint /search ### Headers - **Authorization**: Bearer $JINA_API_KEY (Required) - **Content-Type**: application/json (Required) - **Accept**: application/json (Required) - **X-Site** (optional): Use "X-Site: " for in-site searches limited to the given domain. - **X-With-Links-Summary** (optional): `all` to gather all links or `true` to gather unique links at the end of the response. - **X-With-Images-Summary** (optional): `all` to gather all images or `true` to gather unique images at the end of the response. - **X-Retain-Images** (optional): Use `none` to remove all images from the response. - **X-No-Cache** (optional): "true" to bypass cache and retrieve real-time data. - **X-With-Generated-Alt** (optional): "true" to generate captions for images without alt tags. - **X-Respond-With** (optional): Use `no-content` to exclude page content from the response. - **X-With-Favicon** (optional): `true` to include favicon of the website in the response. - **X-Return-Format** (optional): `markdown`, `html`, `text`, `screenshot`, or `pageshot`. - **X-Engine** (optional): Use `browser` for best quality or `direct` for speed. - **X-With-Favicons** (optional): `true` to fetch the favicon of each URL in the SERP. - **X-Timeout** (optional): Specifies the maximum time (in seconds) to wait for the webpage to load. - **X-Set-Cookie** (optional): Forwards your custom cookie settings when accessing the URL. - **X-Proxy-Url** (optional): Utilizes your proxy to access URLs. - **X-Locale** (optional): Controls the browser locale to render the page. ### Parameters #### Query Parameters - **gl** (string) - Optional - The country to use for the search. It's a two-letter country code. - **location** (string) - Optional - From where you want the search query to originate. It is recommended to specify location at the city level to simulate a real user's search. - **hl** (string) - Optional - The language to use for the search. It's a two-letter language code. - **num** (number) - Optional - Sets maximum results returned. Using num may cause latency and exclude specialized result types. Omit unless you specifically need more results per page. - **page** (number) - Optional - The result offset. It skips the given number of results. It's used for pagination. ### Request Body - **q** (string) - Required - The search query. ### Request Example ```json { "q": "Jina AI", "gl": "us", "hl": "en" } ``` ### Response #### Success Response (200) - **results** (array) - List of search results. - **search_information** (object) - Information about the search. - **ads** (array) - Advertisements if available. #### Response Example ```json { "results": [ { "title": "Jina AI - The Open-Source Neural Search Framework", "link": "https://jina.ai/", "snippet": "Jina AI is an open-source neural search framework that enables developers to build multimodal search experiences." } ], "search_information": { "total_results": "100,000,000", "time_taken_displayed": 0.52, "search_time": 0.52 } } ``` **Note**: Ensure the `JINA_API_KEY` environment variable is set before running any requests. ``` -------------------------------- ### Batch Embeddings API Workflow Source: https://docs.jina.ai This section outlines the workflow for the asynchronous Batch Embeddings API. It covers submitting a batch job, polling for its status, downloading results, canceling a job, and retrieving error details. ```APIDOC ## Batch Embeddings API Workflow ### Description Asynchronously embed large volumes of text by submitting a batch job and polling for completion. This is ideal for processing thousands to millions of documents, enabling large-scale embedding tasks, offline indexing, and bulk document processing. ### Method POST (submit), GET (status/download), DELETE (cancel) ### Endpoint - **Submit**: `https://api.jina.ai/v1/batch/embeddings` - **Poll Status/Download**: `https://api.jina.ai/v1/batch/{batch_id}` - **Download Output**: `https://api.jina.ai/v1/batch/{batch_id}/output` - **Cancel**: `https://api.jina.ai/v1/batch/{batch_id}` - **Download Errors**: `https://api.jina.ai/v1/batch/{batch_id}/errors` ### Headers - **Authorization**: Bearer $JINA_API_KEY - **Content-Type**: application/json - **Accept**: application/json ### Workflow Steps 1. **Submit**: POST to `/v1/batch/embeddings` with your input. Returns a `batch_id` immediately (HTTP 202). 2. **Poll**: GET `/v1/batch/{batch_id}` to check status (`submitted`, `processing`, `completed`, `failed`, `cancelled`). 3. **Download**: When completed, GET `/v1/batch/{batch_id}/output` to stream the output JSONL. 4. **Cancel**: DELETE `/v1/batch/{batch_id}` to cancel a running batch. 5. **Errors**: GET `/v1/batch/{batch_id}/errors` to download error details if any. ### Input Options - **Inline input**: Include `input` array directly in the request body (up to 10,000 items). - **GCS input**: Set `input_file` to a GCS URI (`gs://bucket/file.jsonl`) containing JSONL with one `{"input": "text"}` per line (up to 50,000 lines). ``` -------------------------------- ### Jina Reader API Source: https://docs.jina.ai The Reader API endpoint is available at `https://r.jina.ai/`. Further details on its functionality and usage are not provided in the source text. ```APIDOC ## Reader API ### Endpoint https://r.jina.ai/ ### Description This API is used for reading or processing data. Specific details about its functionality, parameters, and request/response formats are not available in the provided documentation. ``` -------------------------------- ### Jina Reranker API Source: https://docs.jina.ai This API endpoint is used to find the most relevant search results from a list of documents based on a query. It is particularly useful for refining search results and improving the context for retrieval-augmented generation (RAG). ```APIDOC ## POST https://api.jina.ai/v1/rerank ### Description Find the most relevant search results from a list of documents based on a query. This API is best for refining search results and refining RAG (retrieval augmented generation) contextual chunks. ### Method POST ### Endpoint https://api.jina.ai/v1/rerank ### Headers - **Authorization**: Bearer $JINA_API_KEY - **Content-Type**: application/json - **Accept**: application/json ### Parameters #### Request Body (for jina-reranker-v3, jina-reranker-v2-base-multilingual, or jina-colbert-v2) - **model** (string) - Required - Identifier of the model to use. Options: `jina-reranker-v3`, `jina-reranker-v2-base-multilingual`, `jina-colbert-v2`. - **query** (string or TextDoc) - Required - The search query. - **documents** (array of strings and/or TextDocs) - Required - A list of text strings or TextDocs to rerank. If a document object is provided, all text fields will be preserved in the response. - **top_n** (integer) - Optional - The number of most relevant documents or indices to return, defaults to the length of documents. - **return_documents** (boolean) - Optional - If false, returns only the index and relevance score without the document text. If true, returns the index, text, and relevance score. Defaults to true. #### Request Body (for jina-reranker-m0) - **model** (string) - Required - Identifier of the model to use. Must be `jina-reranker-m0`. - **query** (string, TextDoc, or image (URL or base64-encoded string)) - Required - The search query. - **documents** (array of objects with keys 'text' and/or 'image') - Required - A list of text and/or image documents to rerank. Each document can have 'text' (string) and/or 'image' (URL or base64-encoded string). - **top_n** (integer) - Optional - The number of most relevant documents or indices to return, defaults to the length of documents. - **return_documents** (boolean) - Optional - If false, returns only the index and relevance score without the document text. If true, returns the index, text, and relevance score. Defaults to true. ### Response #### Success Response Returns an object containing the reranked documents with their relevance scores and indices. The structure depends on the `return_documents` parameter. #### Response Example (with return_documents: true) { "reranked_documents": [ { "document": { "text": "Document text here...", "index": 0 }, "score": 0.95 } ] } #### Response Example (with return_documents: false) { "reranked_documents": [ { "index": 0, "score": 0.95 } ] } ``` -------------------------------- ### Embeddings API Source: https://docs.jina.ai Converts text, images, or code into fixed-length vectors. This API is ideal for applications like semantic search, similarity matching, and clustering. ```APIDOC ## POST https://api.jina.ai/v1/embeddings ### Description Converts text, images, or code into fixed-length vectors. This API is ideal for applications like semantic search, similarity matching, and clustering. ### Method POST ### Endpoint https://api.jina.ai/v1/embeddings ### Headers - **Authorization**: Bearer $JINA_API_KEY - **Content-Type**: application/json - **Accept**: application/json ### Request Body (for jina-embeddings-v5-text-small or jina-embeddings-v5-text-nano) ```json { "model": "string (required)", "input": "array (required)", "embedding_type": "string or array of strings (optional)", "task": "string (optional)", "dimensions": "integer (optional)", "normalized": "boolean (optional)", "late_chunking": "boolean (optional)", "truncate": "boolean (optional)" } ``` ### Request Body (for jina-embeddings-v4) ```json { "model": "string (required)", "input": "array (required)", "embedding_type": "string or array of strings (optional)", "task": "string (optional)", "dimensions": "integer (optional)", "late_chunking": "boolean (optional)", "truncate": "boolean (optional)", "return_multivector": "boolean (optional)" } ``` ### Available Models - `jina-embeddings-v5-text-small`: 677M parameters, multilingual text, 1024-dim embeddings, 32K context. - `jina-embeddings-v5-text-nano`: 239M parameters, multilingual text, 768-dim embeddings, 8K context, optimized for low-latency. - `jina-embeddings-v4`: 3.8B parameters, multimodal (text, images, PDFs), 2048-dim embeddings. - `jina-embeddings-v3`: 570M parameters, multilingual text, 1024-dim embeddings. - `jina-clip-v2`: 885M parameters, multimodal (text, images), 1024-dim embeddings. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.