Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TogetherAI Embeddings is Broken #7544

Closed
5 tasks done
Jacky3003 opened this issue Jan 17, 2025 · 1 comment · Fixed by #7545
Closed
5 tasks done

TogetherAI Embeddings is Broken #7544

Jacky3003 opened this issue Jan 17, 2025 · 1 comment · Fixed by #7545
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@Jacky3003
Copy link
Contributor

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

The following code from togetherai.int.test.ts breaks:

  const embeddings = new TogetherAIEmbeddings();
  const res = await embeddings.embedQuery("Hello world");

Error Message and Stack Trace (if applicable)

From running the test in the repository, the following output is:

 FAIL  src/embeddings/tests/togetherai.int.test.ts (96.398 s)
  ✕ Test TogetherAIEmbeddings.embedQuery (96208 ms)
  ○ skipped Test TogetherAIEmbeddings.embedDocuments

  ● Test TogetherAIEmbeddings.embedQuery

    SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

      90 |             }
      91 |             else {
    > 92 |                 throw new Error(error);
         |                       ^
      93 |             }
      94 |         }), {
      95 |             onFailedAttempt: this.onFailedAttempt,

      at ../../langchain-core/dist/utils/async_caller.js:92:23
      at RetryOperation._fn (../../node_modules/p-retry/index.js:50:12)

Description

A timeout happens when the code retries the request to the async caller. This probably happens since the embeddings API URL is deprecated:
https://api.together.xyz/api/v1/embeddings

The following replacement needs to be made:
https://api.together.xyz/v1/embeddings

System Info

node ➜ /workspaces/langchainjs/libs/langchain-community (main) $ yarn info langchain
└─ langchain@workspace:langchain
   ├─ Instances: 1
   ├─ Version: 0.0.0-use.local
   │
   └─ Dependencies
      ├─ @faker-js/faker@npm:^7.6.0 → npm:7.6.0
      ├─ @jest/globals@npm:^29.5.0 → npm:29.5.0
      ├─ @langchain/core@workspace:* → workspace:langchain-core
      ├─ @langchain/scripts@>=0.1.0 <0.2.0 → workspace:libs/langchain-scripts
      ├─ @tsconfig/recommended@npm:^1.0.2 → npm:1.0.2
      ├─ @types/handlebars@npm:^4.1.0 → npm:4.1.0
      ├─ @types/html-to-text@npm:^9 → npm:9.0.0
      ├─ @types/js-yaml@npm:^4 → npm:4.0.5
      ├─ @types/jsdom@npm:^21.1.1 → npm:21.1.1
      ├─ @types/uuid@npm:^9 → npm:9.0.1
      ├─ @types/ws@npm:^8 → npm:8.5.8
      ├─ axios@npm:^0.26.0 → npm:0.26.1
      ├─ cheerio@npm:1.0.0-rc.12 → npm:1.0.0-rc.12
      ├─ dotenv@npm:^16.0.3 → npm:16.0.3
      ├─ dpdm@patch:dpdm@npm%3A3.12.0#./.yarn/patches/dpdm-npm-3.12.0-0dfdd8e3b8.patch::locator=langchainjs%40workspace%3A. → patch:dpdm@npm%3A3.12.0#./.yarn/patches/dpdm-npm-3.12.0-0dfdd8e3b8.patch::version=3.12.0&hash=2406a8&locator=langchainjs%40workspace%3A.
      ├─ eslint-plugin-no-instanceof@npm:^1.0.1 → npm:1.0.1
      ├─ eslint@npm:^8.33.0 → npm:8.35.0
      ├─ handlebars@npm:^4.7.8 → npm:4.7.8
      ├─ jest-environment-node@npm:^29.6.4 → npm:29.6.4
      ├─ js-tiktoken@npm:^1.0.12 → npm:1.0.12
      ├─ js-yaml@npm:^4.1.0 → npm:4.1.0
      ├─ jsonpointer@npm:^5.0.1 → npm:5.0.1
      ├─ openai@npm:^4.41.1 → npm:4.42.0
      ├─ openapi-types@npm:^12.1.3 → npm:12.1.3
      ├─ p-retry@npm:4 → npm:4.6.2
      ├─ peggy@npm:^3.0.2 → npm:3.0.2
      ├─ prettier@npm:^2.8.3 → npm:2.8.4
      ├─ release-it@npm:^17.6.0 → npm:17.6.0
      ├─ rimraf@npm:^5.0.1 → npm:5.0.1
      ├─ rollup@npm:^3.19.1 → npm:3.19.1
      ├─ typescript@patch:typescript@~5.1.6#~builtin<compat/typescript> → patch:typescript@npm%3A5.1.6#~builtin<compat/typescript>::version=5.1.6&hash=77c9e2
      ├─ uuid@npm:^10.0.0 → npm:10.0.0
      ├─ wikipedia@npm:^2.1.2 → npm:2.1.2
      ├─ yaml@npm:^2.2.1 → npm:2.2.1
      ├─ zod@npm:3.23.8 → npm:3.23.8
      ├─ @langchain/anthropic@workspace:* → workspace:libs/langchain-anthropic [773c0]
      ├─ @langchain/aws@workspace:* → workspace:libs/langchain-aws [773c0]
      ├─ @langchain/cerebras@* → workspace:libs/langchain-cerebras [0b9fc]
      ├─ @langchain/cohere@workspace:* → workspace:libs/langchain-cohere [773c0]
      ├─ @langchain/google-genai@workspace:* → workspace:libs/langchain-google-genai [773c0]
      ├─ @langchain/google-vertexai-web@workspace:* → workspace:libs/langchain-google-vertexai-web [773c0]
      ├─ @langchain/google-vertexai@workspace:* → workspace:libs/langchain-google-vertexai [773c0]
      ├─ @langchain/groq@workspace:* → workspace:libs/langchain-groq [773c0]
      ├─ @langchain/mistralai@workspace:* → workspace:libs/langchain-mistralai [773c0]
      ├─ @langchain/ollama@workspace:* → workspace:libs/langchain-ollama [773c0]
      ├─ @langchain/openai@workspace:* → workspace:libs/langchain-openai [773c0]
      ├─ @langchain/textsplitters@workspace:* → workspace:libs/langchain-textsplitters [773c0]
      ├─ @swc/core@npm:^1.3.90 → npm:1.3.90 [6dbfd]
      ├─ @swc/jest@npm:^0.2.29 → npm:0.2.29 [6dbfd]
      ├─ @typescript-eslint/eslint-plugin@npm:^5.58.0 → npm:5.58.0 [6d556]
      ├─ @typescript-eslint/parser@npm:^5.58.0 → npm:5.58.0 [6d556]
      ├─ eslint-config-airbnb-base@npm:^15.0.0 → npm:15.0.0 [6d556]
      ├─ eslint-config-prettier@npm:^8.6.0 → npm:8.7.0 [6dbfd]
      ├─ eslint-plugin-import@npm:^2.27.5 → npm:2.27.5 [6d556]
      ├─ eslint-plugin-jest@npm:^27.6.0 → npm:27.6.0 [6d556]
      ├─ eslint-plugin-prettier@npm:^4.2.1 → npm:4.2.1 [6dbfd]
      ├─ jest@npm:^29.5.0 → npm:29.7.0 [6dbfd]
      ├─ langsmith@npm:^0.2.8 → npm:0.2.8 [0b9fc]
      ├─ ts-jest@npm:^29.1.0 → npm:29.1.0 [221f6]
      ├─ typeorm@npm:^0.3.20 → npm:0.3.20 [3a972]
      └─ zod-to-json-schema@npm:^3.22.3 → npm:3.22.3 [221f6]
Copy link

dosubot bot commented Jan 17, 2025

I found a similar unsolved discussion titled New to LangChain TypeScript library (coming from Python SDK), which might be relevant to your issue [1].

Regarding the issue you're facing, it seems that the TogetherAIEmbeddings class is using a deprecated API URL. The current implementation uses the URL "https://api.together.xyz/api/v1/embeddings" [2]. You mentioned that the correct URL should be "https://api.together.xyz/v1/embeddings". Updating the API URL in the TogetherAIEmbeddings class to the new URL should resolve the issue.

Make sure to update the embeddingsAPIUrl property in the TogetherAIEmbeddings class to the new URL and test if the issue persists.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot dosubot bot added the auto:bug Related to a bug, vulnerability, unexpected error with an existing feature label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant