Skip to content

ESP32 Arduino Framework Library to allow connection to OpenAI Chat Completions Endpoint

License

Notifications You must be signed in to change notification settings

holyr00d/ESP32_ChatGPT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32_ChatGPT

Library for the ESP32 and hopefully the new R4 Uno WiFi when it's out (Note: json buffers set to 4096 bytes, so long replys may get truncated)

Please copy config_template.h to config.h and fill in your personal keys and certificates, this file in on the .gitignore list so it will be kept private from repo pushess.

You'll need a root cert from https://api.openai.com inserting into the config.h To obtain the root CA certificate, you can follow these steps:

  1. Visit the OpenAI API using your browser: https://api.openai.com
  2. Click on the padlock icon in the address bar.

image

image

image

  1. Go to the "Details" tab.
  2. Click on the top certificate in the hierarchy (typically "Baltimore Root CA" or similar)
  3. Export or Save to File.

image

Once you have the root CA certificate, open the exported file with a text editor and copy the content between -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----.

Please note that this simple example code uses SSL communication to ensure privacy, it does not perform any API_KEY obfuscation on the source code itself. While this may be acceptable for personal projects on your own hardware, more robust authentication methods should be employed for commercial ventures.

This was built using PatformIO using ESP32 DEVKIT and only needs the ArduinoJson libary adding to build

There are two demos to chosoe from (use the enviroment selector in VSCode to choose)

For CLI

Connecting to Wi-Fi...
Connected to Wi-Fi
Current time: Wed Apr 12 22:12:47 2023
Please type your question below:
Hi what's it like in there?
I'm an AI language model, so I don't have the ability to experience things like humans do. However, I am here to assist you in any way I can with tasks and answering questions. Is there anything specific that you need help with today?
what is an apple?
An apple is a round, edible fruit that comes in a variety of colors, such as green, red, and yellow. It is a good source of dietary fiber and vitamin C, and is often eaten raw as a healthy snack or used in various recipes, such as pies and sauces.

For Web

image

About

ESP32 Arduino Framework Library to allow connection to OpenAI Chat Completions Endpoint

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 97.4%
  • C 2.6%