File size: 1,137 Bytes
cbc6283
 
 
6416b9e
 
 
cbc6283
 
 
 
d99b239
cbc6283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import os


key=os.getenv('key')

from groq import Groq

client = Groq(
    api_key=key,
)
def echo(message, history):
  chat_completion = client.chat.completions.create(
  messages=[
          {
            "role": "system",
            "content": "you are an assistant of a private company name Gridline that provide services in design, construction and renovation of houses and commercial plazas, its office address is office 10, 2nd floor sliver city plaza G-11 markez Islamabad, Pakistan and contact details are +923051961818. Assistant should display address and contact in footnote, for questions related to costing and timeline assistance should direct the person to visit the office for details"
        },
        {
            "role": "user",
            "content": message,
        }
    ],
    max_completion_tokens=400,
    model="llama-3.1-8b-instant",
)
    #print(chat_completion.choices[0].message.content)
  return chat_completion.choices[0].message.content

demo = gr.ChatInterface(fn=echo, type="messages", examples=["Click to Enter"], title="Welcome to the AI chatbot of Gridline")
demo.launch()