ExportXMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      The class VoyageEmbeddings in the LangChainJS framework is making use of the endpoints at https://api.voyageai.com/v1. This only works for API keys created directly on Voyage AI's website (https://dashboard.voyageai.com/api-keys).

      API Keys created on the Atlas UI as described in our official documentation require the API url https://ai.mongodb.com/v1. We need to update the VoyageEmbeddings class in LangChainJS to support both endpoints.

      Desired User Experiece

      The current way to work with Atlas-created Voyage keys is to manually set the API's url:

      const embeddings = new VoyageEmbeddings({
            apiKey: "my-voyage-api-key",
            basePath: "https://ai.mongodb.com/v1",
          });
      
      // This fails because the request calls the wrong domain:
      // 'api.voyage.com' instead of 'ai.mongodb.com'
      await embeddings.embedQuery("Hello world");
      
      console.log(embeddingModel.apiUrl)
      // outputs: 'htps://api.voyageai.com/v1/embeddings'
      
      // Workaround: set apiUrl directly
      embeddingModel.apiUrl = "https://ai.mongodb.com/v1/embeddings"; 
      await embeddings.embedQuery("Hello world");  // works!
      

      Users should be able to pass the apiUrl param in the constructor:

      const embeddings = new VoyageEmbeddings({
            apiKey: "my-voyage-api-key",
            basePath: "https://ai.mongodb.com/v1",
          });
      
      expect(embeddings.apiUrl).toBe("https://ai.mongodb.com/v1/embeddings");
      

       

      Acceptance Criteria

      • A PR has been opened against https://github.com/langchain-ai/langchainjs
      • The LangChain team has acknowledge this PR.
      • Test that apiUrl is set to the domain passed in the VoyageEmbeddings constructor.
      • Nice to have: auto-endpoint detection similar to Python. (Could not find evidence/samples of this in the Python repository).

            Assignee:
            Raschid Jimenez
            Reporter:
            Raschid Jimenez
            Pavel Safronov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: