Fix formatiing

This commit is contained in:
Andrej Milicevic 2025-09-17 10:45:36 +02:00
parent 30df102656
commit 293a0e0053
3 changed files with 19 additions and 23 deletions

View file

@ -94,11 +94,7 @@ class OllamaEmbeddingEngine(EmbeddingEngine):
""" """
Internal method to call the Ollama embeddings endpoint for a single prompt. Internal method to call the Ollama embeddings endpoint for a single prompt.
""" """
payload = { payload = {"model": self.model, "prompt": prompt, "input": prompt}
"model": self.model,
"prompt": prompt,
"input": prompt
}
headers = {} headers = {}
api_key = os.getenv("LLM_API_KEY") api_key = os.getenv("LLM_API_KEY")
if api_key: if api_key:

View file

@ -12,16 +12,16 @@ async def get_authorized_dataset_by_name(
dataset_name: str, user: User, permission_type: str dataset_name: str, user: User, permission_type: str
) -> Optional[Dataset]: ) -> Optional[Dataset]:
""" """
Get a specific dataset with the given name, with permissions for a given user. Get a specific dataset with the given name, with permissions for a given user.
Args: Args:
dataset_name: Name of the dataset. dataset_name: Name of the dataset.
user: User object. user: User object.
permission_type (str): permission type(read, write, delete, share), default is read permission_type (str): permission type(read, write, delete, share), default is read
Returns: Returns:
Optional[Dataset]: dataset with permissions Optional[Dataset]: dataset with permissions
""" """
authorized_datasets = await get_authorized_existing_datasets([], permission_type, user) authorized_datasets = await get_authorized_existing_datasets([], permission_type, user)
return next((dataset for dataset in authorized_datasets if dataset.name == dataset_name), None) return next((dataset for dataset in authorized_datasets if dataset.name == dataset_name), None)

View file

@ -12,18 +12,18 @@ from cognee.modules.data.methods import (
async def resolve_authorized_user_dataset(dataset_id: UUID, dataset_name: str, user: User): async def resolve_authorized_user_dataset(dataset_id: UUID, dataset_name: str, user: User):
""" """
Function handles creation and dataset authorization if dataset already exist for Cognee. Function handles creation and dataset authorization if dataset already exist for Cognee.
Verifies that provided user has necessary permission for provided Dataset. Verifies that provided user has necessary permission for provided Dataset.
If Dataset does not exist creates the Dataset and gives permission for the user creating the dataset. If Dataset does not exist creates the Dataset and gives permission for the user creating the dataset.
Args: Args:
dataset_id: Id of the dataset. dataset_id: Id of the dataset.
dataset_name: Name of the dataset. dataset_name: Name of the dataset.
user: Cognee User request is being processed for, if None default user will be used. user: Cognee User request is being processed for, if None default user will be used.
Returns: Returns:
Tuple[User, Dataset]: A tuple containing the user and the authorized dataset. Tuple[User, Dataset]: A tuple containing the user and the authorized dataset.
""" """
if not user: if not user:
user = await get_default_user() user = await get_default_user()