neuro-simulator 0.5.0__py3-none-any.whl → 0.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,7 @@ class ChatbotLLMClient:
39
39
  if not api_key:
40
40
  raise ValueError("GEMINI_API_KEY is not set in configuration for the chatbot agent.")
41
41
 
42
- genai.configure(api_key=api_key)
42
+ self.client = genai.Client(api_key=api_key)
43
43
  self.model_name = settings.chatbot_agent.agent_model
44
44
  self._generate_func = self._generate_gemini
45
45
 
@@ -62,20 +62,21 @@ class ChatbotLLMClient:
62
62
 
63
63
  async def _generate_gemini(self, prompt: str, max_tokens: int) -> str:
64
64
  """Generates text using the Gemini model."""
65
- generation_config = types.GenerationConfig(
65
+ generation_config = types.GenerateContentConfig(
66
66
  max_output_tokens=max_tokens,
67
67
  )
68
- model = genai.GenerativeModel(self.model_name)
69
68
  try:
70
- response = await model.generate_content_async(
69
+ # Run the synchronous SDK call in a thread to avoid blocking asyncio
70
+ response = await asyncio.to_thread(
71
+ self.client.models.generate_content,
72
+ model=self.model_name,
71
73
  contents=prompt,
72
- generation_config=generation_config
74
+ config=generation_config
73
75
  )
74
76
  return response.text
75
77
  except Exception as e:
76
78
  logger.error(f"Error in chatbot _generate_gemini: {e}", exc_info=True)
77
79
  return ""
78
-
79
80
  async def _generate_openai(self, prompt: str, max_tokens: int) -> str:
80
81
  """Generates text using the OpenAI model."""
81
82
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuro_simulator
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Neuro Simulator Server
5
5
  Author-email: Moha-Master <hongkongreporter@outlook.com>
6
6
  License-Expression: MIT
@@ -27,7 +27,7 @@ neuro_simulator/api/system.py,sha256=OJT6m6HIYATMCAKrgeBRhficaiUjIDl9f-WyUT-RoBw
27
27
  neuro_simulator/assets/neuro_start.mp4,sha256=xCLnNzv4THnzRYwkdV6EiqXc-XtFd867R2ZVLDvNp0Y,8226418
28
28
  neuro_simulator/chatbot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  neuro_simulator/chatbot/core.py,sha256=jddeOZDYcEcWpEryMVOlLFCq1YqIZGnqQi7VV_sPnRU,11314
30
- neuro_simulator/chatbot/llm.py,sha256=UgiAq8aqmuSaf3poX_QIZHPxKPZpr_Xn4aHrhTlESPE,4204
30
+ neuro_simulator/chatbot/llm.py,sha256=SDFgPG4SU7CC--IYHyUHjUPK4no4vkzckIi47JZ6Vz4,4315
31
31
  neuro_simulator/chatbot/memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  neuro_simulator/chatbot/memory/manager.py,sha256=K84EEH-gRPksgt7GcNxvEVo60aHxaOTC3dZMf2rR9bQ,3827
33
33
  neuro_simulator/chatbot/nickname_gen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -55,8 +55,8 @@ neuro_simulator/utils/process.py,sha256=9OYWx8fzaJZqmFUcjQX37AnBhl7YWvrLxDWBa30v
55
55
  neuro_simulator/utils/queue.py,sha256=pyBiFSSO1ocUF0kZfXvOywVcyYAwk8XDBXR8jJLkgSI,2701
56
56
  neuro_simulator/utils/state.py,sha256=DdBqSAYfjOFtJfB1hEGhYPh32r1ZvFuVlN_-29_-luA,664
57
57
  neuro_simulator/utils/websocket.py,sha256=fjC-qipzjgM_e7XImP12DFmLhvxkMOSr2GnUWws7esE,2058
58
- neuro_simulator-0.5.0.dist-info/METADATA,sha256=yaElYaysfpSen1W2igb9eR8eTZWHF2N7F-O-4w1Ig3c,7675
59
- neuro_simulator-0.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
60
- neuro_simulator-0.5.0.dist-info/entry_points.txt,sha256=qVd5ypnRRgU8Cw7rWfZ7o0OXyS9P9hgY-cRoN_mgz9g,51
61
- neuro_simulator-0.5.0.dist-info/top_level.txt,sha256=V8awSKpcrFnjJDiJxSfy7jtOrnuE2BgAR9hLmfMDWK8,16
62
- neuro_simulator-0.5.0.dist-info/RECORD,,
58
+ neuro_simulator-0.5.1.dist-info/METADATA,sha256=hHuiHZ9ZkV9Uu7tO71-lpH3y72088tQ_EN4hmla6jaA,7675
59
+ neuro_simulator-0.5.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
60
+ neuro_simulator-0.5.1.dist-info/entry_points.txt,sha256=qVd5ypnRRgU8Cw7rWfZ7o0OXyS9P9hgY-cRoN_mgz9g,51
61
+ neuro_simulator-0.5.1.dist-info/top_level.txt,sha256=V8awSKpcrFnjJDiJxSfy7jtOrnuE2BgAR9hLmfMDWK8,16
62
+ neuro_simulator-0.5.1.dist-info/RECORD,,