import cohere import os from dotenv import load_dotenv load_dotenv() COHERE_API_KEY = os.getenv('COHERE_API_KEY') PREAMBLE = os.getenv('PREAMBLE') def chat_completion(prompt, recipients_id): # Initialize the Cohere client co = cohere.Client(api_key=COHERE_API_KEY) # Generate a chat response response = co.chat( model="command-r-plus", message=prompt, preamble=PREAMBLE, conversation_id= recipients_id+'idx' ) # Return the response text return response.text