AMQ Adapter with CleverBRAG integration - compatibility check #23

Open
opened 2025-04-28 15:03:51 +00:00 by stanislav.hejny · 1 comment

Ref epic: CleverBRAG Onboarding #59

in order to complete the CleverBRAG - CleverMicro onboarding and integration, the CleverBRAG specific code must be developed for python-based adapter, that connects the generic adapter logic with CleverBRAG own endpoints.

There will be new file, clever_brag.adapter.py that will be included into CleverBRAG source code, which will initialize and start AMQ Adapter thread and provide the FastAPI public endpoints discovery logic.

At this time, I have identified a need for minor change in CleverBRAG code needed for AMQ Adapter. In order to convert JWT token to valid User object, the AMQAdapter code needs access to R2RAuthProvider instance that the FastAPI uses for the same purpose. However it seems that the Providers container is a temporary local variable, not exposed after the R2RApp is built.

In order to expose the R2RAuthProvider instance to AMQ Adapter, can you please add providers: R2RProviders as another init parameter for R2RApp object:

    def __init__(
        self,
        config: R2RConfig,
        orchestration_provider: (
            HatchetOrchestrationProvider | SimpleOrchestrationProvider
        ),
        chunks_router: ChunksRouter,
        collections_router: CollectionsRouter,
        conversations_router: ConversationsRouter,
        documents_router: DocumentsRouter,
        graph_router: GraphRouter,
        indices_router: IndicesRouter,
        logs_router: LogsRouter,
        prompts_router: PromptsRouter,
        retrieval_router_v3: RetrievalRouterV3,
        system_router: SystemRouter,
        users_router: UsersRouter,
        providers: R2RProviders
    ):
        self.config = config
        self.chunks_router = chunks_router
        self.collections_router = collections_router
        self.conversations_router = conversations_router
        self.documents_router = documents_router
        self.graph_router = graph_router
        self.indices_router = indices_router
        self.logs_router = logs_router
        self.orchestration_provider = orchestration_provider
        self.prompts_router = prompts_router
        self.retrieval_router_v3 = retrieval_router_v3
        self.system_router = system_router
        self.users_router = users_router
        self.providers = providers

and than also pass in the providers as input in py/core/main/assembly/builder.py, line #296:

        return R2RApp(
            config=self.config,
            orchestration_provider=orchestration_provider,
            providers=providers,
            **routers,
        )

this new attribute will be used like this:

    r2rapp = await create_r2r_app()  # Existing factory function to create R2RApp instance
    
    # Command to instantiate and initialise AMQAdapter
    adapter: CleverBragAmqpAdapter = CleverBragAmqpAdapter(AMQConfiguration(''), r2rapp.app.routes, r2rapp.providers.auth)
Ref epic: [CleverBRAG Onboarding #59](https://git.cleverthis.com/clevermicro/clevermicro/issues/59) in order to complete the CleverBRAG - CleverMicro onboarding and integration, the CleverBRAG specific code must be developed for python-based adapter, that connects the generic adapter logic with CleverBRAG own endpoints. There will be new file, clever_brag.adapter.py that will be included into CleverBRAG source code, which will initialize and start AMQ Adapter thread and provide the FastAPI public endpoints discovery logic. At this time, I have identified a need for minor change in CleverBRAG code needed for AMQ Adapter. In order to convert JWT token to valid `User` object, the AMQAdapter code needs access to R2RAuthProvider instance that the FastAPI uses for the same purpose. However it seems that the Providers container is a temporary local variable, not exposed after the R2RApp is built. In order to expose the R2RAuthProvider instance to AMQ Adapter, can you please add `providers: R2RProviders` as another init parameter for R2RApp object: ```class R2RApp: def __init__( self, config: R2RConfig, orchestration_provider: ( HatchetOrchestrationProvider | SimpleOrchestrationProvider ), chunks_router: ChunksRouter, collections_router: CollectionsRouter, conversations_router: ConversationsRouter, documents_router: DocumentsRouter, graph_router: GraphRouter, indices_router: IndicesRouter, logs_router: LogsRouter, prompts_router: PromptsRouter, retrieval_router_v3: RetrievalRouterV3, system_router: SystemRouter, users_router: UsersRouter, providers: R2RProviders ): self.config = config self.chunks_router = chunks_router self.collections_router = collections_router self.conversations_router = conversations_router self.documents_router = documents_router self.graph_router = graph_router self.indices_router = indices_router self.logs_router = logs_router self.orchestration_provider = orchestration_provider self.prompts_router = prompts_router self.retrieval_router_v3 = retrieval_router_v3 self.system_router = system_router self.users_router = users_router self.providers = providers ``` and than also pass in the providers as input in py/core/main/assembly/builder.py, line #296: ``` return R2RApp( config=self.config, orchestration_provider=orchestration_provider, providers=providers, **routers, ) ``` this new attribute will be used like this: ``` r2rapp = await create_r2r_app() # Existing factory function to create R2RApp instance # Command to instantiate and initialise AMQAdapter adapter: CleverBragAmqpAdapter = CleverBragAmqpAdapter(AMQConfiguration(''), r2rapp.app.routes, r2rapp.providers.auth) ```
Owner

@stanislav.hejny @aleenaumair

This ticket does not have points assigned, therefore can not be MoSCoWed.

This ticket is lacking priority (which needs to be set to backlog) as well as a milestone.

I am also curious why this is a CleverMicro ticket, it should be a CleverBrag ticket no?

@stanislav.hejny @aleenaumair This ticket does not have points assigned, therefore can not be MoSCoWed. This ticket is lacking priority (which needs to be set to backlog) as well as a milestone. I am also curious why this is a CleverMicro ticket, it should be a CleverBrag ticket no?
aleenaumair added this to the V.01 milestone 2025-05-06 10:18:12 +00:00
stanislav.hejny changed title from AMQ Adapter with CleverBRAG integration to AMQ Adapter with CleverBRAG integration - compatibility check 2025-05-06 20:13:49 +00:00
khird was assigned by stanislav.hejny 2025-05-06 22:46:52 +00:00
Sign in to join this conversation.
No milestone
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
You do not have permission to read 1 dependency
Reference: clevermicro/amq-adapter-python#23
No description provided.