Spaces:
Build error
Build error
Update app.py
Browse files21 unmodified lines2223242526272816 unmodified lines454647484950110 unmodified lines16116216316416516616713 unmodified lines18118218318418518618718818921 unmodified lines# Load environment variablesload_dotenv()GROQ_API_KEY=os.getenv("GROQ_API_KEY")print(GROQ_API_KEY)llm = ChatGroq(model="llama-3.1-70b-versatile")PROMPT_TEMPLATE = """16 unmodified linesBegin extraction."""def get_llm_response(entity, query):# Format the prompt with the entity and queryformatted_prompt = PROMPT_TEMPLATE.format(entity=entity, query=query)110 unmodified linesif st.button("Extract Information"):if entity and query:response_text = get_llm_response(entity, query)st.write(reponse_text)# Extract Information Section with Progress Barelif selected == "Extract Information":13 unmodified linesuser_message = st.session_state["query_template"].replace("{company}", str(entity))formatted_prompt = PROMPT_TEMPLATE.format(entity=entity, query=user_message)# Append user message to the flow historyst.session_state.flowmessages.append(HumanMessage(content=user_message))# Generate response from the modelresponse = llm([SystemMessage(content=formatted_prompt)])21 unmodified lines22232425262716 unmodified lines44454647484950515253110 unmodified lines16416516616716816917013 unmodified lines18418518618718818921 unmodified lines# Load environment variablesload_dotenv()GROQ_API_KEY=os.getenv("GROQ_API_KEY")llm = ChatGroq(model="llama-3.1-70b-versatile")PROMPT_TEMPLATE = """16 unmodified linesBegin extraction."""def get_llm_response(entity, query):# Ensure entity and query are not Noneentity = entity or "Unknown Entity"query = query or "Information not provided"# Format the prompt with the entity and queryformatted_prompt = PROMPT_TEMPLATE.format(entity=entity, query=query)110 unmodified linesif st.button("Extract Information"):if entity and query:response_text = get_llm_response(entity, query)st.write(response_text)# Extract Information Section with Progress Barelif selected == "Extract Information":13 unmodified linesuser_message = st.session_state["query_template"].replace("{company}", str(entity))formatted_prompt = PROMPT_TEMPLATE.format(entity=entity, query=user_message)# Generate response from the modelresponse = llm([SystemMessage(content=formatted_prompt)])
app.py+5-5