File size: 2,390 Bytes
3aa66c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5eaa060
3aa66c5
aa75b87
3aa66c5
 
66b4d60
3aa66c5
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import gradio as gr
import os 
from langchain_core.prompts import ChatPromptTemplate
from langchain_groq import ChatGroq
from langchain_core.prompts import FewShotChatMessagePromptTemplate
from 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, history):
    answer = chain.invoke(text)
    return answer.content

gr.ChatInterface(
    response, 
    type="messages"
).launch()