#hieq

1 messages · Page 1 of 1 (latest)

mortal gust
#

How do i call an assistant

wraith haloBOT
#

Hi @mortal gust. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet. You might find the Assistants API documentation helpful for more information on how to interact with an assistant.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@mortal gust Kapa.ai is still learning and improving, please let me know how I did by reacting below.

mortal gust
#

@wraith halo how do i call a funciton with the assistants api

wraith haloBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

To call a function with the Assistants API, you can define custom functions that the assistant can call during a run. Here's a general approach based on the information available:

  1. Define the Function: You need to specify the function you want the assistant to call. This involves defining the function's name, description, and parameters in a JSON format. For example:

    {
        "name": "display_quiz",
        "description": "Displays a quiz to the student, and returns the student's response. A single quiz can have multiple questions.",
        "parameters": {
            "type": "object",
            "properties": {
                "title": {"type": "string"},
                "questions": {
                    "type": "array",
                    "description": "An array of questions, each with a title and potentially options (if multiple choice).",
                    "items": {
                        "type": "object",
                        "properties": {
                            "question_text": {"type": "string"},
                            "question_type": {
                                "type": "string",
                                "enum": ["MULTIPLE_CHOICE", "FREE_RESPONSE"]
                            },
                            "choices": {"type": "array", "items": {"type": "string"}}
                        },
                        "required": ["question_text"]
                    }
                }
            },
            "required": ["title", "questions"]
        }
    }
    
  2. Update the Assistant: You can update your assistant with this function definition either through the Dashboard or the API.

#
  1. Call the Function: During a run, the assistant can indicate it wants to call one or more functions you specified. You are responsible for executing the function and providing the output back to the assistant.

For more detailed guidance, you can refer to the Assistants API tools documentation and the Function Calling guide.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: