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

Add OpenAI 1.0 crate #904

Merged
merged 1 commit into from
Oct 2, 2023
Merged

Add OpenAI 1.0 crate #904

merged 1 commit into from
Oct 2, 2023

Conversation

stcarrez
Copy link
Contributor

The library provides an Ada binding to make requests on OpenAI and query GPT-4, GPT-3, DALL.E and other AI models.

@mosteo
Copy link
Member

mosteo commented Oct 2, 2023

Nice! Out of curiosity, does it support getting the answers as they're generated (I think they call it chunked mode)?

@mosteo mosteo merged commit c23beb5 into alire-project:stable-1.2.1 Oct 2, 2023
11 checks passed
@stcarrez
Copy link
Contributor Author

stcarrez commented Oct 2, 2023

Nice! Out of curiosity, does it support getting the answers as they're generated (I think they call it chunked mode)?

In fact no. This could be some improvement. If I'm not wrong, this is based on server-sent-events. It's not supported yet on OpenAPI and I don't know whether it is supported by the AWS client.

@mosteo
Copy link
Member

mosteo commented Oct 3, 2023

I know it's supported by the Python client, but the documentation was really scarce on it. I don't know how it works internally (I was playing with this a while ago):

for chunk in openai.ChatCompletion.create(
            model=model,
            max_tokens=max_answer_tokens,
            messages=messages,
            stream=True
        ):
            token = chunk["choices"][0].get("delta", {}).get("content")
            if token is not None:
                print(token, end='')

So it looks like regular iteration on the client side.

@stcarrez stcarrez deleted the openai branch June 1, 2024 14:02
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