futureagi 0.3.0__tar.gz → 0.3.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.
Files changed (30) hide show
  1. {futureagi-0.3.0 → futureagi-0.3.2}/PKG-INFO +1 -1
  2. {futureagi-0.3.0 → futureagi-0.3.2}/fi/api/auth.py +2 -2
  3. {futureagi-0.3.0 → futureagi-0.3.2}/fi/evals/evaluator.py +3 -0
  4. {futureagi-0.3.0 → futureagi-0.3.2}/fi/testcases/__init__.py +2 -2
  5. {futureagi-0.3.0 → futureagi-0.3.2}/fi/testcases/general.py +1 -1
  6. {futureagi-0.3.0 → futureagi-0.3.2}/fi/utils/errors.py +50 -43
  7. {futureagi-0.3.0 → futureagi-0.3.2}/pyproject.toml +1 -1
  8. {futureagi-0.3.0 → futureagi-0.3.2}/LICENSE.md +0 -0
  9. {futureagi-0.3.0 → futureagi-0.3.2}/README.md +0 -0
  10. {futureagi-0.3.0 → futureagi-0.3.2}/fi/__init__.py +0 -0
  11. {futureagi-0.3.0 → futureagi-0.3.2}/fi/api/__init__.py +0 -0
  12. {futureagi-0.3.0 → futureagi-0.3.2}/fi/api/types.py +0 -0
  13. {futureagi-0.3.0 → futureagi-0.3.2}/fi/client.py +0 -0
  14. {futureagi-0.3.0 → futureagi-0.3.2}/fi/evals/__init__.py +0 -0
  15. {futureagi-0.3.0 → futureagi-0.3.2}/fi/evals/templates.py +0 -0
  16. {futureagi-0.3.0 → futureagi-0.3.2}/fi/evals/types.py +0 -0
  17. {futureagi-0.3.0 → futureagi-0.3.2}/fi/integrations/__init__.py +0 -0
  18. {futureagi-0.3.0 → futureagi-0.3.2}/fi/integrations/providers/__init__.py +0 -0
  19. {futureagi-0.3.0 → futureagi-0.3.2}/fi/integrations/providers/types.py +0 -0
  20. {futureagi-0.3.0 → futureagi-0.3.2}/fi/testcases/conversational_test_case.py +0 -0
  21. {futureagi-0.3.0 → futureagi-0.3.2}/fi/testcases/llm_test_case.py +0 -0
  22. {futureagi-0.3.0 → futureagi-0.3.2}/fi/testcases/mllm_test_case.py +0 -0
  23. {futureagi-0.3.0 → futureagi-0.3.2}/fi/testcases/utils.py +0 -0
  24. {futureagi-0.3.0 → futureagi-0.3.2}/fi/utils/__init__.py +0 -0
  25. {futureagi-0.3.0 → futureagi-0.3.2}/fi/utils/constants.py +0 -0
  26. {futureagi-0.3.0 → futureagi-0.3.2}/fi/utils/executor.py +0 -0
  27. {futureagi-0.3.0 → futureagi-0.3.2}/fi/utils/logging.py +0 -0
  28. {futureagi-0.3.0 → futureagi-0.3.2}/fi/utils/routes.py +0 -0
  29. {futureagi-0.3.0 → futureagi-0.3.2}/fi/utils/types.py +0 -0
  30. {futureagi-0.3.0 → futureagi-0.3.2}/fi/utils/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: futureagi
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: We help GenAI teams maintain high-accuracy for their Models in production.
5
5
  Author: Future AGI
6
6
  Author-email: no-reply@futureagi.com
@@ -16,7 +16,7 @@ from fi.utils.constants import (
16
16
  DEFAULT_TIMEOUT,
17
17
  SECRET_KEY_ENVVAR_NAME,
18
18
  )
19
- from fi.utils.errors import AuthError
19
+ from fi.utils.errors import MissingAuthError
20
20
  from fi.utils.executor import BoundedExecutor
21
21
 
22
22
  T = TypeVar("T")
@@ -118,7 +118,7 @@ class APIKeyAuth(HttpClient):
118
118
  SECRET_KEY_ENVVAR_NAME
119
119
  )
120
120
  if self._fi_api_key is None or self._fi_secret_key is None:
121
- raise AuthError(self._fi_api_key, self._fi_secret_key)
121
+ raise MissingAuthError(self._fi_api_key, self._fi_secret_key)
122
122
 
123
123
  super().__init__(
124
124
  base_url=fi_base_url,
@@ -7,6 +7,7 @@ from fi.api.types import HttpMethod, RequestConfig
7
7
  from fi.evals.templates import EvalTemplate
8
8
  from fi.evals.types import BatchRunResult, EvalResult, EvalResultMetric
9
9
  from fi.testcases import ConversationalTestCase, LLMTestCase, MLLMTestCase, TestCase
10
+ from fi.utils.errors import InvalidAuthError
10
11
  from fi.utils.routes import Routes
11
12
 
12
13
 
@@ -21,6 +22,8 @@ class EvalResponseHandler(ResponseHandler[BatchRunResult]):
21
22
  def _handle_error(cls, response: Response) -> None:
22
23
  if response.status_code == 400:
23
24
  response.raise_for_status()
25
+ if response.status_code == 403:
26
+ raise InvalidAuthError()
24
27
 
25
28
  @classmethod
26
29
  def convert_to_batch_results(cls, response: Dict[str, Any]) -> BatchRunResult:
@@ -1,6 +1,6 @@
1
1
  from fi.testcases.conversational_test_case import ConversationalTestCase # noqa: F401
2
2
  from fi.testcases.general import TestCase # noqa: F401
3
3
  from fi.testcases.llm_test_case import LLMTestCase # noqa: F401
4
- from fi.testcases.mllm_test_case import MLLMTestCase # noqa: F401
4
+ from fi.testcases.mllm_test_case import MLLMImage, MLLMTestCase # noqa: F401
5
5
 
6
- all = ["LLMTestCase", "TestCase", "ConversationalTestCase", "MLLMTestCase"]
6
+ all = ["LLMTestCase", "TestCase", "ConversationalTestCase", "MLLMTestCase", "MLLMImage"]
@@ -15,7 +15,7 @@ class TestCase(BaseModel):
15
15
  expected_json: Optional[dict] = None
16
16
  response: Optional[str] = None
17
17
 
18
- def __post_init__(self):
18
+ def model_post_init(self, __context):
19
19
  if self.actual_json is not None:
20
20
  self.actual_json = json.loads(self.actual_json)
21
21
  if self.expected_json is not None:
@@ -10,7 +10,7 @@ from .constants import (
10
10
  from .types import Environments, ModelTypes
11
11
 
12
12
 
13
- class ValidationError(Exception, ABC):
13
+ class CustomException(Exception, ABC):
14
14
  def __str__(self) -> str:
15
15
  return self.error_message()
16
16
 
@@ -23,16 +23,13 @@ class ValidationError(Exception, ABC):
23
23
  pass
24
24
 
25
25
 
26
- class AuthError(Exception):
26
+ class MissingAuthError(CustomException):
27
27
  def __init__(self, fi_api_key: Optional[str], fi_secret_key: Optional[str]) -> None:
28
28
  self.missing_api_key = fi_api_key is None
29
29
  self.missing_secret_key = fi_secret_key is None
30
30
 
31
31
  def __repr__(self) -> str:
32
- return "Invalid_FI_Client_Authentication"
33
-
34
- def __str__(self) -> str:
35
- return self.error_message()
32
+ return "Missing_FI_Client_Authentication"
36
33
 
37
34
  def error_message(self) -> str:
38
35
  missing_list = ["fi_api_key"] if self.missing_api_key else []
@@ -50,7 +47,27 @@ class AuthError(Exception):
50
47
  )
51
48
 
52
49
 
53
- class InvalidAdditionalHeaders(ValidationError):
50
+ class InvalidAuthError(CustomException):
51
+ """Exception raised when API authentication fails due to invalid credentials"""
52
+
53
+ def __init__(self) -> None:
54
+ super().__init__()
55
+
56
+ def __repr__(self) -> str:
57
+ return "Invalid_FI_Client_Authentication"
58
+
59
+ def __str__(self) -> str:
60
+ return self.error_message()
61
+
62
+ def error_message(self) -> str:
63
+ return (
64
+ "Invalid FI Client Authentication, please check your api key and secret key"
65
+ )
66
+
67
+
68
+ class InvalidAdditionalHeaders(CustomException):
69
+ """Exception raised when additional headers are invalid"""
70
+
54
71
  def __repr__(self) -> str:
55
72
  return "Invalid_Additional_Headers"
56
73
 
@@ -64,13 +81,15 @@ class InvalidAdditionalHeaders(ValidationError):
64
81
  )
65
82
 
66
83
 
67
- class InvalidNumberOfEmbeddings(ValidationError):
68
- def __repr__(self) -> str:
69
- return "Invalid_Number_Of_Embeddings"
84
+ class InvalidNumberOfEmbeddings(CustomException):
85
+ """Exception raised when the number of embeddings is invalid"""
70
86
 
71
87
  def __init__(self, number_of_embeddings: int) -> None:
72
88
  self.number_of_embeddings = number_of_embeddings
73
89
 
90
+ def __repr__(self) -> str:
91
+ return "Invalid_Number_Of_Embeddings"
92
+
74
93
  def error_message(self) -> str:
75
94
  return (
76
95
  f"The schema contains {self.number_of_embeddings} different embeddings when a maximum of "
@@ -78,7 +97,9 @@ class InvalidNumberOfEmbeddings(ValidationError):
78
97
  )
79
98
 
80
99
 
81
- class InvalidValueType(Exception):
100
+ class InvalidValueType(CustomException):
101
+ """Exception raised when the value type is invalid"""
102
+
82
103
  def __init__(
83
104
  self,
84
105
  value_name: str,
@@ -92,9 +113,6 @@ class InvalidValueType(Exception):
92
113
  def __repr__(self) -> str:
93
114
  return "Invalid_Value_Type"
94
115
 
95
- def __str__(self) -> str:
96
- return self.error_message()
97
-
98
116
  def error_message(self) -> str:
99
117
  return (
100
118
  f"{self.value_name} with value {self.value} is of type {type(self.value).__name__}, "
@@ -102,7 +120,9 @@ class InvalidValueType(Exception):
102
120
  )
103
121
 
104
122
 
105
- class InvalidSupportedType(Exception):
123
+ class InvalidSupportedType(CustomException):
124
+ """Exception raised when the supported type is invalid"""
125
+
106
126
  def __init__(
107
127
  self,
108
128
  value_name: str,
@@ -116,9 +136,6 @@ class InvalidSupportedType(Exception):
116
136
  def __repr__(self) -> str:
117
137
  return "Invalid_Value_Type"
118
138
 
119
- def __str__(self) -> str:
120
- return self.error_message()
121
-
122
139
  def error_message(self) -> str:
123
140
  return (
124
141
  f"{self.value_name} with value {self.value} is noy supported as of now, "
@@ -126,35 +143,25 @@ class InvalidSupportedType(Exception):
126
143
  )
127
144
 
128
145
 
129
- class MissingRequiredKey(Exception):
146
+ class MissingRequiredKey(CustomException):
130
147
  def __init__(self, field_name, missing_key):
131
- super().__init__(f"Missing required key '{missing_key}' in {field_name}.")
132
-
133
-
134
- class MissingRequiredKeys(Exception):
135
- def __init__(self, field_name, missing_keys):
136
- super().__init__(f"Missing required keys '{missing_keys}' in {field_name}.")
137
-
138
-
139
- class InvalidVectorLength(Exception):
140
- def __init__(self, field_name, length, max_length):
141
- super().__init__(
142
- f"Invalid vector length for {field_name}: maximum length is {max_length}, got {length}."
143
- )
148
+ self.field_name = field_name
149
+ self.missing_key = missing_key
144
150
 
151
+ def __repr__(self) -> str:
152
+ return "Missing_Required_Key"
145
153
 
146
- class InvalidConfiguration(Exception):
147
- def __init__(self, message):
148
- super().__init__(f"Invalid configuration: {message}")
154
+ def error_message(self) -> str:
155
+ return f"Missing required key '{self.missing_key}' in {self.field_name}."
149
156
 
150
157
 
151
- class InvalidOption(Exception):
152
- def __init__(self, option, key):
153
- super().__init__(f"Invalid option {option} for key {key}")
158
+ class MissingRequiredKeyForEvalTemplate(CustomException):
159
+ def __init__(self, missing_key, eval_template_name):
160
+ self.missing_key = missing_key
161
+ self.eval_template_name = eval_template_name
154
162
 
163
+ def __repr__(self) -> str:
164
+ return "Missing_Required_Key_For_Eval_Template"
155
165
 
156
- class MissingRequiredKeyForEvalTemplate(Exception):
157
- def __init__(self, missing_key, eval_template_name):
158
- super().__init__(
159
- f"Missing required key '{missing_key}' for eval template {eval_template_name}."
160
- )
166
+ def error_message(self) -> str:
167
+ return f"Missing required key '{self.missing_key}' for eval template {self.eval_template_name}."
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "futureagi"
3
- version = "0.3.0"
3
+ version = "0.3.2"
4
4
  description = "We help GenAI teams maintain high-accuracy for their Models in production."
5
5
  authors = ["Future AGI <no-reply@futureagi.com>"]
6
6
  readme = "README.md"
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