GPTRouter 0.2.0__tar.gz → 0.2.2__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.
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/GPTRouter.egg-info/PKG-INFO +2 -2
- GPTRouter-0.2.2/GPTRouter.egg-info/requires.txt +3 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/PKG-INFO +2 -2
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/gpt_router/client.py +23 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/gpt_router/enums.py +7 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/gpt_router/models.py +29 -0
- GPTRouter-0.2.2/setup.py +22 -0
- GPTRouter-0.2.0/GPTRouter.egg-info/requires.txt +0 -2
- GPTRouter-0.2.0/setup.py +0 -25
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/GPTRouter.egg-info/SOURCES.txt +0 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/GPTRouter.egg-info/dependency_links.txt +0 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/GPTRouter.egg-info/top_level.txt +0 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/LICENSE +0 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/README.md +0 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/gpt_router/__init__.py +0 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/gpt_router/constants.py +0 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/gpt_router/exceptions.py +0 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/pyproject.toml +0 -0
- {GPTRouter-0.2.0 → GPTRouter-0.2.2}/setup.cfg +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: GPTRouter
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A Python package for working with GPTRouter APIs
|
|
5
|
-
Author-email: sirjanpreet
|
|
5
|
+
Author-email: sirjanpreet@writesonic.com
|
|
6
6
|
Classifier: Development Status :: 3 - Alpha
|
|
7
7
|
Classifier: Intended Audience :: Developers
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: GPTRouter
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A Python package for working with GPTRouter APIs
|
|
5
|
-
Author-email: sirjanpreet
|
|
5
|
+
Author-email: sirjanpreet@writesonic.com
|
|
6
6
|
Classifier: Development Status :: 3 - Alpha
|
|
7
7
|
Classifier: Intended Audience :: Developers
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -6,6 +6,8 @@ import httpx
|
|
|
6
6
|
from typing import Generator, List, Union
|
|
7
7
|
|
|
8
8
|
from gpt_router.models import (
|
|
9
|
+
ImageGenerationRequest,
|
|
10
|
+
ImageGenerationResponse,
|
|
9
11
|
ModelGenerationRequest,
|
|
10
12
|
GenerationResponse,
|
|
11
13
|
ChunkedGenerationResponse,
|
|
@@ -226,3 +228,24 @@ class GPTRouterClient:
|
|
|
226
228
|
payload=api_payload,
|
|
227
229
|
)
|
|
228
230
|
return parse_obj_as(GenerationResponse, result)
|
|
231
|
+
|
|
232
|
+
async def agenerate_images(
|
|
233
|
+
self, *, image_generation_request: ImageGenerationRequest
|
|
234
|
+
) -> List[ImageGenerationResponse]:
|
|
235
|
+
api_path = "/v1/generate/generate-image"
|
|
236
|
+
api_method = "POST"
|
|
237
|
+
api_payload = image_generation_request.dict()
|
|
238
|
+
|
|
239
|
+
api_response = await self._async_api_call(
|
|
240
|
+
path=api_path,
|
|
241
|
+
method=api_method,
|
|
242
|
+
payload=api_payload,
|
|
243
|
+
)
|
|
244
|
+
generated_images = api_response.get("response", [])
|
|
245
|
+
if isinstance(generated_images, dict):
|
|
246
|
+
generated_images = generated_images.get('artifacts', [])
|
|
247
|
+
|
|
248
|
+
return [
|
|
249
|
+
parse_obj_as(ImageGenerationResponse, generated_img)
|
|
250
|
+
for generated_img in generated_images
|
|
251
|
+
]
|
|
@@ -6,6 +6,8 @@ class ProvidersEnum(Enum):
|
|
|
6
6
|
ANTHROPIC = "anthropic"
|
|
7
7
|
AZURE_CHAT_OPENAI = "azure_chat_openai"
|
|
8
8
|
COHERE = "cohere"
|
|
9
|
+
DALLE = "dall-e"
|
|
10
|
+
STABLE_DIFFUSION = "stable-diffusion-v1-6"
|
|
9
11
|
|
|
10
12
|
class ModelsEnum(Enum):
|
|
11
13
|
OPENAI_GPT_35_TURBO_16K = "gpt-3.5-turbo-16k"
|
|
@@ -29,6 +31,11 @@ class ModelsEnum(Enum):
|
|
|
29
31
|
|
|
30
32
|
CLAUDE_INSTANT_12 = "claude-instant-1.2"
|
|
31
33
|
|
|
34
|
+
DALLE_3 = "dall-e-3"
|
|
35
|
+
|
|
36
|
+
STABLE_DIFFUSION_XL = "stable-diffusion-xl-1024-v1-0"
|
|
37
|
+
STABLE_DIFFUSION_V6 = "stable-diffusion-v1-6"
|
|
38
|
+
|
|
32
39
|
class StreamingEventType(Enum):
|
|
33
40
|
UPDATE = "update"
|
|
34
41
|
META = "meta"
|
|
@@ -66,3 +66,32 @@ class GenerationResponse(BaseModel):
|
|
|
66
66
|
class ChunkedGenerationResponse(BaseModel):
|
|
67
67
|
event: str
|
|
68
68
|
data: dict
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class ImageGenerationRequest(BaseModel):
|
|
72
|
+
model_name: str = Field(alias="model")
|
|
73
|
+
provider_name: str = Field(alias="imageVendor")
|
|
74
|
+
prompt: str
|
|
75
|
+
num_images: int = Field(alias="numImages", default=1)
|
|
76
|
+
width: Optional[int] = Field(None, alias="width")
|
|
77
|
+
height: Optional[int] = Field(None, alias="height")
|
|
78
|
+
|
|
79
|
+
class Config:
|
|
80
|
+
allow_population_by_field_name = True
|
|
81
|
+
protected_namespaces = ()
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def size(self) -> Optional[str]:
|
|
85
|
+
return f"{self.width}x{self.height}" if self.width and self.height else None
|
|
86
|
+
|
|
87
|
+
def dict(self, *args, **kwargs):
|
|
88
|
+
base_dict = super().dict(*args, **kwargs, exclude_none=True, by_alias=True)
|
|
89
|
+
if self.size is not None:
|
|
90
|
+
base_dict["size"] = self.size
|
|
91
|
+
return base_dict
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class ImageGenerationResponse(BaseModel):
|
|
95
|
+
url: str = None
|
|
96
|
+
base64: str = None
|
|
97
|
+
finish_reason: Optional[str] = Field(default="SUCCESS", alias='finishReason')
|
GPTRouter-0.2.2/setup.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r") as fh:
|
|
4
|
+
long_description = fh.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="GPTRouter",
|
|
8
|
+
version="0.2.2",
|
|
9
|
+
description="A Python package for working with GPTRouter APIs",
|
|
10
|
+
long_description=long_description,
|
|
11
|
+
long_description_content_type="text/markdown",
|
|
12
|
+
author_email="sirjanpreet@writesonic.com",
|
|
13
|
+
packages=["gpt_router"],
|
|
14
|
+
install_requires=["httpx>=0.23.3", "pydantic>=1.10.13", "pyhumps>=3.8.0"],
|
|
15
|
+
classifiers=[
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
],
|
|
22
|
+
)
|
GPTRouter-0.2.0/setup.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from setuptools import setup
|
|
2
|
-
|
|
3
|
-
with open("README.md", "r") as fh:
|
|
4
|
-
long_description = fh.read()
|
|
5
|
-
|
|
6
|
-
setup(
|
|
7
|
-
name='GPTRouter',
|
|
8
|
-
version='0.2.0',
|
|
9
|
-
description='A Python package for working with GPTRouter APIs',
|
|
10
|
-
long_description=long_description,
|
|
11
|
-
long_description_content_type="text/markdown",
|
|
12
|
-
author_email='sirjanpreet.ext@writesonic.com',
|
|
13
|
-
packages=['gpt_router'],
|
|
14
|
-
install_requires=[
|
|
15
|
-
'httpx>=0.25.2',
|
|
16
|
-
"pydantic==1.10.14"
|
|
17
|
-
],
|
|
18
|
-
classifiers=[
|
|
19
|
-
'Development Status :: 3 - Alpha',
|
|
20
|
-
'Intended Audience :: Developers',
|
|
21
|
-
'Programming Language :: Python :: 3',
|
|
22
|
-
'Programming Language :: Python :: 3.10',
|
|
23
|
-
'Programming Language :: Python :: 3.11',
|
|
24
|
-
],
|
|
25
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|