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

feat: add utils to communicate with openai #795

Merged

Conversation

muhammad-ammar
Copy link
Contributor

@muhammad-ammar muhammad-ammar commented Mar 8, 2024

Description: Add utils for ai curation

Ticket: https://2u-internal.atlassian.net/browse/ENT-8317

Post-review

  • Squash commits into discrete sets of changes
  • Ensure that once the changes have been deployed to stage, prod is manually deployed

@muhammad-ammar muhammad-ammar force-pushed the ammar/ai-curation/ai-filtered-subjects-and-keywords branch from d293ed6 to 2650b00 Compare March 8, 2024 12:38

if response_format == 'json':
try:
return simplejson.loads(response_content)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Will refactor this to add a validation to check that if the json response is of expected type? For example, in our case, we expect list

@muhammad-ammar muhammad-ammar force-pushed the ammar/ai-curation/ai-filtered-subjects-and-keywords branch 2 times, most recently from e9690ea to 29d9948 Compare March 8, 2024 13:03
@muhammad-ammar muhammad-ammar force-pushed the ammar/ai-curation/ai-filtered-subjects-and-keywords branch 2 times, most recently from 69ec8d0 to c5167a7 Compare March 11, 2024 09:05
Copy link
Contributor

@saleem-latif saleem-latif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments, once those are addressed 👍🏼

messages,
response
)
raise InvalidJSONResponseError('Invalid JSON response received from chatgpt', dev_message=ex.message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this error message more user friendly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be returned to the frontend, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. We will not send this to frontend.

@muhammad-ammar muhammad-ammar force-pushed the ammar/ai-curation/ai-filtered-subjects-and-keywords branch from 1fac05e to b9be8c5 Compare March 12, 2024 09:59
@muhammad-ammar muhammad-ammar force-pushed the ammar/ai-curation/ai-filtered-subjects-and-keywords branch 3 times, most recently from aa3bea2 to f449ad4 Compare March 13, 2024 07:53
@muhammad-ammar muhammad-ammar force-pushed the ammar/ai-curation/ai-filtered-subjects-and-keywords branch from f449ad4 to 70e7d65 Compare March 13, 2024 08:08
@muhammad-ammar muhammad-ammar merged commit ce1d60e into master Mar 13, 2024
6 checks passed
@muhammad-ammar muhammad-ammar deleted the ammar/ai-curation/ai-filtered-subjects-and-keywords branch March 13, 2024 09:23
irfanuddinahmad pushed a commit that referenced this pull request Jul 24, 2024
…bjects-and-keywords

feat: add utils to communicate with openai
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.

2 participants