You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This guide provides a comprehensive walkthrough on integrating Vapi with OpenAI's gpt-3.5-turbo-instruct model using a custom LLM configuration. We'll leverage Ngrok to expose a local development environment for testing and demonstrate the communication flow between Vapi and your LLM.
7
+
This guide provides a comprehensive walkthrough on integrating Vapi with OpenAI's gpt-4.1-mini model using a custom LLM configuration. We'll leverage Ngrok to expose a local development environment for testing and demonstrate the communication flow between Vapi and your LLM.
8
8
## Prerequisites
9
9
10
10
-**Vapi Account**: Access to the Vapi Dashboard for configuration.
11
-
-**OpenAI API Key**: With access to the gpt-3.5-turbo-instruct model.
11
+
-**OpenAI API Key**: With access to the gpt-4.1-mini model.
12
12
-**Python Environment**: Set up with the OpenAI library (`pip install openai`).
13
13
-**Ngrok**: For exposing your local server to the internet.
14
14
-**Code Reference**: Familiarize yourself with the `/openai-sse/chat/completions` endpoint function in the provided Github repository: [Server-Side Example Python Flask](https://github.com/VapiAI/server-side-example-python-flask/blob/main/app/api/custom_llm.py).
@@ -31,7 +31,7 @@ def chat_completions():
31
31
# ...
32
32
33
33
response = openai.ChatCompletion.create(
34
-
model="gpt-3.5-turbo-instruct",
34
+
model="gpt-4.1-mini",
35
35
messages=[
36
36
{"role": "system", "content": "You are a helpful assistant."},
37
37
# ... (Add messages from conversation history and current prompt)
@@ -111,7 +111,7 @@ Your Python script receives the POST request and the chat_completions function i
111
111
The script parses the JSON data, extracts relevant information (prompt, conversation history), and builds the prompt for the OpenAI API call.
112
112
113
113
**4. Call to OpenAI API:**
114
-
The constructed prompt is sent to the gpt-3.5-turbo-instruct model using the openai.ChatCompletion.create method.
114
+
The constructed prompt is sent to the gpt-4.1-mini model using the openai.ChatCompletion.create method.
115
115
116
116
**5. Receive and Format Response:**
117
117
The response from OpenAI, containing the generated text, is received and formatted according to Vapi's expected structure.
@@ -122,7 +122,7 @@ The formatted response is sent back to Vapi as a JSON object.
122
122
**7. Vapi Displays Response:**
123
123
Vapi receives the response and displays the generated text within the conversation interface to the user.
124
124
125
-
By following these detailed steps and understanding the communication flow, you can successfully connect Vapi to OpenAI's gpt-3.5-turbo-instruct model and create powerful conversational experiences within your Vapi applications. The provided code example and reference serve as a starting point for you to build and customize your integration based on your specific needs.
125
+
By following these detailed steps and understanding the communication flow, you can successfully connect Vapi to OpenAI's gpt-4.1-mini model and create powerful conversational experiences within your Vapi applications. The provided code example and reference serve as a starting point for you to build and customize your integration based on your specific needs.
Now we're going to set the "brains" of the assistant, the large language model. We're going to be using `GPT-4` (from [OpenAI](https://openai.com/)) for this demo (though you're free to use `GPT-3.5`, or any one of your favorite LLMs).
54
+
Now we're going to set the "brains" of the assistant, the large language model. We're going to be using `GPT-4` (from [OpenAI](https://openai.com/)) for this demo (though you're free to use `GPT-4.1-mini`, or any one of your favorite LLMs).
55
55
56
56
<AccordionGroup>
57
57
<Accordiontitle="Set Your OpenAI Provider Key (optional)"icon="key"iconType="solid">
0 commit comments