julee.services.knowledge_service.factory

Factory function for creating KnowledgeService implementations.

This module provides the factory function for creating configured KnowledgeService instances based on the service API configuration.

Classes

ConfigurableKnowledgeService

KnowledgeService implementation that uses the factory pattern.

Functions

knowledge_service_factory(knowledge_service_config)

Create a configured KnowledgeService instance.

Module Contents

class julee.services.knowledge_service.factory.ConfigurableKnowledgeService[source]

Bases: julee.services.knowledge_service.knowledge_service.KnowledgeService

KnowledgeService implementation that uses the factory pattern.

This class implements the KnowledgeService protocol by delegating to a factory-created service instance. It can be wrapped by temporal decorators while maintaining proper protocol compliance.

No constructor configuration is required - the factory is called within each method using the provided config parameter.

async execute_query(config, query_text, output_schema=None, service_file_ids=None, query_metadata=None, assistant_prompt=None)[source]

Execute a query against the knowledge service.

async register_file(config, document)[source]

Register a document with the knowledge service.

julee.services.knowledge_service.factory.knowledge_service_factory(knowledge_service_config)[source]

Create a configured KnowledgeService instance.

This factory function takes a KnowledgeServiceConfig domain object (containing metadata and service_api information) and returns a properly configured KnowledgeService implementation that can handle external operations.

Parameters:

knowledge_service_config (julee.domain.models.knowledge_service_config.KnowledgeServiceConfig) – KnowledgeServiceConfig domain object with configuration and API information

Returns:

Configured KnowledgeService implementation ready for external operations

Raises:

ValueError – If the service_api is not supported

Return type:

julee.services.knowledge_service.knowledge_service.KnowledgeService

Example

>>> from julee.domain import KnowledgeServiceConfig
>>> from julee.domain.models.knowledge_service_config import (
...     ServiceApi
... )
>>> config = KnowledgeServiceConfig(
...     knowledge_service_id="ks-123",
...     name="My Anthropic Service",
...     description="Anthropic-powered document analysis",
...     service_api=ServiceApi.ANTHROPIC
... )
>>> service = knowledge_service_factory(config)
>>> result = await service.register_file(document)