Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixing OpenAIPrompt class to be able to work with older models like text-davinci-003 #2319

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

FarrukhMasud
Copy link
Contributor

Issue

While working with OpenAIPrompt class, I discovered that this class does not work with older models. Upon investigation, I found that for models specified in the list legacyModels, OpenAIPrompt class suppose to use OpenAICompletion instance, for all other model deployment names, OpenAIChatCompletion class is to be used. When setting parameter for OpenAICompletion, it tries to set parameters that are not available in OpenAICompletion, which causes instance creation to fail. There are no current unit tests or integration tests that verified this. In this PR, I am fixing this problem and adding unit test to validate this. I am also cleaning unit test and OpenAIPrompt class.

What changes are proposed in this pull request?

In this PR I am:

  1. Ensuring that new prompt instances are created for each test. This will eliminate chance of one test interfering with another test.
  2. Creating test to validate that for older model deployments, OpenAiCompletion instance is created in OpenAIPrompt class.
  3. Fixing the bug that caused creation of OpenAICompletion object to fail.
  4. Cleaning some code in OpenAIPrompt class.

How is this patch tested?

  • I have written tests (not required for typo or doc fix) and confirmed the proposed feature/bug-fix/change works.

Does this PR change any dependencies?

  • No. You can skip this section.
  • Yes. Make sure the dependencies are resolved correctly, and list changes here.

Does this PR add a new feature? If so, have you added samples on website?

  • No. You can skip this section.
  • Yes. Make sure you have added samples following below steps.

1. Ensuring that new prompt instances are created for each test. This will eliminate chance of one test interfering with another test.
2. Creating test to validate that for older model deployments, OpenAiCompletion instance is created in OpenAIPrompt class.
3. Fixing the bug that caused creation of OpenAICompletion object to fail.
4. Cleaning some code in OpenAIPrompt class.
@FarrukhMasud
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 12.94%. Comparing base (4a6a041) to head (a22204f).

Files with missing lines Patch % Lines
...zure/synapse/ml/services/openai/OpenAIPrompt.scala 0.00% 5 Missing ⚠️
...soft/azure/synapse/ml/services/openai/OpenAI.scala 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (4a6a041) and HEAD (a22204f). Click for more details.

HEAD has 145 uploads less than BASE
Flag BASE (4a6a041) HEAD (a22204f)
151 6
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2319       +/-   ##
===========================================
- Coverage   83.21%   12.94%   -70.27%     
===========================================
  Files         328      328               
  Lines       16786    16786               
  Branches     1501     1511       +10     
===========================================
- Hits        13968     2173    -11795     
- Misses       2818    14613    +11795     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FarrukhMasud
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FarrukhMasud
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FarrukhMasud
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@FarrukhMasud
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@FarrukhMasud
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mhamilton723
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mhamilton723
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants