go-openai
go-openai copied to clipboard
Add possability to create NewClient with custom endpoint (localhost)
Is your feature request related to a problem? Please describe. As of now, the openai chatGPT API in the sashabaranov/go-openai project only supports a hardcoded end-point. This limitation restricts the flexibility and customizability that users might require in certain scenarios.
Basically I have gpt4all working locally, and it has openai API compatible supported. Which means, if I could change endpoint of API to localhost -- I would able to use go-openai locally
Describe the solution you'd like I want to be able to use go-openai which can call custom end-point and not only openai.com
Let's say that
go-openai.NewClient(api_key)
can be called like go-openai.NewClient(api_key,api_endpoint)
It would be enough if AuthToken was a public field.
I agree. Hope the author changes
Did you tried this?
c := openai.DefaultConfig("withYourAuthToken")
c.BaseUrl = "http://localhost/gpt4all"
client := openai.NewClientWithConfig(c)