Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
emrgnt-cmplxty committed Jan 22, 2025
1 parent 50d1967 commit c199b8e
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 1,021 deletions.
4 changes: 3 additions & 1 deletion py/core/agent/rag.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# rag_agent.py
from typing import Any, Callable, Optional

import tiktoken
Expand Down Expand Up @@ -314,6 +313,8 @@ def __init__(
rag_generation_config: GenerationConfig,
local_search_method: Callable,
content_method: Optional[Callable] = None,
max_tool_context_length: int = 10_000,

):
# Initialize base R2RAgent
R2RAgent.__init__(
Expand All @@ -331,6 +332,7 @@ def __init__(
config=config,
search_settings=search_settings,
rag_generation_config=rag_generation_config,
max_tool_context_length=max_tool_context_length,
local_search_method=local_search_method,
content_method=content_method,
)
Expand Down
1 change: 1 addition & 0 deletions py/core/main/api/v3/chunks_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
providers: R2RProviders,
services: R2RServices,
):
logging.info("Initializing ChunksRouter")
super().__init__(providers, services)

def _setup_routes(self):
Expand Down
1 change: 1 addition & 0 deletions py/core/main/api/v3/collections_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ async def authorize_collection_action(

class CollectionsRouter(BaseRouterV3):
def __init__(self, providers: R2RProviders, services: R2RServices):
logging.info("Initializing CollectionsRouter")
super().__init__(providers, services)

def _setup_routes(self):
Expand Down
1 change: 1 addition & 0 deletions py/core/main/api/v3/conversations_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(
providers: R2RProviders,
services: R2RServices,
):
logging.info("Initializing ConversationsRouter")
super().__init__(providers, services)

def _setup_routes(self):
Expand Down
6 changes: 1 addition & 5 deletions py/core/main/api/v3/documents_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def __init__(
providers: R2RProviders,
services: R2RServices,
):
logging.info("Initializing DocumentsRouter")
super().__init__(providers, services)
self._register_workflows()

Expand Down Expand Up @@ -130,11 +131,6 @@ def _register_workflows(self):
if self.providers.orchestration.config.provider != "simple"
else "Document created and ingested successfully."
),
"update-files": (
"Update file task queued successfully."
if self.providers.orchestration.config.provider != "simple"
else "Update task queued successfully."
),
"update-chunk": (
"Update chunk task queued successfully."
if self.providers.orchestration.config.provider != "simple"
Expand Down
1 change: 1 addition & 0 deletions py/core/main/api/v3/graph_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(
providers: R2RProviders,
services: R2RServices,
):
logging.info("Initializing GraphRouter")
super().__init__(providers, services)
self._register_workflows()

Expand Down
2 changes: 1 addition & 1 deletion py/core/main/api/v3/indices_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from core.base import IndexConfig, R2RException
from core.base.abstractions import VectorTableName
from core.base.api.models import (
GenericMessageResponse,
WrappedGenericMessageResponse,
WrappedListVectorIndicesResponse,
)
Expand All @@ -28,6 +27,7 @@ def __init__(
providers: R2RProviders,
services: R2RServices,
):
logging.info("Initializing IndicesRouter")
super().__init__(providers, services)

def _setup_routes(self):
Expand Down
1 change: 1 addition & 0 deletions py/core/main/api/v3/logs_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(
providers: R2RProviders,
services: R2RServices,
):
logging.info("Initializing LogsRouter")
super().__init__(providers, services)
CURRENT_DIR = Path(__file__).resolve().parent
TEMPLATES_DIR = CURRENT_DIR.parent / "templates"
Expand Down
2 changes: 2 additions & 0 deletions py/core/main/api/v3/prompts_router.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import textwrap
from typing import Optional

Expand All @@ -23,6 +24,7 @@ def __init__(
providers: R2RProviders,
services: R2RServices,
):
logging.info("Initializing PromptsRouter")
super().__init__(providers, services)

def _setup_routes(self):
Expand Down
2 changes: 2 additions & 0 deletions py/core/main/api/v3/retrieval_router.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import textwrap
from typing import Any, Optional
from uuid import UUID
Expand Down Expand Up @@ -46,6 +47,7 @@ def __init__(
providers: R2RProviders,
services: R2RServices,
):
logging.info("Initializing RetrievalRouterV3")
super().__init__(providers, services)

def _register_workflows(self):
Expand Down
6 changes: 3 additions & 3 deletions py/core/main/api/v3/system_router.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import logging
import textwrap
from datetime import datetime, timezone
from typing import Optional

import psutil
from fastapi import Depends, Query
from fastapi import Depends

from core.base import R2RException
from core.base.api.models import (
GenericMessageResponse,
WrappedGenericMessageResponse,
WrappedLogsResponse,
WrappedServerStatsResponse,
WrappedSettingsResponse,
)
Expand All @@ -24,6 +23,7 @@ def __init__(
providers: R2RProviders,
services: R2RServices,
):
logging.info("Initializing SystemRouter")
super().__init__(providers, services)
self.start_time = datetime.now(timezone.utc)

Expand Down
4 changes: 3 additions & 1 deletion py/core/main/api/v3/users_router.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import logging
import os
import textwrap
import urllib.parse
from typing import Optional
from uuid import UUID

import requests
from fastapi import Body, Depends, HTTPException, Path, Query, Request
from fastapi import Body, Depends, HTTPException, Path, Query
from fastapi.background import BackgroundTasks
from fastapi.responses import FileResponse
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
Expand Down Expand Up @@ -38,6 +39,7 @@

class UsersRouter(BaseRouterV3):
def __init__(self, providers: R2RProviders, services: R2RServices):
logging.info("Initializing UsersRouter")
super().__init__(providers, services)
self.google_client_id = os.environ.get("GOOGLE_CLIENT_ID")
self.google_client_secret = os.environ.get("GOOGLE_CLIENT_SECRET")
Expand Down
6 changes: 3 additions & 3 deletions py/core/main/orchestration/hatchet/ingestion_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def parse(self, context: Context) -> dict:

ingestion_config = parsed_data["ingestion_config"] or {}
extractions_generator = (
await self.ingestion_service.parse_file(
self.ingestion_service.parse_file(
document_info, ingestion_config
)
)
Expand Down Expand Up @@ -147,7 +147,7 @@ async def parse(self, context: Context) -> dict:
status=IngestionStatus.STORING,
)

storage_generator = await self.ingestion_service.store_embeddings( # type: ignore
storage_generator = self.ingestion_service.store_embeddings( # type: ignore
embeddings
)

Expand Down Expand Up @@ -413,7 +413,7 @@ async def embed(self, context: Context) -> dict:
document_info, status=IngestionStatus.STORING
)

storage_generator = await self.ingestion_service.store_embeddings(
storage_generator = self.ingestion_service.store_embeddings(
embeddings
)
async for _ in storage_generator:
Expand Down
Loading

0 comments on commit c199b8e

Please sign in to comment.