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

[Feature] Function calling implementation #3072

Closed
ograycode opened this issue Oct 19, 2023 · 5 comments
Closed

[Feature] Function calling implementation #3072

ograycode opened this issue Oct 19, 2023 · 5 comments

Comments

@ograycode
Copy link
Contributor

I've implemented a way to interact with openai function calling that goes like this:

  1. Functions are attached to the openai api call as described in the documentation.
  2. If a function call is returned, the name and arguments are part of the content displayed in the new assistant chat message.
  3. A "Play" button is displayed in the chat options (in the same area as "retry") if it is a function call.
  4. If the "Play" button is pressed
    • the function is called in the browser and the results appear as a new assistant chat message.
    • the function results are passed as messages to openai for interpretation and displayed as a new assistant chat message

This allows users to implement their own functions to be called, and provides for a pattern to have a server execute the function call in the future.

Let me know if this is a good approach and I can submit a PR in the next couple of days.

This is closely related to #165

@H0llyW00dzZ
Copy link
Contributor

yes go ahead

@Yidadaa
Copy link
Collaborator

Yidadaa commented Oct 20, 2023

I need to point out that I'm doing a huge refactor and the code structure will change dramatically in the near future, please keep an eye on this: #2603

@H0llyW00dzZ
Copy link
Contributor

@Yidadaa may you need refactor this for client app in tauri
https://github.com/Yidadaa/ChatGPT-Next-Web/blob/client/app/api/cors/%5B...path%5D/route.ts#L3C1-L3C1

when used runtime nodejs it can't use another tauri api because keep getting this error Error: Page "/api/cors/[...path]" is missing "generateStaticParams()" so it cannot be used with "output: export" config. when building

@Yidadaa
Copy link
Collaborator

Yidadaa commented Nov 12, 2023

#3217

@Yidadaa Yidadaa closed this as completed Nov 12, 2023
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


#3217

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

No branches or pull requests

4 participants