query_bot / app.py
ShynBui's picture
Update app.py
cfcdce8 verified
raw
history blame
1.01 kB
from langchain_community.utilities import SQLDatabase
from langchain_core.callbacks import BaseCallbackHandler
from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union
from uuid import UUID
from langchain_community.agent_toolkits import create_sql_agent
from langchain_openai import ChatOpenAI
from langchain_community.vectorstores import Chroma
from langchain_core.example_selectors import SemanticSimilarityExampleSelector
from langchain_openai import OpenAIEmbeddings
from langchain.agents.agent_toolkits import create_retriever_tool
from langchain_core.output_parsers import JsonOutputParser
import os
from langchain_core.prompts import (
ChatPromptTemplate,
FewShotPromptTemplate,
MessagesPlaceholder,
PromptTemplate,
SystemMessagePromptTemplate,
)
import ast
import re
from utils import query_as_list, get_answer
import gradio as gr
from fewshot import examples
if __name__ == "__main__":
demo = gr.Interface(fn=get_answer, inputs="text", outputs="text")
demo.launch()