randydev commited on
Commit
0be12e4
·
verified ·
1 Parent(s): 67c4840

Upload chatgpt.py

Browse files
Files changed (1) hide show
  1. Akeno/plugins/chatgpt.py +8 -4
Akeno/plugins/chatgpt.py CHANGED
@@ -29,6 +29,7 @@ from Akeno.utils.handler import *
29
  from Akeno.utils.logger import LOGS
30
  from config import *
31
 
 
32
 
33
  async def mistraai(messagestr):
34
  url = "https://randydev-ryuzaki-api.hf.space/api/v1/akeno/mistralai"
@@ -86,10 +87,13 @@ async def chatbot_talk(client: Client, message: Message):
86
  if chat_user:
87
  query = message.text.strip()
88
  try:
89
- messager = await chatgptold(query)
90
- if messager is None:
91
- return await message.reply_text("No response")
92
- output = messager["randydev"].get("message")
 
 
 
93
  if len(output) > 4096:
94
  with open("chat.txt", "w+", encoding="utf8") as out_file:
95
  out_file.write(output)
 
29
  from Akeno.utils.logger import LOGS
30
  from config import *
31
 
32
+ import google.generativeai as genai
33
 
34
  async def mistraai(messagestr):
35
  url = "https://randydev-ryuzaki-api.hf.space/api/v1/akeno/mistralai"
 
87
  if chat_user:
88
  query = message.text.strip()
89
  try:
90
+ genai.configure(api_key=GOOGLE_API_KEY)
91
+ model=genai.GenerativeModel(
92
+ model_name="gemini-1.5-flash",
93
+ system_instruction="You are a cat. Your name is Neko."
94
+ )
95
+ response = model.generate_content(query)
96
+ output response.text
97
  if len(output) > 4096:
98
  with open("chat.txt", "w+", encoding="utf8") as out_file:
99
  out_file.write(output)