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()