import cohere from dotenv import load_dotenv import os load_dotenv() cohere_api_key = os.getenv("cohere_api_key") co = cohere.ClientV2(cohere_api_key) def chat_completion(message: str, context: str) -> str: response = co.chat( model="command-r-plus-08-2024", messages=[{"role": "system", "content": "You are a Pokemon expert. You know everything about their characteristics, abilities, and evolutions. You always reply with the most accurate information, you are polite and helpful. Your output cannot be larger than 1500 characters (spaces included). Don't talk about things that the user did not mention in their message."}, {"role": "user", "content": message}, {"role": "assistant", "content": context}], ) return response.message.content[0].text def card_completion(message: str) -> str: response = co.chat( model="command-r-plus-08-2024", messages=[{"role": "system", "content": "You are an expert in Pokemon cards. You know everything about their characteristics, abilities, and evolutions. You always reply with the most accurate information, you are polite and helpful."}, {"role": "user", "content": message}], ) return response.message.content[0].text def summarize(message, system_prompt="You are an helpful assistant whose job is to summarize the text you are given in less than 900 charachters (including spaces) in such a way that it would constitute an effective and engaging description of a pokemon card package"): response = co.chat( model="command-r-plus-08-2024", messages=[ {"role": "system", "content": system_prompt}, {"role": "user", "content": message}, ] ) return response.message.content[0].text