openai-php / laravel

⚡️ OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with OpenAI API
MIT License
2.58k stars 179 forks source link

Support change of endpoint url to support OctoAI #94

Closed DivByZeroIT closed 4 months ago

DivByZeroIT commented 5 months ago

Sorry if this is OT or a dumb question, is it possible to add the endpoint URL as a config parameter (or change it when making calls in other ways) to make calls to providers like OctoAI that support the same OpenAI API standard with just a different set of endpoints / keys ?

Thanks

willcastillo commented 4 months ago

Hey @DivByZeroIT , for what it's worth, the base package open-ai-php/client in its factory library exposes a method called withBaseUri which allows you to specify the base uri for every call.

nekhbet commented 4 months ago

$client = OpenAI::factory() ->withBaseUri('{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}') ->withHttpHeader('api-key', '{your-api-key}') ->withQueryParam('api-version', '{version}') ->make();

DivByZeroIT commented 4 months ago

Thanks @willcastillo @willcastillo !