diff --git a/server/llm_utils.py b/server/llm_utils.py index 8f94692..d2cbaf6 100644 --- a/server/llm_utils.py +++ b/server/llm_utils.py @@ -5,9 +5,12 @@ from openai import OpenAI -model_name = "qwen2.5-72b-instruct" # qwen-plus, 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models -url = "https://dashscope.aliyuncs.com/compatible-mode/v1" -api_key = "" # 阿里云 API Key +model_name = "gemini-1.5-flash" # gemini model; 更多参考:https://ai.google.dev/gemini-api/docs/models/gemini-v2?hl=zh-cn +api_key = "" # Gemini API Key +url = "https://generativelanguage.googleapis.com/v1beta/" +# model_name = "qwen2.5-72b-instruct" # qwen-plus, 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models +# url = "https://dashscope.aliyuncs.com/compatible-mode/v1" +# api_key = "" # 阿里云 API Key class LLMClient(object): @@ -17,7 +20,7 @@ def get_response_by_api( prompt: str, ) -> str: messages = [ - {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."}, + {"role": "system", "content": "You are Gemini, created by Google. You are a helpful assistant."}, {"role": "user", "content": prompt} ] client = OpenAI( @@ -53,4 +56,4 @@ def walk_to_random_item( if __name__ == "__main__": res = LLMClient.get_response_by_api("你好") - print(res) \ No newline at end of file + print(res)