Update app.py
Browse files
app.py
CHANGED
|
@@ -5,10 +5,12 @@ from langchain_core.output_parsers import StrOutputParser
|
|
| 5 |
from langchain_core.prompts import ChatPromptTemplate
|
| 6 |
from langchain_core.runnables import RunnablePassthrough
|
| 7 |
from langchain_groq import ChatGroq
|
|
|
|
| 8 |
from langchain_huggingface import HuggingFaceEmbeddings
|
| 9 |
|
| 10 |
|
| 11 |
# Set API keys
|
|
|
|
| 12 |
groq_api_key=os.environ["GROQ_API_KEY"]
|
| 13 |
|
| 14 |
# Define Redis configuration
|
|
@@ -25,8 +27,8 @@ config = RedisConfig(
|
|
| 25 |
)
|
| 26 |
|
| 27 |
|
| 28 |
-
# Initialize
|
| 29 |
-
embeddings =
|
| 30 |
|
| 31 |
# Initialize Redis Vector Store with Hugging Face embeddings
|
| 32 |
vector_store = RedisVectorStore(embeddings, config=config)
|
|
|
|
| 5 |
from langchain_core.prompts import ChatPromptTemplate
|
| 6 |
from langchain_core.runnables import RunnablePassthrough
|
| 7 |
from langchain_groq import ChatGroq
|
| 8 |
+
from langchain.embeddings.openai import OpenAIEmbeddings
|
| 9 |
from langchain_huggingface import HuggingFaceEmbeddings
|
| 10 |
|
| 11 |
|
| 12 |
# Set API keys
|
| 13 |
+
openai_api_key=os.environ["OPENAI_API_KEY"]
|
| 14 |
groq_api_key=os.environ["GROQ_API_KEY"]
|
| 15 |
|
| 16 |
# Define Redis configuration
|
|
|
|
| 27 |
)
|
| 28 |
|
| 29 |
|
| 30 |
+
# Initialize OpenAI Embeddings
|
| 31 |
+
embeddings = OpenAIEmbeddings(api_key=os.environ['OPENAI_API_KEY'])
|
| 32 |
|
| 33 |
# Initialize Redis Vector Store with Hugging Face embeddings
|
| 34 |
vector_store = RedisVectorStore(embeddings, config=config)
|