azure-search-openai-demo icon indicating copy to clipboard operation
azure-search-openai-demo copied to clipboard

Upgrade sample to use ChatCompletion API

Open srbalakr opened this issue 1 year ago • 1 comments

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?

  1. Update openAI lib to use chatcompletion api
  2. Update api version to latest
  3. 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 avatar Jul 06 '23 00:07 srbalakr

@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 avatar Jul 06 '23 20:07 pablocastro

@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.

srbalakr avatar Jul 07 '23 19:07 srbalakr

We should also update notebooks/chat-read-retrieve-read.ipynb

chuwik avatar Jul 07 '23 19:07 chuwik

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

srbalakr avatar Jul 07 '23 21:07 srbalakr

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.

pamelafox avatar Jul 07 '23 22:07 pamelafox

Thanks for addressing my feedback! The code is clearer to follow now.

pamelafox avatar Jul 10 '23 19:07 pamelafox