Skip to content

Commit

Permalink
Document Azure AI support
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Oct 19, 2024
1 parent 17d0c68 commit 4307934
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ OpenAI APIs for XP ChangeLog

## ?.?.? / ????-??-??

* Merged PR #4: Implement Azure AI endpoints, which differ in the way
they pass the API key and that they need an API version.
(@thekid)
* Merged PR #3: Implement function calling and assistant tools support
(@thekid)
* Added tracing capabilities to `com.openai.rest.OpenAIEndpoint` class
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,20 @@ Console::writeLine($result);

Azure OpenAI
------------
*Coming soon*
These endpoints differ slightly in how they are invoked, which is handled by the *AzureAI* implementation. See https://learn.microsoft.com/en-us/azure/ai-services/openai/overview

```php
use com\openai\rest\AzureAIEndpoint;
use util\cmd\Console;

$ai= new AzureAIEndpoint('https://'.getenv('OPENAI_API_KEY').'@example.openai.azure.com/openai/deployments/mini', '2024-02-01');
$payload= [
'model' => 'gpt-4o-mini',
'messages' => [['role' => 'user', 'content' => $prompt]],
];

Console::writeLine($ai->api('/chat/completions')->invoke($payload));
```

Realtime API
------------
Expand Down

0 comments on commit 4307934

Please sign in to comment.