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

Implements Chat API #4

Closed
jcs090218 opened this issue Mar 4, 2023 · 1 comment
Closed

Implements Chat API #4

jcs090218 opened this issue Mar 4, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@jcs090218
Copy link
Member

OpenAI has recently released their ChatGPT to beta, implement the https://platform.openai.com/docs/api-reference/chat is the next step.

@jcs090218 jcs090218 pinned this issue Mar 4, 2023
@jcs090218 jcs090218 added the enhancement New feature or request label Mar 4, 2023
@jcs090218
Copy link
Member Author

I've implemented ChatGPT in #8, this is how you use it.

(openai-chat '[(("role" . "user")
                ("content" . "Hello!"))]
             (lambda (data)
               (message "%s" data))
             :max-tokens 4000
             :temperature 1.0)

Result:

((id . chatcmpl-6vEGtmoH7VR74Uh73p1DPwoiIFKyZ) (object . chat.completion) (created . 1679097575) (model . gpt-3.5-turbo-0301) (usage (prompt_tokens . 9) (completion_tokens . 10) (total_tokens . 19)) (choices . [((message (role . assistant) (content . 

Hello! How can I assist you today?)) (finish_reason . stop) (index . 0))]))

To play with it, use M-x openai-chat-say.

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

No branches or pull requests

1 participant