cohere-ai / cohere-typescript

The Cohere TypeScript SDK
https://docs.cohere.ai
MIT License
122 stars 18 forks source link

Rereanking not possible for typescrpt/javascript #116

Closed WasimIbKhan closed 8 months ago

WasimIbKhan commented 8 months ago

Hi, I've been trying to implement reranking for my javascript RAG implementation but I've been having issues. Is is currently possible to perform reranking with javascript coherence, if so how do we implement this

billytrend-cohere commented 8 months ago

Hey @WasimIbKhan can you share your code snippet please? This is working for me

    const rerank = await cohere.rerank({
        documents: [
            { text: "Carson City is the capital city of the American state of Nevada."},
            { text: "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan."},
            { text: "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district."},
            { text: "Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states."}
        ],
        query: "What is the capital of the United States?",
        topN: 3,

    });

    console.log(rerank);
WasimIbKhan commented 8 months ago

hi I just noticed the new update. I was working on the version before you updated today, but now you've fixed it,

Thanks for the response.

billytrend-cohere commented 8 months ago

awesome thanks for reporting this issue!