chansung commited on
Commit
686382c
β€’
1 Parent(s): 35f930d

Update gen/gemini_chat.py

Browse files
Files changed (1) hide show
  1. gen/gemini_chat.py +5 -6
gen/gemini_chat.py CHANGED
@@ -83,19 +83,19 @@ def _default_safety_settings():
83
  return [
84
  {
85
  "category": "HARM_CATEGORY_HARASSMENT",
86
- "threshold": "NEGLIGIBLE"
87
  },
88
  {
89
  "category": "HARM_CATEGORY_HATE_SPEECH",
90
- "threshold": "NEGLIGIBLE"
91
  },
92
  {
93
  "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
94
- "threshold": "NEGLIGIBLE"
95
  },
96
  {
97
  "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
98
- "threshold": "NEGLIGIBLE"
99
  },
100
  ]
101
 
@@ -113,7 +113,7 @@ async def gen_text(
113
  ):
114
  model = genai.GenerativeModel(model_name="gemini-1.0-pro",
115
  generation_config=gen_config,
116
- safety_settings=None)#safety_settings)
117
 
118
  user_prompt = prompts[-1]
119
  prompts = prompts[:-1]
@@ -124,7 +124,6 @@ async def gen_text(
124
  )
125
 
126
  async for resp in resps:
127
- print(resp.candidate.safety_ratings)
128
  async for word in _word_generator(resp.text):
129
  yield word + " "
130
 
 
83
  return [
84
  {
85
  "category": "HARM_CATEGORY_HARASSMENT",
86
+ "threshold": "BLOCK_NONE"
87
  },
88
  {
89
  "category": "HARM_CATEGORY_HATE_SPEECH",
90
+ "threshold": "BLOCK_NONE"
91
  },
92
  {
93
  "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
94
+ "threshold": "BLOCK_NONE"
95
  },
96
  {
97
  "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
98
+ "threshold": "BLOCK_NONE"
99
  },
100
  ]
101
 
 
113
  ):
114
  model = genai.GenerativeModel(model_name="gemini-1.0-pro",
115
  generation_config=gen_config,
116
+ safety_settings=safety_settings)
117
 
118
  user_prompt = prompts[-1]
119
  prompts = prompts[:-1]
 
124
  )
125
 
126
  async for resp in resps:
 
127
  async for word in _word_generator(resp.text):
128
  yield word + " "
129