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

Network timeout when accessing https://tiktoken.pages.dev after OpenAI stream response #7798

Open
5 tasks done
xggz opened this issue Mar 5, 2025 · 2 comments
Open
5 tasks done
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@xggz
Copy link

xggz commented Mar 5, 2025

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

import {ChatOpenAI} from "@langchain/openai";

new ChatOpenAI({...});

Error Message and Stack Trace (if applicable)

No response

Description

When using the OpenAI API with streaming mode, after receiving the complete stream response, my application attempts to request the URL https://tiktoken.pages.dev (likely related to tokenization). However, the request consistently fails due to network timeout in my local environment.

System Info

[email protected] | MIT | deps: 12 | versions: 314
Typescript bindings for langchain
https://github.com/langchain-ai/langchainjs/tree/main/langchain/

keywords: llm, ai, gpt3, chain, prompt, prompt engineering, chatgpt, machine learning, ml, openai, embeddings, vectorstores

dist
.tarball: https://registry.npmmirror.com/langchain/-/langchain-0.3.19.tgz
.shasum: a0329036c4c870018897b91af2ac442c1f07294b
.integrity: sha512-aGhoTvTBS5ulatA67RHbJ4bcV5zcYRYdm5IH+hpX99RYSFXG24XF3ghSjhYi6sxW+SUnEQ99fJhA5kroVpKNhw==
.unpackedSize: 4.8 MB

dependencies:
@langchain/openai: >=0.1.0 <0.5.0 js-yaml: ^4.1.0 openapi-types: ^12.1.3 yaml: ^2.2.1
@langchain/textsplitters: >=0.0.0 <0.2.0 jsonpointer: ^5.0.1 p-retry: 4 zod-to-json-schema: ^3.22.3
js-tiktoken: ^1.0.12 langsmith: >=0.2.8 <0.4.0 uuid: ^10.0.0 zod: ^3.22.4

maintainers:

dist-tags:
latest: 0.3.19 next: 0.3.2-rc.0 tag-for-publishing-older-releases: 0.2.20

published 2 weeks ago by basproul [email protected]

Copy link

dosubot bot commented Mar 5, 2025

I found a similar unsolved discussion regarding network timeouts when accessing tiktoken.pages.dev in the LangChain.js repository. You can view it here [1].

The purpose of accessing tiktoken.pages.dev is to fetch encoding data necessary for the Tiktoken instance, which is crucial for handling different encodings for language models [2]. If you're experiencing network timeouts, it might be related to network configurations or dependencies in your local environment.

Unfortunately, there isn't specific guidance available in the repository for troubleshooting these network issues. You might want to check your network settings or try accessing the URL from a different network to see 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 | Bug Report | Other

@dosubot dosubot bot added the auto:bug Related to a bug, vulnerability, unexpected error with an existing feature label Mar 5, 2025
@xggz
Copy link
Author

xggz commented Mar 7, 2025

I understand this optimization was implemented to reduce the package size. However, in certain network environments where access to this domain is restricted, the handleLLMEnd event consistently fails to trigger.

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

No branches or pull requests

1 participant