Skip to content
10 changes: 4 additions & 6 deletions .github/workflows/RavenClient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
RAVENDB_PYTHON_TEST_SERVER_CERTIFICATE_PATH: certs/server.pfx
RAVENDB_PYTHON_TEST_CLIENT_CERTIFICATE_PATH: certs/python.pem
RAVENDB_PYTHON_TEST_CA_PATH: /usr/local/share/ca-certificates/ca.crt
RAVENDB_PYTHON_TEST_HTTPS_SERVER_URL: https://localhost:7326
RAVENDB_PYTHON_TEST_HTTPS_SERVER_URL: https://localhost:8081

strategy:
matrix:
python-version: [ '3.9', '3.10' ,'3.11', '3.12']
serverVersion: [ '7.1' ]
python-version: [ '3.10' ,'3.11', '3.12', '3.13', '3.14']
serverVersion: [ '7.1', '7.2' ]
fail-fast: false

steps:
Expand All @@ -54,7 +54,7 @@ jobs:

- run: mkdir certs
- run: openssl genrsa -out certs/ca.key 2048
- run: openssl req -new -x509 -key certs/ca.key -out certs/ca.crt -subj "/C=US/ST=Arizona/L=Nevada/O=RavenDB Test CA/OU=RavenDB test CA/CN=localhost/[email protected]" -addext "basicConstraints = CA:TRUE" -addext "keyUsage = digitalSignature,keyCertSign"
- run: openssl req -new -x509 -key certs/ca.key -out certs/ca.crt -subj "/C=US/ST=Arizona/L=Nevada/O=RavenDB Test CA/OU=RavenDB test CA/CN=localhost/[email protected]" -addext "basicConstraints = critical, CA:TRUE" -addext "keyUsage = critical, digitalSignature, keyCertSign"
- run: openssl genrsa -out certs/localhost.key 2048
- run: openssl req -new -key certs/localhost.key -out certs/localhost.csr -subj "/C=US/ST=Arizona/L=Nevada/O=RavenDB Test/OU=RavenDB test/CN=localhost/[email protected]" -addext "subjectAltName = DNS:localhost"
- run: openssl x509 -req -extensions ext -extfile cert/test_cert.conf -in certs/localhost.csr -CA certs/ca.crt -CAkey certs/ca.key -CAcreateserial -out certs/localhost.crt
Expand Down Expand Up @@ -85,11 +85,9 @@ jobs:
run: mkdir RavenDB/Server/certs && cp certs/server.pfx RavenDB/Server/certs/

- name: Install black linter
if: ${{ matrix.python-version != '3.7' }}
run: pip install black

- name: Check code format
if: ${{ matrix.python-version != '3.7' }}
run: black --check .

- name: Run tests
Expand Down
1 change: 1 addition & 0 deletions ravendb/documents/conventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def __init__(self):
self.wait_for_indexes_after_save_changes_timeout = timedelta(seconds=15)
self.wait_for_replication_after_save_changes_timeout = timedelta(seconds=15)
self.wait_for_non_stale_results_timeout = timedelta(seconds=15)
self.max_empty_lines_in_jsonl_stream = 100

# Balancing
self._load_balancer_context_seed: Optional[int] = None
Expand Down
1 change: 0 additions & 1 deletion ravendb/documents/indexes/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from ravendb.documents.indexes.spatial.configuration import SpatialOptions, SpatialOptionsFactory
from ravendb.primitives import constants


_T_IndexDefinition = TypeVar("_T_IndexDefinition", bound=IndexDefinition)


Expand Down
4 changes: 2 additions & 2 deletions ravendb/documents/operations/ai/abstract_ai_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@


class AbstractAiSettings(ABC):
def __init__(self):
self.embeddings_max_concurrent_batches = None
def __init__(self, embeddings_max_concurrent_batches: int = None):
self.embeddings_max_concurrent_batches = embeddings_max_concurrent_batches

@classmethod
@abstractmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from ravendb.http.server_node import ServerNode
import requests


if TYPE_CHECKING:
from ravendb.documents.operations.ai.agents.ai_agent_configuration import AiAgentConfiguration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from ravendb.http.misc import ResponseDisposeHandling
from ravendb.documents.ai.content_part import ContentPart


TSchema = TypeVar("TSchema")


Expand Down
7 changes: 6 additions & 1 deletion ravendb/documents/operations/ai/azure_open_ai_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ def __init__(
deployment_name: str = None,
dimensions: int = None,
temperature: float = None,
embeddings_max_concurrent_batches: int = None,
):
super().__init__(api_key, endpoint, model, dimensions, temperature)
super().__init__(api_key, endpoint, model, dimensions, temperature, embeddings_max_concurrent_batches)
if deployment_name is None:
raise ValueError("deployment_name cannot be None")
self.deployment_name = deployment_name
Expand All @@ -27,6 +28,9 @@ def from_json(cls, json_dict: Dict[str, Any]) -> "AzureOpenAiSettings":
dimensions=json_dict["Dimensions"] if "Dimensions" in json_dict else None,
temperature=json_dict["Temperature"] if "Temperature" in json_dict else None,
deployment_name=json_dict["DeploymentName"] if "DeploymentName" in json_dict else None,
embeddings_max_concurrent_batches=(
json_dict["EmbeddingsMaxConcurrentBatches"] if "EmbeddingsMaxConcurrentBatches" in json_dict else None
),
)

def to_json(self) -> Dict[str, Any]:
Expand All @@ -37,4 +41,5 @@ def to_json(self) -> Dict[str, Any]:
"Dimensions": self.dimensions,
"Temperature": self.temperature,
"DeploymentName": self.deployment_name,
"EmbeddingsMaxConcurrentBatches": self.embeddings_max_concurrent_batches,
}
12 changes: 9 additions & 3 deletions ravendb/documents/operations/ai/embedded_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@


class EmbeddedSettings(AbstractAiSettings):
def __init__(self):
super().__init__()
def __init__(self, embeddings_max_concurrent_batches: int = None):
super().__init__(embeddings_max_concurrent_batches)

@classmethod
def from_json(cls, json_dict: Dict[str, Any]) -> "EmbeddedSettings":
return cls()
return cls(
embeddings_max_concurrent_batches=(
json_dict.get("EmbeddingsMaxConcurrentBatches")
if json_dict.get("EmbeddingsMaxConcurrentBatches")
else None
),
)

def to_json(self) -> Dict[str, Any]:
return {"EmbeddingsMaxConcurrentBatches": self.embeddings_max_concurrent_batches}
20 changes: 14 additions & 6 deletions ravendb/documents/operations/ai/google_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ class GoogleAiVersion(Enum):

class GoogleSettings(AbstractAiSettings):
def __init__(
self, model: str = None, api_key: str = None, ai_version: GoogleAiVersion = None, dimensions: int = None
self,
model: str = None,
api_key: str = None,
ai_version: GoogleAiVersion = None,
dimensions: int = None,
embeddings_max_concurrent_batches: int = None,
):
super().__init__()
super().__init__(embeddings_max_concurrent_batches)
self.model = model
self.api_key = api_key
self.ai_version = ai_version
Expand All @@ -22,10 +27,13 @@ def __init__(
@classmethod
def from_json(cls, json_dict: Dict[str, Any]) -> "GoogleSettings":
return cls(
model=json_dict["Model"],
api_key=json_dict["ApiKey"],
ai_version=GoogleAiVersion(json_dict["AiVersion"]),
dimensions=json_dict["Dimensions"],
model=json_dict["Model"] if "Model" in json_dict else None,
api_key=json_dict["ApiKey"] if "ApiKey" in json_dict else None,
ai_version=GoogleAiVersion(json_dict["AiVersion"]) if "AiVersion" in json_dict else None,
dimensions=json_dict["Dimensions"] if "Dimensions" in json_dict else None,
embeddings_max_concurrent_batches=(
json_dict["EmbeddingsMaxConcurrentBatches"] if "EmbeddingsMaxConcurrentBatches" in json_dict else None
),
)

def to_json(self) -> Dict[str, Any]:
Expand Down
19 changes: 14 additions & 5 deletions ravendb/documents/operations/ai/hugging_face_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@


class HuggingFaceSettings(AbstractAiSettings):
def __init__(self, api_key: str = None, model: str = None, endpoint: str = None):
super().__init__()
def __init__(
self,
api_key: str = None,
model: str = None,
endpoint: str = None,
embeddings_max_concurrent_batches: int = None,
):
super().__init__(embeddings_max_concurrent_batches)
self.api_key = api_key
self.model = model
self.endpoint = endpoint

@classmethod
def from_json(cls, json_dict: Dict[str, Any]) -> "HuggingFaceSettings":
return cls(
api_key=json_dict["ApiKey"],
model=json_dict["Model"],
endpoint=json_dict["Endpoint"],
api_key=json_dict["ApiKey"] if "ApiKey" in json_dict else None,
model=json_dict["Model"] if "Model" in json_dict else None,
endpoint=json_dict["Endpoint"] if "Endpoint" in json_dict else None,
embeddings_max_concurrent_batches=(
json_dict["EmbeddingsMaxConcurrentBatches"] if "EmbeddingsMaxConcurrentBatches" in json_dict else None
),
)

def to_json(self) -> Dict[str, Any]:
Expand Down
19 changes: 14 additions & 5 deletions ravendb/documents/operations/ai/mistral_ai_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@


class MistralAiSettings(AbstractAiSettings):
def __init__(self, api_key: str = None, model: str = None, endpoint: str = None):
super().__init__()
def __init__(
self,
api_key: str = None,
model: str = None,
endpoint: str = None,
embeddings_max_concurrent_batches: int = None,
):
super().__init__(embeddings_max_concurrent_batches)
self.api_key = api_key
self.model = model
self.endpoint = endpoint

@classmethod
def from_json(cls, json_dict: Dict[str, Any]) -> "MistralAiSettings":
return cls(
api_key=json_dict["ApiKey"],
model=json_dict["Model"],
endpoint=json_dict["Endpoint"],
api_key=json_dict["ApiKey"] if "ApiKey" in json_dict else None,
model=json_dict["Model"] if "Model" in json_dict else None,
endpoint=json_dict["Endpoint"] if "Endpoint" in json_dict else None,
embeddings_max_concurrent_batches=(
json_dict["EmbeddingsMaxConcurrentBatches"] if "EmbeddingsMaxConcurrentBatches" in json_dict else None
),
)

def to_json(self) -> Dict[str, Any]:
Expand Down
3 changes: 1 addition & 2 deletions ravendb/documents/operations/ai/ollama_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ def __init__(
temperature: float = None,
embeddings_max_concurrent_batches: int = None,
):
super().__init__()
super().__init__(embeddings_max_concurrent_batches)
self.uri = uri
self.model = model
self.think = think
self.temperature = temperature
self.embeddings_max_concurrent_batches = embeddings_max_concurrent_batches

@classmethod
def from_json(cls, json_dict: Dict[str, Any]) -> "OllamaSettings":
Expand Down
3 changes: 2 additions & 1 deletion ravendb/documents/operations/ai/open_ai_base_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ def __init__(
model: str = None,
dimensions: int = None,
temperature: float = None,
embeddings_max_concurrent_batches: int = None,
):
super().__init__()
super().__init__(embeddings_max_concurrent_batches)
self.api_key = api_key
self.endpoint = endpoint
self.model = model
Expand Down
6 changes: 5 additions & 1 deletion ravendb/documents/operations/ai/open_ai_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ def __init__(
project_id: str = None,
dimensions: int = None,
temperature: float = None,
embeddings_max_concurrent_batches: int = None,
):
super().__init__(api_key, endpoint, model, dimensions, temperature)
super().__init__(api_key, endpoint, model, dimensions, temperature, embeddings_max_concurrent_batches)
self.organization_id = organization_id
self.project_id = project_id

Expand All @@ -28,6 +29,9 @@ def from_json(cls, json_dict: Dict[str, Any]) -> "OpenAiSettings":
temperature=json_dict["Temperature"] if "Temperature" in json_dict else None,
organization_id=json_dict["OrganizationId"] if "OrganizationId" in json_dict else None,
project_id=json_dict["ProjectId"] if "ProjectId" in json_dict else None,
embeddings_max_concurrent_batches=(
json_dict["EmbeddingsMaxConcurrentBatches"] if "EmbeddingsMaxConcurrentBatches" in json_dict else None
),
)

def to_json(self) -> Dict[str, Any]:
Expand Down
8 changes: 7 additions & 1 deletion ravendb/documents/operations/ai/vertex_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ def __init__(
google_credentials_json: Optional[str] = None,
location: Optional[str] = None,
ai_version: Optional[VertexAIVersion] = None,
embeddings_max_concurrent_batches: Optional[int] = None,
):
super().__init__()
super().__init__(embeddings_max_concurrent_batches)
self.model = model
self.google_credentials_json = google_credentials_json
self.location = location
Expand All @@ -30,6 +31,11 @@ def from_json(cls, json_dict: Dict[str, Any]) -> "VertexSettings":
google_credentials_json=json_dict.get("GoogleCredentialsJson"),
location=json_dict.get("Location"),
ai_version=VertexAIVersion(json_dict["AiVersion"]) if json_dict.get("AiVersion") else None,
embeddings_max_concurrent_batches=(
json_dict.get("EmbeddingsMaxConcurrentBatches")
if json_dict.get("EmbeddingsMaxConcurrentBatches")
else None
),
)

def to_json(self) -> Dict[str, Any]:
Expand Down
1 change: 0 additions & 1 deletion ravendb/documents/operations/etl/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from ravendb.documents.operations.etl.transformation import Transformation
import ravendb.serverwide.server_operation_executor


_T = TypeVar("_T", bound=ConnectionString)


Expand Down
14 changes: 10 additions & 4 deletions ravendb/documents/operations/ongoing_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ def get_raft_unique_request_id(self) -> str:
return RaftIdGenerator.new_id()


class GetOngoingTaskInfoOperation(MaintenanceOperation[OngoingTask]):
class GetOngoingTaskInfoOperation(
MaintenanceOperation[Union[OngoingTask, OngoingTaskGenAi, OngoingTaskEmbeddingsGeneration]]
):
"""
Operation to retrieve detailed information about a specific ongoing task.
Ongoing tasks include various types of tasks such as replication, ETL, backup, and subscriptions.
Expand Down Expand Up @@ -398,14 +400,16 @@ def __init__(self, task_id_or_name: Union[int, str], task_type: OngoingTaskType)

self._task_type = task_type

def get_command(self, conventions: "DocumentConventions") -> RavenCommand[OngoingTask]:
def get_command(
self, conventions: "DocumentConventions"
) -> RavenCommand[OngoingTask | OngoingTaskGenAi | OngoingTaskEmbeddingsGeneration]:
if self._task_name is not None:
return GetOngoingTaskInfoOperation._GetOngoingTaskInfoCommand(
task_name=self._task_name, task_type=self._task_type
)
return GetOngoingTaskInfoOperation._GetOngoingTaskInfoCommand(task_id=self._task_id, task_type=self._task_type)

class _GetOngoingTaskInfoCommand(RavenCommand[OngoingTask]):
class _GetOngoingTaskInfoCommand(RavenCommand[OngoingTask | OngoingTaskGenAi | OngoingTaskEmbeddingsGeneration]):
def __init__(
self,
task_type: OngoingTaskType,
Expand All @@ -432,7 +436,9 @@ def set_response(self, response: Optional[str], from_cache: bool) -> None:
json_dict = json.loads(response)
self.result = self._deserialize_task(json_dict)

def _deserialize_task(self, json_dict: dict) -> OngoingTask:
def _deserialize_task(
self, json_dict: dict
) -> OngoingTask | OngoingTaskGenAi | OngoingTaskEmbeddingsGeneration:
"""Deserialize the task based on its type."""
if self._task_type == OngoingTaskType.GEN_AI:
return OngoingTaskGenAi.from_json(json_dict)
Expand Down
1 change: 0 additions & 1 deletion ravendb/documents/operations/revisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from ravendb.documents.session.entity_to_json import EntityToJsonStatic
from ravendb.documents.conventions import DocumentConventions


if TYPE_CHECKING:
from ravendb.http.http_cache import HttpCache
from ravendb import DocumentStore, ServerNode
Expand Down
1 change: 0 additions & 1 deletion ravendb/documents/queries/more_like_this.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from ravendb.primitives import constants
from ravendb.documents.session.tokens.query_tokens.definitions import MoreLikeThisToken


_T = TypeVar("_T")

if TYPE_CHECKING:
Expand Down
Loading