> ## 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-clip-v2

> Use the jina-clip-v2 embedding or reranking model with Pinecone: specs and index setup. Jina CLIP v2 is a state-of-the-art **multilingual and multimodal.

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-clip-v2" company="Jina AI" inferenceEnabled="false" metric={["cosine"]} dimension={["1024"]} seq="" task="embedding" price="" />

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

<div className="model-page-guides">
  <div className="model-page-content">
    Jina CLIP v2 is a state-of-the-art **multilingual and multimodal (text-image) embedding model,** It excels in both cross-modal (text-to-image, image-to-text) and unimodal (text-to-text) retrieval tasks within a single vector space. It supports 100 languages with a focus on 30 (including English, Spanish, Chinese, Arabic, and more), it supports flexible embedding generation through Matryoshka Representation Learning (MRL) and allows for shortened vector lengths via the `dimensions` parameter.

    ## Installation

    ```bash 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 = ""  # Replace with your Jina API key
    dimension = 1024  # Specify the desired embedding dimension

    index_name = "jina-clip-v2"

    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'  # Replace with your preferred region
            )
        )

    index = pc.Index(index_name)

    ```

    ## Embed & Upsert

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

    def get_embeddings(
        inputs: List[str],  # List of text or image URLs
        dimensions: 1024,
        task: str = None  # Set to 'retrieval.query' for text retrieval
    ):
        headers = {
            'Content-Type': 'application/json',
            'Authorization': f'Bearer {JINA_API_KEY}'
        }
        data = {
            'input': inputs,
            'model': 'jina-clip-v2',
            'dimensions': dimensions,
        }

        response = requests.post('https://api.jina.ai/v1/embeddings', headers=headers, json=data)
        return response.json()

    # Example data with image and text
    data = [
        {"id": "img1", "modality": "image", "content": "<https://example.com/image1.jpg>"},
        {"id": "txt1", "modality": "text", "content": "A red apple on a table."},
        {"id": "img2", "modality": "image", "content": "<https://example.com/image2.png>"},
        {"id": "txt2", "modality": "text", "content": "A basket of green apples."},
    ]

    vectors = []
    for item in data:
        embeddings = get_embeddings([item["content"]], dimensions=dimension)
        embedding = embeddings["data"][0]["embedding"]
        vectors.append({
            "id": item['id'],
            "values": embedding,
            "metadata": {'content': item['content'], 'modality': item['modality']}
        })

    index.upsert(
        vectors=vectors,
        namespace="ns1"  # optionally specify a namespace
    )
    ```

    ## Query

    ```python theme={null}
    query = "Santa With Glasses"  # Text query

    embeddings = get_embeddings([query], dimensions=dimension, task='retrieval.query')
    query_embedding = embeddings["data"][0]["embedding"]

    results = index.query(
        namespace="ns1",
        vector=query_embedding,
        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-clip-v2&metrics=cosine&dimensions=1024&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>
