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
Copy file name to clipboardExpand all lines: README.md
+16-2Lines changed: 16 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,12 @@
1
1
# OpenAI Function Calling example in Node.js
2
+
2
3
This repository contains a basic Node.js example demonstrating how to call functions using the OpenAI API. The example showcases a conversation with the OpenAI GPT-3.5 Turbo model, including making function calls and processing their responses.
3
4
5
+
## Whats New?
6
+
7
+
- Uses `tools` and `tool_choice`
8
+
- Supports parallel function calling
9
+
4
10
## Getting Started
5
11
6
12
**Dependencies**: This project has no external dependencies, making it lightweight and easy to set up. You can run this example with just Node.js. However, if you have a preferred library or tool for making HTTP requests, feel free to integrate it as needed to enhance the functionality or suit your specific requirements.
@@ -15,18 +21,26 @@ To get started with this example:
15
21
16
22
2. Obtain an API key from <ahref="https://platform.openai.com/account/api-keys">OpenAI</a>
17
23
18
-
3. Replace ```Bearer sk-xxxxxxxxx``` in the code with your API key.
24
+
3. Replace `Bearer sk-xxxxxxxxx` in the code with your API key.
19
25
20
-
4. Run the example:
26
+
### Parallel Function calling (Uses tools and tool_choice):
21
27
22
28
```shell
23
29
node index.js
24
30
```
25
31
32
+
### Single Function call (Deprecated) (Uses function_call and functions):
33
+
34
+
```shell
35
+
node index[Deprecated].js
36
+
```
37
+
26
38
5. Customise the functions and conversation as needed. In this example, a simple weather-related function is included, but you can add more functions to suit your use case.
27
39
28
40
## Usage
41
+
29
42
This repository serves as a starting point for understanding how to integrate function calls into your conversational AI system using the OpenAI GPT-3.5 Turbo model. You can extend the example by adding more functions, handling different types of requests, and tailoring it to your specific application.
30
43
31
44
## License
45
+
32
46
This project is licensed under the MIT License - see the LICENSE file for details.
0 commit comments