GPTRouter 0.3.7__tar.gz → 0.3.8__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: GPTRouter
3
- Version: 0.3.7
3
+ Version: 0.3.8
4
4
  Summary: A Python package for working with GPTRouter APIs
5
5
  Author-email: sirjanpreet@writesonic.com
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: GPTRouter
3
- Version: 0.3.7
3
+ Version: 0.3.8
4
4
  Summary: A Python package for working with GPTRouter APIs
5
5
  Author-email: sirjanpreet@writesonic.com
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -391,9 +391,18 @@ class GPTRouterClient:
391
391
  )
392
392
  generated_images = api_response.get("response", [])
393
393
  if isinstance(generated_images, dict):
394
- generated_images = generated_images.get("artifacts", [])
394
+ generated_images = self._extract_images_from_dict(generated_images)
395
395
 
396
396
  return [
397
397
  parse_obj_as(ImageGenerationResponse, generated_img)
398
398
  for generated_img in generated_images
399
399
  ]
400
+
401
+ def _extract_images_from_dict(self, image_dict: dict) -> List[dict]:
402
+ if artifacts := image_dict.get("artifacts"):
403
+ return artifacts
404
+
405
+ if image_urls := image_dict.get("imageUrls"):
406
+ return [{"url": url} for url in image_urls]
407
+
408
+ return []
@@ -15,6 +15,7 @@ class ProvidersEnum(Enum):
15
15
  STABLE_DIFFUSION = "stable-diffusion"
16
16
  DALL_E = "dall-e"
17
17
  OPENROUTER = "openrouter"
18
+ REPLICATE = "replicate"
18
19
 
19
20
  class ModelsEnum(Enum):
20
21
  OPENAI_GPT_35_TURBO_16K = "gpt-3.5-turbo-16k"
@@ -43,6 +44,8 @@ class ModelsEnum(Enum):
43
44
  STABLE_DIFFUSION_XL = "stable-diffusion-xl-1024-v1-0"
44
45
  STABLE_DIFFUSION_V6 = "stable-diffusion-v1-6"
45
46
 
47
+ REPLICATE_FLUX = "black-forest-labs/flux-dev"
48
+
46
49
  class StreamingEventType(Enum):
47
50
  UPDATE = "update"
48
51
  META = "meta"
@@ -150,6 +153,9 @@ class GPTRouterEngines(Enum):
150
153
  ProvidersEnum.STABLE_DIFFUSION.value, "stable-diffusion-xl-1024-v1-0"
151
154
  )
152
155
  DALLE_3 = ModelDetails(ProvidersEnum.DALL_E.value, "dall-e-3")
156
+ REPLICATE_FLUX = ModelDetails(
157
+ ProvidersEnum.REPLICATE.value, "black-forest-labs/flux-dev"
158
+ )
153
159
 
154
160
  LLAMA_3_70B_NITRO = ModelDetails(
155
161
  ProvidersEnum.OPENROUTER, "meta-llama/llama-3-70b-instruct:nitro"
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name="GPTRouter",
8
- version="0.3.7",
8
+ version="0.3.8",
9
9
  description="A Python package for working with GPTRouter APIs",
10
10
  long_description=long_description,
11
11
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes
File without changes