Coder Social home page Coder Social logo

Comments (4)

maxijonson avatar maxijonson commented on September 27, 2024

Hi! Thanks for raising the issue. I've never worked with proxies in libraries, but I do understand the need for them in different situations.

I'll look into what can be done about this!

from gpt-turbo.

maxijonson avatar maxijonson commented on September 27, 2024

There seem to be a related issue on OpenAI's Node API with a potential fix through configuring the axios instance. I'll try to implement some config options to the Conversation object to do this. However, I'm unsure how to test this locally, but I'll try to figure something out!

openai/openai-node#85

from gpt-turbo.

jellli avatar jellli commented on September 27, 2024

Another related issue is openai/openai-node#92.
This solution can resolve this issue, hope it can help

from gpt-turbo.

maxijonson avatar maxijonson commented on September 27, 2024

Hey! Sorry it took me a while to ship this, I was working on the message streaming feature at the time the issue was raised. Thanks for your patience!

I implemented a way to pass an AxiosRequestConfig object to both the Conversation constructor and its prompt method.

This is available on version 2.1.0.

import { Conversation } from 'gpt-turbo';

(async () => {
    const conversation = new Conversation(
        {
        apiKey: /* Your OpenAI API key */,
        }, 
        {
            proxy: {
                protocol: /* Your proxy protocol */,
                host: /* Your proxy host */,
                port: /* Your proxy port */,
                auth: {
                    username: /* Your proxy username */,
                    password: /* Your proxy password */,
                },
            }
        }
    );

    const response = await conversation.prompt(
        "What is TypeScript?",
        {},
        {
            proxy: {
                protocol: /* Your proxy protocol */,
                host: /* Your proxy host */,
                port: /* Your proxy port */,
                auth: {
                    username: /* Your proxy username */,
                    password: /* Your proxy password */,
                },
            }
        }
    );
    console.log(`Response: ${response.content}`);
})();

Let me know if you have any questions or other issues regarding the proxy. I haven't been able to test it, since I've never used such features, but it should work since there's no implementation on gpt-turbo apart from passing your options straight to OpenAI's SDK. Thanks again for your issue!

from gpt-turbo.

Related Issues (5)

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.