Git Product home page Git Product logo

Comments (3)

dosubot avatar dosubot commented on May 29, 2024 2

πŸ€–

Hi @troublesprouter! It's great to see you again. I hope all has been going well since our last interaction.

Based on the information provided, the Pinecone integration is implemented in the utils/pinecone-client.ts file. However, the specific function responsible for querying the Pinecone database and setting the number of results returned by a Pinecone query is not specified in the provided context.

Typically, in Pinecone, the number of results returned by a query can be controlled by a parameter called top_k in the query function. This parameter specifies the number of nearest neighbors to return.

If this is the case in the gpt4-pdf-chatbot-langchain repository, you should be able to modify the top_k parameter in the query function in the utils/pinecone-client.ts file to control the number of results returned.

However, without the specific function or the implementation details, I can't provide a more accurate answer. Could you please provide more details about the function or the implementation of the Pinecone query in the utils/pinecone-client.ts file? This will help me give you a more precise answer.

For more information about Pinecone's query function and the top_k parameter, you can refer to the Pinecone documentation.

I hope this helps! If you have any more questions, feel free to ask.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a πŸ‘ if this is helpful and πŸ‘Ž if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

from gpt4-pdf-chatbot-langchain.

dosubot avatar dosubot commented on May 29, 2024 2

πŸ€–

Hi, @troublesprouter

I'm helping the gpt4-pdf-chatbot-langchain team manage their backlog and am marking this issue as stale. It seems that you have already resolved the issue by adding a line of code in the chat.ts file to set the number of results to be returned.

Could you please confirm if this issue is still relevant to the latest version of the gpt4-pdf-chatbot-langchain repository? If it is, kindly let the gpt4-pdf-chatbot-langchain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you!

from gpt4-pdf-chatbot-langchain.

troublesprouter avatar troublesprouter commented on May 29, 2024 1

Found the solution:

On line 57 of chat.ts, add:

// Set the number of results to be returned
retriever.k = 10; // Replace 10 with your desired number of results

so that it now looks like this:

// Use a callback to get intermediate sources from the middle of the chain
    let resolveWithDocuments: (value: Document[]) => void;
    const documentPromise = new Promise<Document[]>((resolve) => {
      resolveWithDocuments = resolve;
    });
    const retriever = vectorStore.asRetriever({
      callbacks: [
        {
          handleRetrieverEnd(documents) {
            resolveWithDocuments(documents);
          },
        },
      ],
    });

    // Set the number of results to be returned
    retriever.k = 10; // Replace 10 with your desired number of results

    //create chain
    const chain = makeChain(retriever);

from gpt4-pdf-chatbot-langchain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.