Open AI tutorial
https://platform.openai.com/api-keys
https://platform.openai.com/docs/libraries
Install open AI
jupyter labjupyter server listpip install openaiColab
Load env file
import os
from dotenv
import load_dotenvload_dotenv()MY_ENV_VAR = os.getenv('MY_ENV_VAR').env file
MY_ENV_VAR="This is my env var content."Set openAI key
openai.api_key = keyModel of Chat GPT


Famous model is gpt-3.5-turbo
Error code: 429 - {'error': {'message':
'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}https://platform.openai.com/account/limits





First promp API send to Chat GPT
First, increase the balance in Chatgpt.
pip install openaifrom openai
import OpenAI
import oskey = "sk-Fh ..."prompt = 'what is the capital of USA?'client = OpenAI(
api_key = key)chat_completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": prompt}])print(chat_completion)ChatCompletion(id='chatcmpl-9aYk3coc90XEJ5NrPNhFQAZZW0uJe', choices=[Choice(finish_reason='stop',
index=0, logprobs=None,
message=ChatCompletionMessage(content='The capital of the United States of America is Washington, D.C.', role='assistant', function_call=None, tool_calls=None))], created=1705392343, model='gpt-3.5-turbo-0613', object='chat.completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=14, prompt_tokens=14, total_tokens=28))How you can have your own ChatGPT chatbot?
List of AI assistant
https://newsletter.theresanaiforthat.com/
Q&A with RAG
One of the most powerful applications enabled by LLMs is sophisticated question-answering (Q&A) chatbots. These are applications that can answer questions about specific source information. These applications use a technique known as Retrieval Augmented Generation, or RAG.
LLMs can reason about wide-ranging topics, but their knowledge is limited to the public data up to a specific point in time that they were trained on. If you want to build AI applications that can reason about private data or data introduced after a model’s cutoff date, you need to augment the knowledge of the model with the specific information it needs. The process of bringing the appropriate information and inserting it into the model prompt is known as Retrieval Augmented Generation (RAG).

Conversing with LLMs is a great way to demonstrate their capabilities. Adding chat history and external context can exponentially increase the complexity of the conversation. In this example, we’ll show how to use Runnables to construct a conversational QA system that can answer questions, remember previous chats, and utilize external context.
The first step is to load our context (in this example we’ll use the State Of The Union speech from 2022). This is also a good place to instantiate our retriever, and memory classes.
Python quick start
RAG retrieval augmented generation
https://www.youtube.com/watch?v=tcqEUSNCn8I
- prepare your data
- load your data into python
- make chunk of data
- using chroma database to store data
- store data in sqlite

Private GPT
LLM


Pinecone vector database is a vector-based database that offers high-performance search and similarity matching. It can deal with high-dimensional vector data at a higher scale, easy integration, and faster query results.
pinecone.io
Visit us at DataDrivenInvestor.com
Subscribe to DDIntel here.
Have a unique story to share? Submit to DDIntel here.
Join our creator ecosystem here.
DDIntel captures the more notable pieces from our main site and our popular DDI Medium publication. Check us out for more insightful work from our community.
DDI Official Telegram Channel: https://t.me/+tafUp6ecEys4YjQ1
