> ## 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.

# bge-reranker-v2-m3

> Use the bge-reranker-v2-m3 embedding or reranking model with Pinecone: specs and index setup. This is an open source, high performance, multilingual model.

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/40b1d05ee1325e6d9e4886af4e76ff06d844faff-188x188.jpg" title="bge-reranker-v2-m3" company="BAAI" inferenceEnabled="true" metric={[]} dimension={[]} seq="1024" task="reranker" price="2.00 / 1k requests" />

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

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

    This is an open source, high performance, multilingual model. It works well on messy data and short queries expected to return medium-length passages of text (1-2 paragraphs).

    This model returns a relevance score for a query and passage. A sigmoid function can map the relevance score to a float value in the range \[0,1].

    Reranking models are designed to provide superior accuracy over retriever models but are much slower, so this model should not be used with more than a few hundred documents. Due to the slowness of rerankers, we recommend using them in a two-stage retrieval system: use a retrieval to pull in a smaller number of documents from a larger database and then rerank the smaller number of documents using a reranker.

    ### Installation

    ```python theme={null}
    pip install -U pinecone
    ```

    ### Reranking

    See [rerank](/guides/search/rerank-results) for instructions for using `bge-reranker-v2-m3` with the Pinecone Inference API [`rerank` endpoint](/reference/api/2024-10/inference/rerank).

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

    pc = Pinecone("API-KEY")

    query = "Tell me about Apple's products"
    results = pc.inference.rerank(
        model="bge-reranker-v2-m3",
        query=query,
        documents=[
    "Apple is a popular fruit known for its sweetness and crisp texture.",	
    "Apple is known for its innovative products like the iPhone.",
    "Many people enjoy eating apples as a healthy snack.",
    "Apple Inc. has revolutionized the tech industry with its sleek designs and user-friendly interfaces.",
    "An apple a day keeps the doctor away, as the saying goes.",
        ],
        top_n=3,
        return_documents=True,
        parameters= {
            "truncate": "END"
        }
    )

    print(query)
    for r in results.data:
      print(r.score, r.document.text)

    ```
  </div>

  <div className="model-page-sidebar">
    <div className="iframe-placeholder" />
  </div>
</div>

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