Skip to content

I am exploring the possibilities of OpenAI and what we can build with it. This repository has sample scripts or apps that I am using to learn OpenAI and other AI topics.

Notifications You must be signed in to change notification settings

behuber/openai-samples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openai-samples

I am exploring the possibilities of OpenAI and what we can build with it. This repository has sample scripts or apps that I am using to learn OpenAI and other AI topics.

Conversation Bot

This is a sample bot that uses Langchain to construct the prompt template, an LLM chain, and memory to store the history. The sample uses ConversationBufferMemory which allows for storing of messages in memory and then extracts the messages in a variable. Since we utilize a history, the bot is able to remember the messages and respond appropriately. You will type exit to exit the bot and you will have an option to save the entire conversation history.

Here is the demo:

chatbot_langchain_chain_memory.mp4

Question answering over docs

The simple python script uses Langchain, loads a text file, creates indexes (from OpenAI embeddings) and then allows you to ask questions on your document data. For this sample, I am using my Kindle Highlights file which you can find in your Kindle. I am using Chroma storage to persist the embeddings once created.

Here is the demo:

openai_langchain_loadtxtfile.mp4

OpenAI Python Sample

This is beginner sample on how to interact with OpenAI APIs, specifically the Completions API. It builds a simple python chat bot but does not retain or remember conversation history. You will type exit to exit the bot.

The sample was built from scratch using ChatGPT (GPT4). You can view the entire conversation here. This is a good example on how you can use chain of thought prompting so it can help you build great apps.

Here is the demo:

python-openai-chat-sample.mp4

About

I am exploring the possibilities of OpenAI and what we can build with it. This repository has sample scripts or apps that I am using to learn OpenAI and other AI topics.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%