angelesteban00 commited on
Commit
42c08ad
1 Parent(s): 8b0f111
Files changed (3) hide show
  1. app.py +3 -3
  2. app_old.py +0 -7
  3. requirements.txt +1 -0
app.py CHANGED
@@ -1,6 +1,6 @@
1
  from pymongo import MongoClient
2
  # error since Jan 2024, from langchain.embeddings.openai import OpenAIEmbeddings
3
- from langchain_community.embeddings import OpenAIEmbeddings
4
  # error since Jan 2024, from langchain.vectorstores import MongoDBAtlasVectorSearch
5
  from langchain_community.vectorstores import MongoDBAtlasVectorSearch
6
  # error since Jan 2024, from langchain.document_loaders import DirectoryLoader
@@ -14,8 +14,8 @@ from gradio.themes.base import Base
14
  import os
15
 
16
  def query_data(query,openai_api_key,mongo_uri):
17
- #openai_api_key = os.getenv("OPENAI_API_KEY")
18
- #mongo_uri = os.getenv("MONGO_URI")
19
 
20
  client = MongoClient(mongo_uri)
21
  dbName = "langchain_demo"
 
1
  from pymongo import MongoClient
2
  # error since Jan 2024, from langchain.embeddings.openai import OpenAIEmbeddings
3
+ from langchain_openai import OpenAIEmbeddings
4
  # error since Jan 2024, from langchain.vectorstores import MongoDBAtlasVectorSearch
5
  from langchain_community.vectorstores import MongoDBAtlasVectorSearch
6
  # error since Jan 2024, from langchain.document_loaders import DirectoryLoader
 
14
  import os
15
 
16
  def query_data(query,openai_api_key,mongo_uri):
17
+ os.environ["OPENAI_API_KEY"] = openai_api_key
18
+ os.environ["MONGO_URI"] = mongo_uri
19
 
20
  client = MongoClient(mongo_uri)
21
  dbName = "langchain_demo"
app_old.py DELETED
@@ -1,7 +0,0 @@
1
- import gradio as gr
2
-
3
- def greet(name):
4
- return "Hola " + name + "!!"
5
-
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,5 +1,6 @@
1
  langchain
2
  langchain-community
 
3
  pymongo[srv]==4.1.1
4
  bs4
5
  openai
 
1
  langchain
2
  langchain-community
3
+ langchain-openai
4
  pymongo[srv]==4.1.1
5
  bs4
6
  openai