import os # Initialize with fake api key if 'OPENAI_API_KEY' not in os.environ: os.environ['OPENAI_API_KEY'] = 'sk-' import pandas as pd import requests import streamlit as st from IPython.core.display import HTML from langchain.agents import AgentType, initialize_agent, load_tools from langchain.chat_models import ChatOpenAI from PIL import Image from rmrkl import ChatZeroShotAgent, RetryAgentExecutor from chemcrow.agents import ChemCrow from chemcrow.agents.prompts import (FORMAT_INSTRUCTIONS, QUESTION_PROMPT, SUFFIX) from chemcrow.frontend.streamlit_callback_handler import \ StreamlitCallbackHandlerChem from langchain.callbacks import StreamlitCallbackHandler from chemcrow.frontend.utils import cdk from dotenv import load_dotenv load_dotenv() ss = st.session_state agent = ChemCrow( #tools, model='gpt-4', temp=0.1, ).agent_executor #tool_list = pd.Series( # {f"✅ {t.name}":t.description for t in tools} #).reset_index() #tool_list.columns = ['Tool', 'Description'] icon = Image.open('assets/logo0.png') st.set_page_config( page_title="ChemCrow", page_icon = icon ) # Set width of sidebar st.markdown( """