client icon indicating copy to clipboard operation
client copied to clipboard

#30 Add method to create client with custom base URI

Open LeoVie opened this issue 3 years ago • 1 comments

This solves #30. Please also see my comment here https://github.com/openai-php/client/issues/30#issuecomment-1367486440

BaseUri::toString will now check, if the given base URI starts with a protocol. If not, it adds https:// as protocol as prefix to the URI.

Also, the method will now check, if the given base URI ends with a slash and only append a trailing slash to it, if not.

That can be used, so users can create clients with a custom base URI, that is not required to use https as protocol, e.g.

$client = OpenAI::clientWithBaseUri('sk-...', 'http://mock-api/v1');

LeoVie avatar Dec 29 '22 17:12 LeoVie

Hi, I don't want to be impatient, but do you need any more information from me? It's also fine, if you have doubts about this changes, would be just good to know :)

LeoVie avatar Jan 11 '23 12:01 LeoVie

An extended factory has been added in v0.4.0.

@LeoVie Thank you very much for your help and patience.

gehrisandro avatar Mar 17 '23 19:03 gehrisandro