Spaces:
Build error
Build error
Update variables.py
Browse files- variables.py +3 -1
variables.py
CHANGED
@@ -7,6 +7,8 @@ import pathlib
|
|
7 |
from langchain.embeddings import HuggingFaceEmbeddings,HuggingFaceInstructEmbeddings
|
8 |
from langchain.vectorstores import FAISS
|
9 |
from langchain.chat_models.openai import ChatOpenAI
|
|
|
|
|
10 |
from langchain import VectorDBQA
|
11 |
import pandas as pd
|
12 |
|
@@ -91,7 +93,7 @@ def create_vectorstore(texts,model):
|
|
91 |
def embed_tweets(query,_prompt,_docsearch):
|
92 |
'''Process file with latest tweets'''
|
93 |
|
94 |
-
|
95 |
chain_type_kwargs = {"prompt": _prompt}
|
96 |
chain = VectorDBQA.from_chain_type(
|
97 |
ChatOpenAI(temperature=0),
|
|
|
7 |
from langchain.embeddings import HuggingFaceEmbeddings,HuggingFaceInstructEmbeddings
|
8 |
from langchain.vectorstores import FAISS
|
9 |
from langchain.chat_models.openai import ChatOpenAI
|
10 |
+
from langchain.callbacks.base import CallbackManager
|
11 |
+
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
12 |
from langchain import VectorDBQA
|
13 |
import pandas as pd
|
14 |
|
|
|
93 |
def embed_tweets(query,_prompt,_docsearch):
|
94 |
'''Process file with latest tweets'''
|
95 |
|
96 |
+
streaming_llm = ChatOpenAI(streaming=True, callback_manager=CallbackManager([StreamingStdOutCallbackHandler()]), verbose=True, temperature=0)
|
97 |
chain_type_kwargs = {"prompt": _prompt}
|
98 |
chain = VectorDBQA.from_chain_type(
|
99 |
ChatOpenAI(temperature=0),
|