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

Refactor the listener to implement a decorator around openai.Completion.create #47

Merged
merged 6 commits into from
Sep 5, 2023

Conversation

Lerri-Cofannos
Copy link
Collaborator

No description provided.

@Lerri-Cofannos Lerri-Cofannos force-pushed the refactor/decorator-listener branch 2 times, most recently from ad1d504 to 866cfae Compare August 30, 2023 14:18


def start_openai_listener():
openai.Completion = CustomCompletion
Copy link
Collaborator

Choose a reason for hiding this comment

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

that's really neat! monkey patching 🐵

Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the Completion API has been marked as legacy now. Should we be patching the ChatCompletions API instead?

Copy link
Collaborator Author

@Lerri-Cofannos Lerri-Cofannos Sep 5, 2023

Choose a reason for hiding this comment

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

Upgrading to ChatCompletion is a refactor that would need its own ticket I believe
https://trello.com/c/rkkADWMv

Copy link
Collaborator

Choose a reason for hiding this comment

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

Was the usage of the Completion API intentional? Was there a reason it was implemented over other APIs?

I agree about the ticket!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Using Completion is a legacy from the PoC... I don't think it was intentional (@juskek?)

Copy link
Collaborator

Choose a reason for hiding this comment

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

It was not intentional, just took the example off the OpenAI docs

@Lerri-Cofannos Lerri-Cofannos marked this pull request as ready for review September 5, 2023 11:04
Copy link
Collaborator

Choose a reason for hiding this comment

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

I did not catch this earlier, but is there any reason we are using relative imports instead of absolute?

iirc relative imports are highly discouraged

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

On my device absolute imports are calling the published module instead of my dev folder...

```sh
pyenv install 3.11.3
poetry env use 3.11.3
poetry install
```

2. Generate prisma types
Copy link
Collaborator

Choose a reason for hiding this comment

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

thanks!

@JonnyTizz
Copy link
Collaborator

The ticket mentions a test to delete - does that need to be done?

@Lerri-Cofannos Lerri-Cofannos merged commit 387adf1 into main Sep 5, 2023
1 check passed
@Lerri-Cofannos Lerri-Cofannos deleted the refactor/decorator-listener branch September 5, 2023 13:26
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.

3 participants