Spaces:
Sleeping
Sleeping
Chandranshu Jain
commited on
Commit
•
b22eabf
1
Parent(s):
b859b8f
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
# Q&A Chatbot
|
2 |
from langchain_openai import OpenAI
|
3 |
-
|
4 |
from dotenv import load_dotenv
|
5 |
|
6 |
load_dotenv() # take environment variables from .env.
|
@@ -16,7 +16,8 @@ from langchain.chains import SequentialChain
|
|
16 |
## Function to load OpenAI model and get respones
|
17 |
|
18 |
def get_openai_response(country_name):
|
19 |
-
llm=
|
|
|
20 |
capital_template=PromptTemplate(input_variables=['country'],
|
21 |
template="Please tell me the capital of the {country}")
|
22 |
capital_chain=LLMChain(llm=llm,prompt=capital_template,output_key="capital")
|
|
|
1 |
# Q&A Chatbot
|
2 |
from langchain_openai import OpenAI
|
3 |
+
from langchain_google_genai import GoogleGenerativeAI
|
4 |
from dotenv import load_dotenv
|
5 |
|
6 |
load_dotenv() # take environment variables from .env.
|
|
|
16 |
## Function to load OpenAI model and get respones
|
17 |
|
18 |
def get_openai_response(country_name):
|
19 |
+
llm = GoogleGenerativeAI(model="models/text-bison-001", google_api_key=os.environ["GOOGLE_API_KEY"])
|
20 |
+
#llm=OpenAI(openai_api_key=os.environ["OPEN_API_KEY"],temperature=0.5)
|
21 |
capital_template=PromptTemplate(input_variables=['country'],
|
22 |
template="Please tell me the capital of the {country}")
|
23 |
capital_chain=LLMChain(llm=llm,prompt=capital_template,output_key="capital")
|