Spaces:
Runtime error
Runtime error
Delete chatgpt_reufit.py
Browse files- chatgpt_reufit.py +0 -26
chatgpt_reufit.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import openai
|
| 5 |
-
from langchain_community.chains import ConversationalRetrievalChain, RetrievalQA
|
| 6 |
-
from langchain_community.chat_models import ChatOpenAI
|
| 7 |
-
from langchain_community.document_loaders import DirectoryLoader, TextLoader
|
| 8 |
-
from langchain_community.embeddings import OpenAIEmbeddings
|
| 9 |
-
from langchain_community.indexes import VectorstoreIndexCreator
|
| 10 |
-
from langchain_community.indexes.vectorstore import VectorStoreIndexWrapper
|
| 11 |
-
from langchain_community.llms import OpenAI
|
| 12 |
-
from langchain_community.vectorstores import Chroma
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
os.environ["OPENAI_API_KEY"] = "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"
|
| 17 |
-
|
| 18 |
-
if len(sys.argv) > 1:
|
| 19 |
-
query = sys.argv[1]
|
| 20 |
-
|
| 21 |
-
#loader = TextLoader("data/data.txt") # Use this line if you only need data.txt
|
| 22 |
-
loader = DirectoryLoader(".",glob="*.txt")
|
| 23 |
-
index = VectorstoreIndexCreator().from_loaders([loader])
|
| 24 |
-
|
| 25 |
-
llm=ChatOpenAI(model="gpt-3.5-turbo-16k")
|
| 26 |
-
print(index.query(query,llm))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|