Spaces:
Sleeping
Sleeping
def run(query): | |
from langchain.callbacks import get_openai_callback | |
with get_openai_callback() as cb: | |
response = (agent.run(query)) | |
costs = (f"Total Cost (USD): ${cb.total_cost}") | |
output = f'{response} \n {costs}' | |
return output | |
def respond(message, chat_history): | |
import time | |
bot_message = run(message) | |
chat_history.append((message, bot_message)) | |
time.sleep(0.5) | |
return "", chat_history |