together 0.2.9__tar.gz → 0.2.10__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.
- {together-0.2.9 → together-0.2.10}/PKG-INFO +1 -1
- {together-0.2.9 → together-0.2.10}/pyproject.toml +1 -1
- {together-0.2.9 → together-0.2.10}/src/together/utils.py +14 -18
- {together-0.2.9 → together-0.2.10}/LICENSE +0 -0
- {together-0.2.9 → together-0.2.10}/README.md +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/__init__.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/cli/__init__.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/cli/cli.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/commands/__init__.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/commands/chat.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/commands/complete.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/commands/embeddings.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/commands/files.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/commands/finetune.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/commands/image.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/commands/models.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/complete.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/embeddings.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/error.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/files.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/finetune.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/image.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/models.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/tools/__init__.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/tools/conversation.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/types.py +0 -0
- {together-0.2.9 → together-0.2.10}/src/together/version.py +0 -0
|
@@ -75,6 +75,18 @@ def parse_timestamp(timestamp: str) -> datetime:
|
|
|
75
75
|
raise ValueError("Timestamp does not match any expected format")
|
|
76
76
|
|
|
77
77
|
|
|
78
|
+
def response_status_exception(response: requests.Response) -> None:
|
|
79
|
+
if response.status_code == 429:
|
|
80
|
+
raise together.RateLimitError(
|
|
81
|
+
message="Too many requests received. Please pace your requests."
|
|
82
|
+
)
|
|
83
|
+
elif response.status_code == 500:
|
|
84
|
+
raise Exception("server encountered an unexpected condition")
|
|
85
|
+
elif response.status_code == 401:
|
|
86
|
+
raise Exception("invalid authentication credentials")
|
|
87
|
+
response.raise_for_status()
|
|
88
|
+
|
|
89
|
+
|
|
78
90
|
def create_post_request(
|
|
79
91
|
url: str,
|
|
80
92
|
headers: Optional[Dict[Any, Any]] = None,
|
|
@@ -99,15 +111,7 @@ def create_post_request(
|
|
|
99
111
|
except requests.exceptions.RequestException as e:
|
|
100
112
|
raise together.ResponseError(e)
|
|
101
113
|
|
|
102
|
-
|
|
103
|
-
raise together.RateLimitError(
|
|
104
|
-
message="Too many requests received. Please pace your requests."
|
|
105
|
-
)
|
|
106
|
-
elif response.status_code == 500:
|
|
107
|
-
raise Exception("Invalid API key supplied.")
|
|
108
|
-
elif response.status_code == 401:
|
|
109
|
-
raise Exception("API Key not supplied")
|
|
110
|
-
response.raise_for_status()
|
|
114
|
+
response_status_exception(response)
|
|
111
115
|
|
|
112
116
|
return response
|
|
113
117
|
|
|
@@ -139,15 +143,7 @@ def create_get_request(
|
|
|
139
143
|
except requests.exceptions.RequestException as e:
|
|
140
144
|
raise together.ResponseError(e)
|
|
141
145
|
|
|
142
|
-
|
|
143
|
-
raise together.RateLimitError(
|
|
144
|
-
message="Too many requests received. Please pace your requests."
|
|
145
|
-
)
|
|
146
|
-
elif response.status_code == 500:
|
|
147
|
-
raise Exception("Invalid API key supplied.")
|
|
148
|
-
elif response.status_code == 401:
|
|
149
|
-
raise Exception("API Key not supplied")
|
|
150
|
-
response.raise_for_status()
|
|
146
|
+
response_status_exception(response)
|
|
151
147
|
|
|
152
148
|
return response
|
|
153
149
|
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|