Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ import contextlib # for redirect_stdout
|
|
| 13 |
import tldextract
|
| 14 |
from langchain.prompts import PromptTemplate
|
| 15 |
from langchain.chains import LLMChain
|
| 16 |
-
from
|
| 17 |
import requests
|
| 18 |
import streamlit as st
|
| 19 |
import pandas as pd
|
|
@@ -67,7 +67,6 @@ API_ENDPOINT = "https://api2.woorank.com/reviews"
|
|
| 67 |
API_KEY = os.environ.get("woorank_api_key")
|
| 68 |
openai_api_key = os.environ.get("openai_api_key")
|
| 69 |
|
| 70 |
-
|
| 71 |
if not API_KEY:
|
| 72 |
st.error("The API keys are not properly configured. Check your environment variables!")
|
| 73 |
elif not openai_api_key:
|
|
@@ -89,7 +88,7 @@ else:
|
|
| 89 |
YOU ARE WRITING THE REPORT IN HTML USING A TEMPLATE.'''}]
|
| 90 |
|
| 91 |
|
| 92 |
-
llm =
|
| 93 |
|
| 94 |
# Create the prompt template and the run statement when there are NOT issues
|
| 95 |
if not _issues and len(_items) > 0:
|
|
|
|
| 13 |
import tldextract
|
| 14 |
from langchain.prompts import PromptTemplate
|
| 15 |
from langchain.chains import LLMChain
|
| 16 |
+
from langchain_openai import ChatOpenAI
|
| 17 |
import requests
|
| 18 |
import streamlit as st
|
| 19 |
import pandas as pd
|
|
|
|
| 67 |
API_KEY = os.environ.get("woorank_api_key")
|
| 68 |
openai_api_key = os.environ.get("openai_api_key")
|
| 69 |
|
|
|
|
| 70 |
if not API_KEY:
|
| 71 |
st.error("The API keys are not properly configured. Check your environment variables!")
|
| 72 |
elif not openai_api_key:
|
|
|
|
| 88 |
YOU ARE WRITING THE REPORT IN HTML USING A TEMPLATE.'''}]
|
| 89 |
|
| 90 |
|
| 91 |
+
llm = ChatOpenAI(model_name="gpt-4o-mini", temperature=0, prefix_messages=prefix_messages, openai_api_key=openai_api_key)
|
| 92 |
|
| 93 |
# Create the prompt template and the run statement when there are NOT issues
|
| 94 |
if not _issues and len(_items) > 0:
|