Spaces:
Build error
Build error
Create app.py
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import gradio as grimport os from langchain_core.prompts import ChatPromptTemplatefrom langchain_groq import ChatGroqfrom langchain_core.prompts import FewShotChatMessagePromptTemplatefrom dotenv import load_dotenv
load_dotenv()api_key = os.getenv("GROQ_API_KEY")
example_prompt = ChatPromptTemplate.from_messages( [ ("human", "{input}"), ("ai", "{output}"), ])
chat = ChatGroq(model = "mixtral-8x7b-32768", api_key = api_key)examples = [ { "input": "What does the eligibility verification agent (EVA) do?", "output": "EVA automates the process of verifying a patient’s eligibility and benefits information in real-time, eliminating manual data entry errors and reducing claim rejections." }, { "input": "What does the claims processing agent (CAM) do?", "output": "CAM streamlines the submission and management of claims, improving accuracy, reducing manual intervention, and accelerating reimbursements." }, { "input": "How does the payment posting agent (PHIL) work?", "output": "PHIL automates the posting of payments to patient accounts, ensuring fast, accurate reconciliation of payments and reducing administrative burden." }, { "input": "Tell me about Hub9 AI's Agents.", "output": "Hub9 AI provides a suite of AI-powered automation agents designed to streamline healthcare processes. These include Eligibility Verification (EVA), Claims Processing (CAM), and Payment Posting (PHIL), among others." }, { "input": "What are the benefits of using Hub9 AI's agents?", "output": "Using Hub9 AI's Agents can significantly reduce administrative costs, improve operational efficiency, and reduce errors in critical processes like claims management and payment posting." }
]
prompt = FewShotChatMessagePromptTemplate( examples=examples, example_prompt = example_prompt,)
final_prompt = ChatPromptTemplate.from_messages( [ ("system", "You have extensive knowledge of Hub9 AI. DO NOT HALLUCINATE."), prompt, ("human", "{input}"), ])
chain = final_prompt | chat
def response(text): answer = chain.invoke(text) return answer
gr.ChatInterface( fn=response, type="messages").launch()app.pyAdded+65