azure-search-openai-demo
azure-search-openai-demo copied to clipboard
Upgrade sample to use ChatCompletion API
Purpose
Upgrade Sample to use ChatCompletion API of gpt-35-turbo model
- ...
Does this introduce a breaking change?
[x ] Yes
[ ] No
Pull Request Type
What kind of change does this Pull Request introduce?
- Update openAI lib to use chatcompletion api
- Update api version to latest
- Contract changes for chatcompletion scenario
[ ] Bugfix
[x ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:
How to Test
- Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
- Test the code
What to Check
Verify that the following are valid
- ...
Other Information
@srbalakr aside from individual comments: I wonder if we should consider moving all OpenAI calls to use the chat API, so we can use Turbo by default for everything (or those that want to, can use GPT-4). It'll need a bit more rework, but it means we can use a single model deployment in the Azure OpenAI for all cases except embeddings.
@srbalakr aside from individual comments: I wonder if we should consider moving all OpenAI calls to use the chat API, so we can use Turbo by default for everything (or those that want to, can use GPT-4). It'll need a bit more rework, but it means we can use a single model deployment in the Azure OpenAI for all cases except embeddings.
@pablocastro agreed. Since this is my first PR, let me check in with current changes. I will put up a follow up PR to update biceps and all other completion api to chat completion api.
We should also update notebooks/chat-read-retrieve-read.ipynb
We should also update notebooks/chat-read-retrieve-read.ipynb
Ah, missed it. Thank you. Let me put up a follow up PR along with other chat completion api's
Excited for this change! Nice to not have to use the im_start/im_end anymore.
I left some comments, mostly around clarity around how token counting works, but no blockers.
I also noted some style issues around variable names. There's no linting/precommit setup for this repo yet, but until then, it'd be great if you could enable linting in your editor. The Python team's samples typically use ruff for linting, black for whitespace formatting, and isort for import sorting. The Pylance extension catches a lot of issues as well, however.
Thanks for addressing my feedback! The code is clearer to follow now.