yym68686 commited on
Commit
432fcd1
·
1 Parent(s): 7d44776

Fix the bug where Gemini can only use the first region.

Browse files
Files changed (2) hide show
  1. request.py +2 -2
  2. utils.py +2 -1
request.py CHANGED
@@ -1,6 +1,6 @@
1
  import json
2
  from models import RequestModel
3
- from utils import c35s, c3s, c3o, c3h, CircularList
4
 
5
  async def get_image_message(base64_image, engine = None):
6
  if "gpt" == engine:
@@ -235,7 +235,7 @@ async def get_vertex_gemini_payload(request, engine, provider):
235
  if request.stream:
236
  gemini_stream = "streamGenerateContent"
237
  model = provider['model'][request.model]
238
- location = CircularList(["us-central1", "us-east4", "us-west1", "us-west4", "europe-west1", "europe-west2"])
239
  url = "https://{LOCATION}-aiplatform.googleapis.com/v1/projects/{PROJECT_ID}/locations/{LOCATION}/publishers/google/models/{MODEL_ID}:{stream}".format(LOCATION=location.next(), PROJECT_ID=project_id, MODEL_ID=model, stream=gemini_stream)
240
 
241
  messages = []
 
1
  import json
2
  from models import RequestModel
3
+ from utils import c35s, c3s, c3o, c3h, gem, CircularList
4
 
5
  async def get_image_message(base64_image, engine = None):
6
  if "gpt" == engine:
 
235
  if request.stream:
236
  gemini_stream = "streamGenerateContent"
237
  model = provider['model'][request.model]
238
+ location = gem
239
  url = "https://{LOCATION}-aiplatform.googleapis.com/v1/projects/{PROJECT_ID}/locations/{LOCATION}/publishers/google/models/{MODEL_ID}:{stream}".format(LOCATION=location.next(), PROJECT_ID=project_id, MODEL_ID=model, stream=gemini_stream)
240
 
241
  messages = []
utils.py CHANGED
@@ -221,4 +221,5 @@ class CircularList:
221
  c35s = CircularList(["us-east5", "europe-west1"])
222
  c3s = CircularList(["us-east5", "us-central1", "asia-southeast1"])
223
  c3o = CircularList(["us-east5"])
224
- c3h = CircularList(["us-east5", "us-central1", "europe-west1", "europe-west4"])
 
 
221
  c35s = CircularList(["us-east5", "europe-west1"])
222
  c3s = CircularList(["us-east5", "us-central1", "asia-southeast1"])
223
  c3o = CircularList(["us-east5"])
224
+ c3h = CircularList(["us-east5", "us-central1", "europe-west1", "europe-west4"])
225
+ gem = CircularList(["us-central1", "us-east4", "us-west1", "us-west4", "europe-west1", "europe-west2"])