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

How can I enable code-interpreter? #398

Open
y-rokutan opened this issue Jan 15, 2024 · 0 comments
Open

How can I enable code-interpreter? #398

y-rokutan opened this issue Jan 15, 2024 · 0 comments

Comments

@y-rokutan
Copy link

Summary

I would like to add code interpreter feature, but I don't know how to set such option.

Motivation

The current ChatGPT (official web version) has a code interpreter. I want to add option to enable it on this repository, but I'm not familier with node.js. If someone knows how to add such code, please help me to enable it.

Official Documentation

According to the document below, I need to set tools option to the model initialization.
https://platform.openai.com/docs/assistants/tools/enabling-code-interpreter

  • Node.js
    const assistant = await openai.beta.assistants.create({
      instructions: "You are a personal math tutor. When asked a math question, write and run code to answer the question.",
      model: "gpt-4-1106-preview",
      tools: [{"type": "code_interpreter"}]
    });
    
  • Curl
    curl https://api.openai.com/v1/assistants \
      -u :$OPENAI_API_KEY \
      -H 'Content-Type: application/json' \
      -H 'OpenAI-Beta: assistants=v1' \
      -d '{
        "instructions": "You are a personal math tutor. When asked a math question, write and run code to answer the question.",
        "tools": [
          { "type": "code_interpreter" }
        ],
        "model": "gpt-4-1106-preview"
      }'
    

Problem and What I Tried

I tried to find where the model / assistant initialized as below, but could not find where to add / test codes.
I am grateful for any kind of answer.

  • Added tools?: [{"type": "code_interpreter"}] to the src/lib/providers/openai/models.svelte
  • Added tools?: Array<Record<string, string>>; to the Request of src/lib/Types.svelte

Thank you for reading this question / feature request. I believe it would significantly enhance the capabilities and applications of this app.

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

1 participant