Skip to content

Commit ff7bd17

Browse files
committed
RDBC-1059 Add MissingAiAgentParameterException, IMAGE field, Azure endpoint validation
1 parent 5ab3087 commit ff7bd17

4 files changed

Lines changed: 9 additions & 17 deletions

File tree

ravendb/documents/ai/content_part.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,16 @@
33

44

55
class AiMessagePromptFields:
6-
"""Constants for AI message prompt field names."""
7-
86
TEXT = "text"
97
TYPE = "type"
8+
IMAGE = "image"
109

1110

1211
class AiMessagePromptTypes:
13-
"""Constants for AI message prompt types."""
14-
1512
TEXT = "text"
1613

1714

1815
class ContentPart:
19-
"""
20-
Base class for content parts in AI prompts.
21-
Content parts allow structured prompt content with different types (text, etc.).
22-
"""
23-
2416
def __init__(self, content_type: str):
2517
self._type = content_type
2618

@@ -29,18 +21,10 @@ def type(self) -> str:
2921
return self._type
3022

3123
def to_json(self) -> Dict[str, Any]:
32-
"""
33-
Converts the content part to a JSON-serializable dictionary.
34-
Subclasses should override this method to include their specific fields.
35-
"""
3624
return {AiMessagePromptFields.TYPE: self._type}
3725

3826

3927
class TextPart(ContentPart):
40-
"""
41-
Represents a text content part in AI prompts.
42-
"""
43-
4428
def __init__(self, text: str):
4529
super().__init__(AiMessagePromptTypes.TEXT)
4630
self._text = text

ravendb/documents/operations/ai/azure_open_ai_settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def __init__(
1717
super().__init__(api_key, endpoint, model, dimensions, temperature, embeddings_max_concurrent_batches)
1818
if deployment_name is None:
1919
raise ValueError("deployment_name cannot be None")
20+
if endpoint is None or (isinstance(endpoint, str) and endpoint.strip() == ""):
21+
raise ValueError("endpoint cannot be None or empty")
2022
self.deployment_name = deployment_name
2123

2224
@classmethod

ravendb/exceptions/exception_dispatcher.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
ConcurrencyException,
1616
IndexCompactionInProgressException,
1717
InsufficientQuotaException,
18+
MissingAiAgentParameterException,
1819
PortInUseException,
1920
RateLimitException,
2021
RavenException,
@@ -44,6 +45,7 @@
4445
"RateLimitException": RateLimitException,
4546
"InsufficientQuotaException": InsufficientQuotaException,
4647
"TooManyTokensException": TooManyTokensException,
48+
"MissingAiAgentParameterException": MissingAiAgentParameterException,
4749
# documents
4850
"DocumentConflictException": DocumentConflictException,
4951
"DocumentDoesNotExistException": DocumentDoesNotExistException,

ravendb/exceptions/raven_exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ class TooManyTokensException(TooManyRequestsException):
8282
pass
8383

8484

85+
class MissingAiAgentParameterException(RavenException):
86+
pass
87+
88+
8589
class SchemaValidationException(RavenException):
8690
def __init__(self, message: str = None):
8791
super().__init__(message)

0 commit comments

Comments
 (0)