Giter VIP home page Giter VIP logo

Comments (9)

nfcampos avatar nfcampos commented on June 27, 2024 1

Update to the latest version with npm install langchain@latest and try again

from langchainjs.

alberduris avatar alberduris commented on June 27, 2024 1

npm view langchain version still shows the same version (0.0.44) but it is working now, thanks!

Is there an example of how to send the response of the ChatOpenAI streamed back to the client from the cf workers?

Edit: I got it working here, in case someone is interested: https://gist.github.com/alberduris/32e4ad5827cb01c28022ded982bfd8bc

from langchainjs.

esaounkine avatar esaounkine commented on June 27, 2024

Could you provide a bit more context of what's the desired outcome?

from langchainjs.

nfcampos avatar nfcampos commented on June 27, 2024

The official openai library (which we use) uses axios to make http requests.
Axios off-the-shelf doesn't work in non-node environments.
For non-streaming output we already use an axios adapter (https://github.com/hwchase17/langchainjs/blob/main/langchain/src/util/axios-fetch-adapter.js) to make it work outside Node. This issue is about updating that adapter to support the SSE responses that OpenAI uses for streaming

from langchainjs.

alberduris avatar alberduris commented on June 27, 2024

Is it possible now to make streaming OpenAI requests, for example, on Cloudflare Workers? If so, how?

from langchainjs.

nfcampos avatar nfcampos commented on June 27, 2024

To set up Cloudflare Workers see #212 (comment)
To set up streaming see https://js.langchain.com/docs/modules/models/llms/additional_functionality#streaming-responses

from langchainjs.

alberduris avatar alberduris commented on June 27, 2024

It's not working. I have followed those instructions and (after fixing several process is not defined errors) I'm still getting the ✘ [ERROR] Uncaught (in response) TypeError: adapter is not a function error as described https://github.com/fern-openai/openai-node/issues/7 and openai/openai-node#30 (comment).

from langchainjs.

nfcampos avatar nfcampos commented on June 27, 2024

Which version of langchain are you using?

from langchainjs.

alberduris avatar alberduris commented on June 27, 2024

Which version of langchain are you using?

From your package.json specification:

  "dependencies": {
    "langchain": "^0.0.35"
  }

I get:

> npm view langchain version
$ 0.0.44

from langchainjs.

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.