> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinecone.io/llms.txt
> Use this file to discover all available pages before exploring further.

# jina-embeddings-v4

> Use the jina-embeddings-v4 embedding or reranking model with Pinecone: specs and index setup. Overview

export const ModelPageTabs = ({inferenceEnabled}) => {
  const showGuides = () => {
    document.querySelector('.model-page-guides').style.display = 'flex';
    document.querySelector('.model-page-playground').style.display = 'none';
    document.querySelector('.guides').classList.add('active');
    document.querySelector('.playground').classList.remove('active');
  };
  const showPlayground = () => {
    document.querySelector('.model-page-guides').style.display = 'none';
    document.querySelector('.model-page-playground').style.display = 'block';
    document.querySelector('.guides').classList.remove('active');
    document.querySelector('.playground').classList.add('active');
  };
  return <div className="model-page-body">
        <div className="model-page-tabs">
          <button className={`guides active ${inferenceEnabled ? "" : "cursor-default"}`} onClick={inferenceEnabled ? showGuides : null}>
            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
              <path d="M6.5 16C7.28333 16 8.04583 16.0875 8.7875 16.2625C9.52917 16.4375 10.2667 16.7 11 17.05V7.2C10.3167 6.8 9.59167 6.5 8.825 6.3C8.05833 6.1 7.28333 6 6.5 6C5.9 6 5.30417 6.05833 4.7125 6.175C4.12083 6.29167 3.55 6.46667 3 6.7V16.6C3.58333 16.4 4.1625 16.25 4.7375 16.15C5.3125 16.05 5.9 16 6.5 16ZM13 17.05C13.7333 16.7 14.4708 16.4375 15.2125 16.2625C15.9542 16.0875 16.7167 16 17.5 16C18.1 16 18.6875 16.05 19.2625 16.15C19.8375 16.25 20.4167 16.4 21 16.6V6.7C20.45 6.46667 19.8792 6.29167 19.2875 6.175C18.6958 6.05833 18.1 6 17.5 6C16.7167 6 15.9417 6.1 15.175 6.3C14.4083 6.5 13.6833 6.8 13 7.2V17.05ZM12 20C11.2 19.3667 10.3333 18.875 9.4 18.525C8.46667 18.175 7.5 18 6.5 18C5.8 18 5.1125 18.0917 4.4375 18.275C3.7625 18.4583 3.11667 18.7167 2.5 19.05C2.15 19.2333 1.8125 19.225 1.4875 19.025C1.1625 18.825 1 18.5333 1 18.15V6.1C1 5.91667 1.04583 5.74167 1.1375 5.575C1.22917 5.40833 1.36667 5.28333 1.55 5.2C2.31667 4.8 3.11667 4.5 3.95 4.3C4.78333 4.1 5.63333 4 6.5 4C7.46667 4 8.4125 4.125 9.3375 4.375C10.2625 4.625 11.15 5 12 5.5C12.85 5 13.7375 4.625 14.6625 4.375C15.5875 4.125 16.5333 4 17.5 4C18.3667 4 19.2167 4.1 20.05 4.3C20.8833 4.5 21.6833 4.8 22.45 5.2C22.6333 5.28333 22.7708 5.40833 22.8625 5.575C22.9542 5.74167 23 5.91667 23 6.1V18.15C23 18.5333 22.8375 18.825 22.5125 19.025C22.1875 19.225 21.85 19.2333 21.5 19.05C20.8833 18.7167 20.2375 18.4583 19.5625 18.275C18.8875 18.0917 18.2 18 17.5 18C16.5 18 15.5333 18.175 14.6 18.525C13.6667 18.875 12.8 19.3667 12 20Z" fill="#1B17F5" />
            </svg>
            GUIDE
          </button>
          {false && <button className="playground" onClick={showPlayground}>
            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
              <path d="M10 16.5L16 12L10 7.5V16.5ZM12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z" fill="#72788D" />
            </svg>
            PLAYGROUND
          </button>}
        </div>
      </div>;
};

export const ModelPageCard = ({image, title, company, inferenceEnabled, metric, dimension, seq, task, price}) => {
  return <div className="model-page-card">
        <div className="model-page-card-title">
          {image && image !== "null" && <div className="model-page-card-logo">
              <img src={image} className="pointer-events-none" />
            </div>}

        <h1><span className="font-semibold">{title}</span> {company !== "null" && "| " + company}</h1>

        {inferenceEnabled === "true" && <div className="model-page-card-inference">
            <svg className="shrink-0" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
              <path d="M11.9995 2.01953C6.48953 2.01953 2.01953 6.48953 2.01953 11.9995C2.01953 17.5095 6.48953 21.9795 11.9995 21.9795C17.5095 21.9795 21.9795 17.5095 21.9795 11.9995C21.9795 6.48953 17.5095 2.01953 11.9995 2.01953ZM11.9995 19.9795C7.59953 19.9795 4.01953 16.3995 4.01953 11.9995C4.01953 7.59953 7.59953 4.01953 11.9995 4.01953C16.3995 4.01953 19.9795 7.59953 19.9795 11.9995C19.9795 16.3995 16.3995 19.9795 11.9995 19.9795ZM12.7495 4.99953L8.24953 13.4995H11.3895V18.9995L15.7495 10.4995H12.7495V4.99953Z" fill="var(--text-primary)" />
            </svg>
            Hosted
          </div>}
        </div>

        <div className="model-page-card-stats">
          {!!metric && metric.length > 0 && <div>
            <span>METRIC</span>
            <p>{metric.join(", ")}</p>
          </div>}

          {!!dimension && dimension.length > 0 && <div>
            <span>DIMENSION</span>
            <p>{dimension.join(", ")}</p>
          </div>}

          {!!seq && seq.length > 0 && <div>
            <span>MAX INPUT TOKENS</span>
            <p>{seq}</p>
          </div>}

          {!!task && task.length > 0 && <div>
            <span>TASK</span>
            <p>{task}</p>
          </div>}

          {price && price.length > 0 && <div className="price">
            <span>PRICE</span>
            <p>${price}</p>
          </div>}
        </div>
      </div>;
};

export const ModelPageHeader = () => {
  return <div style={{
    marginBottom: "2.1875rem"
  }}>
      <a href="/models" style={{
    display: "inline-flex",
    gap: "0.5rem",
    alignItems: "center",
    color: "#121142"
  }}>
        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" style={{
    flexShrink: 0
  }}>
          <path d="M10.4703 4.94L9.53027 4L5.53027 8L9.53027 12L10.4703 11.06L7.41694 8L10.4703 4.94Z" fill="var(--brand-blue)" />
        </svg>
        Back to all models
      </a>
    </div>;
};

<div className="not-prose">
  <ModelPageHeader />

  <ModelPageCard image="https://cdn.sanity.io/images/vr8gru94/production/a6d54c63949601441dcb195ba1b2b258765d69a9-1024x1024.svg" title="jina-embeddings-v4" company="Jina AI" inferenceEnabled="false" metric={["cosine", "dot product"]} dimension={["128", "256", "512", "1024", "2048"]} seq="32768" task="embedding" price="" />

  <ModelPageTabs inferenceEnabled="false" />
</div>

<div className="model-page-guides">
  <div className="model-page-content">
    ## Overview

    [`jina-embeddings-v4`](https://huggingface.co/jinaai/jina-embeddings-v4) is a universal embedding model for multimodal and multilingual retrieval. The model is specially designed for complex document retrieval, including visually rich documents with charts, tables, and illustrations.

    ## Features

    `jina-embeddings-v4` features:

    * Unified embeddings for text, images, and visual documents, supporting both dense (single-vector) and late-interaction (multi-vector) retrieval.
    * Multilingual support (30+ languages) and compatibility with a wide range of domains, including technical and visually complex documents.
    * Task-specific adapters for retrieval, text matching, and code-related tasks, which can be selected at inference time.
    * Flexible embedding size: dense embeddings are 2048 dimensions by default but can be truncated to as low as 128 with minimal performance loss.

    ## Installation

    ```python theme={null}
    pip install pinecone requests
    ```

    ## Create Index

    ```python theme={null}
    from pinecone import Pinecone, ServerlessSpec

    pc = Pinecone(api_key="API_KEY")

    JINA_API_KEY = ""
    dimension = 1024

    index_name = "jina-embeddings-v4"

    if not pc.has_index(index_name):
        pc.create_index(
            name=index_name,
            dimension=dimension,
            metric="cosine",
            spec=ServerlessSpec(
                cloud='aws',
                region='us-east-1'
            )
        )

    index = pc.Index(index_name)
    ```

    ## Embed & Upsert

    ```python theme={null}
    from typing import Literal, List
    import requests

    def get_embeddings(
    	texts: List[str], 
    	dimensions: int, 
    	task: Literal['text-matching', 'separation', 'classification', 'retrieval.query', 'retrieval.passage']):
        headers = {
            'Content-Type': 'application/json',
            'Authorization': f'Bearer {JINA_API_KEY}'
        }
        data = {
            'input': texts,
            'model': 'jina-embeddings-v4',
            'dimensions': dimensions,
            'task': task
        }
        response = requests.post('https://api.jina.ai/v1/embeddings', headers=headers, json=data)
        return response.json()
        
    # Data to index
    data = [
    	{"id": "vec1", "text": "Apple is a popular fruit known for its sweetness and crisp texture."},
    	{"id": "vec2", "text": "The tech company Apple is known for its innovative products like the iPhone."},
    	{"id": "vec3", "text": "Many people enjoy eating apples as a healthy snack."},
    	{"id": "vec4", "text": "Apple Inc. has revolutionized the tech industry with its sleek designs and user-friendly interfaces."},
    	{"id": "vec5", "text": "An apple a day keeps the doctor away, as the saying goes."},
    ]


    embeddings = get_embeddings([d["text"] for d in data], dimensions=dimension, task='retrieval.passage')
    embeddings = [e["embedding"] for e in embeddings["data"]]
    vectors = []
    for d, e in zip(data, embeddings):
    	vectors.append({
    		"id": d['id'],
    		"values": e,
    		"metadata": {'text': d['text']}
    	})
    	
    index.upsert(
    	vectors=vectors,
    	namespace="ns1"
    )
    ```

    ## Query

    ```python theme={null}
    query = "Tell me about the tech company known as Apple"

    # Remember to keep query and document embedding to the same dimensions
    x = get_embeddings([query], dimensions=dimension, task='retrieval.query')["data"][0]["embedding"]

    results = index.query(
        namespace="ns1",
        vector=x,
        top_k=3,
        include_values=False,
        include_metadata=True
    )

    print(results)
    ```
  </div>

  <div className="model-page-sidebar">
    <div className="iframe-placeholder">
      <iframe className="" src="https://www.pinecone.io/tools/index-creation/?indexName=jina-embeddings-v4&metrics=cosine,dot product&dimensions=128,256,512,1024,2048&cloud=aws&region=us-east-1" width="100%" height="1000px" allow="clipboard-write allow-popups" allowTransparency="true" />
    </div>
  </div>
</div>

<div className="model-page-playground not-prose">
  Lorem Ipsum
</div>
