File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717# Step2. Configure the OpenAI API Key
1818import os
1919
20- os .environ ["OPENAI_API_KEY" ] = "Your-OpenAI-API-Key"
20+ # os.environ["OPENAI_API_KEY"] = "Your-OpenAI-API-Key"
2121epsilla_api_key = os .getenv ("EPSILLA_API_KEY" , "Your-Epsilla-API-Key" )
2222project_id = os .getenv ("EPSILLA_PROJECT_ID" , "Your-Project-ID" )
2323db_id = os .getenv ("EPSILLA_DB_ID" , "Your-DB-ID" )
2929from langchain .text_splitter import CharacterTextSplitter
3030from langchain_openai import OpenAIEmbeddings
3131
32- loader = WebBaseLoader ("https://raw.githubusercontent.com/hwchase17/chat-your-data/master/state_of_the_union.txt" )
32+ loader = WebBaseLoader (
33+ "https://raw.githubusercontent.com/hwchase17/chat-your-data/master/state_of_the_union.txt"
34+ )
3335documents = loader .load ()
34- documents = CharacterTextSplitter (chunk_size = 1000 , chunk_overlap = 0 ).split_documents (documents )
36+ documents = CharacterTextSplitter (chunk_size = 1000 , chunk_overlap = 0 ).split_documents (
37+ documents
38+ )
3539embeddings = OpenAIEmbeddings ()
3640
3741
6165 collection_name = table_name ,
6266)
6367
68+ # query = "What did the president say about Ketanji Brown Jackson"
69+ # docs = vector_store.similarity_search(query)
70+ # print(docs[0].page_content)
71+
72+
73+
6474# Step4. Create the QA for Retrieval
6575from langchain .chains import RetrievalQA
6676from langchain_openai import OpenAI
You can’t perform that action at this time.
0 commit comments