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.
Files changed (27) hide show
  1. {together-0.2.9 → together-0.2.10}/PKG-INFO +1 -1
  2. {together-0.2.9 → together-0.2.10}/pyproject.toml +1 -1
  3. {together-0.2.9 → together-0.2.10}/src/together/utils.py +14 -18
  4. {together-0.2.9 → together-0.2.10}/LICENSE +0 -0
  5. {together-0.2.9 → together-0.2.10}/README.md +0 -0
  6. {together-0.2.9 → together-0.2.10}/src/together/__init__.py +0 -0
  7. {together-0.2.9 → together-0.2.10}/src/together/cli/__init__.py +0 -0
  8. {together-0.2.9 → together-0.2.10}/src/together/cli/cli.py +0 -0
  9. {together-0.2.9 → together-0.2.10}/src/together/commands/__init__.py +0 -0
  10. {together-0.2.9 → together-0.2.10}/src/together/commands/chat.py +0 -0
  11. {together-0.2.9 → together-0.2.10}/src/together/commands/complete.py +0 -0
  12. {together-0.2.9 → together-0.2.10}/src/together/commands/embeddings.py +0 -0
  13. {together-0.2.9 → together-0.2.10}/src/together/commands/files.py +0 -0
  14. {together-0.2.9 → together-0.2.10}/src/together/commands/finetune.py +0 -0
  15. {together-0.2.9 → together-0.2.10}/src/together/commands/image.py +0 -0
  16. {together-0.2.9 → together-0.2.10}/src/together/commands/models.py +0 -0
  17. {together-0.2.9 → together-0.2.10}/src/together/complete.py +0 -0
  18. {together-0.2.9 → together-0.2.10}/src/together/embeddings.py +0 -0
  19. {together-0.2.9 → together-0.2.10}/src/together/error.py +0 -0
  20. {together-0.2.9 → together-0.2.10}/src/together/files.py +0 -0
  21. {together-0.2.9 → together-0.2.10}/src/together/finetune.py +0 -0
  22. {together-0.2.9 → together-0.2.10}/src/together/image.py +0 -0
  23. {together-0.2.9 → together-0.2.10}/src/together/models.py +0 -0
  24. {together-0.2.9 → together-0.2.10}/src/together/tools/__init__.py +0 -0
  25. {together-0.2.9 → together-0.2.10}/src/together/tools/conversation.py +0 -0
  26. {together-0.2.9 → together-0.2.10}/src/together/types.py +0 -0
  27. {together-0.2.9 → together-0.2.10}/src/together/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: together
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: Python client for Together's Cloud Platform!
5
5
  Home-page: https://github.com/togethercomputer/together
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "together"
7
- version = "0.2.9"
7
+ version = "0.2.10"
8
8
  authors = [
9
9
  "Together AI <support@together.ai>"
10
10
  ]
@@ -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
- if response.status_code == 429:
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
- if response.status_code == 429:
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