Skip to content

Commit

Permalink
update engine path - Adithya S Kolavi
Browse files Browse the repository at this point in the history
  • Loading branch information
adithya-s-k committed Aug 27, 2024
1 parent 2475699 commit b431d3a
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 29 deletions.
2 changes: 1 addition & 1 deletion backend/app/api/admin/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from llama_index.core.ingestion import IngestionPipeline
from llama_index.core.node_parser import SentenceSplitter
from llama_index.core.settings import Settings
from app.engine.vectordb import get_vector_store
from app.api.chat.engine.vectordb import get_vector_store
from llama_index.core import SimpleDirectoryReader
from llama_index.core.schema import Document

Expand Down
10 changes: 0 additions & 10 deletions backend/app/api/chat/chat_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@
logger = logging.getLogger("uvicorn")


# @r.get("")
# async def chat_config() -> ChatConfig:
# starter_questions = None
# # conversation_starters = os.getenv("CONVERSATION_STARTERS")
# conversation_starters = "Tell me about CognitiveLab \n What are some open source projects \n Tell me about Open Source AI \n What are AI Agents"
# if conversation_starters and conversation_starters.strip():
# starter_questions = conversation_starters.strip().split("\n")
# return ChatConfig(starter_questions=starter_questions)


@r.get("")
async def chat_config() -> ChatConfig:
return await config_service.get_chat_config()
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

from app.engine.index import get_index
from app.engine.node_postprocessors import NodeCitationProcessor
from app.api.chat.engine.index import get_index
from app.api.chat.engine.node_postprocessors import NodeCitationProcessor
from fastapi import HTTPException
from llama_index.core.chat_engine import CondensePlusContextChatEngine

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import logging
import os

from app.engine.loaders import get_documents
from app.engine.vectordb import get_vector_store
from app.api.chat.engine.loaders import get_documents
from app.api.chat.engine.vectordb import get_vector_store
from app.settings import init_settings
from llama_index.core.ingestion import IngestionPipeline
from llama_index.core.node_parser import SentenceSplitter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from llama_index.core.indices import VectorStoreIndex
from app.engine.vectordb import get_vector_store
from app.api.chat.engine.vectordb import get_vector_store


logger = logging.getLogger("uvicorn")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import logging

import yaml
from app.engine.loaders.db import DBLoaderConfig, get_db_documents
from app.engine.loaders.file import FileLoaderConfig, get_file_documents
from app.engine.loaders.web import WebLoaderConfig, get_web_documents
from app.api.chat.engine.loaders.db import DBLoaderConfig, get_db_documents
from app.api.chat.engine.loaders.file import FileLoaderConfig, get_file_documents
from app.api.chat.engine.loaders.web import WebLoaderConfig, get_web_documents

logger = logging.getLogger(__name__)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions backend/app/api/chat/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
SourceNodes,
)
from app.api.chat.vercel_response import VercelStreamResponse
from app.engine import get_chat_engine
from app.engine.query_filter import generate_filters
from app.api.chat.engine import get_chat_engine
from app.api.chat.engine.query_filter import generate_filters
from app.models.user_model import User
from app.core.user import get_current_user
from app.api.chat.summary import summary_generator
Expand Down Expand Up @@ -184,7 +184,7 @@ async def enhanced_content_generator():
# ):
# try:
# # Start background tasks to download documents from LlamaCloud if needed
# from app.engine.service import LLamaCloudFileService
# from app.api.chat.engine.service import LLamaCloudFileService

# LLamaCloudFileService.download_files_from_nodes(nodes, background_tasks)
# except ImportError:
Expand Down
8 changes: 4 additions & 4 deletions backend/app/api/chat/services/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, List, Tuple


from app.engine.index import get_index
from app.api.chat.engine.index import get_index
from llama_index.core import VectorStoreIndex
from llama_index.core.ingestion import IngestionPipeline
from llama_index.core.readers.file.base import (
Expand All @@ -18,8 +18,8 @@


def get_llamaparse_parser():
from app.engine.loaders import load_configs
from app.engine.loaders.file import FileLoaderConfig, llama_parse_parser
from app.api.chat.engine.loaders import load_configs
from app.api.chat.engine.loaders.file import FileLoaderConfig, llama_parse_parser

config = load_configs()
file_loader_config = FileLoaderConfig(**config["file"])
Expand Down Expand Up @@ -81,7 +81,7 @@ def process_file(file_name: str, base64_content: str, params: Any) -> List[str]:

# Insert the documents into the index
if isinstance(current_index, LlamaCloudIndex):
from app.engine.service import LLamaCloudFileService
from app.api.chat.engine.service import LLamaCloudFileService

project_id = current_index._get_project_id()
pipeline_id = current_index._get_pipeline_id()
Expand Down
4 changes: 2 additions & 2 deletions backend/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class Settings(BaseSettings):
JWT_SECRET_KEY: str = config("JWT_SECRET_KEY", cast=str)
JWT_REFRESH_SECRET_KEY: str = config("JWT_REFRESH_SECRET_KEY", cast=str)
ALGORITHM: ClassVar[str] = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24
REFRESH_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7 days
BACKEND_CORS_ORIGINS: List[AnyHttpUrl] = ["http://localhost:3000"]
PROJECT_NAME: str = "FODOIST"
PROJECT_NAME: str = "RAGSAAS"
COOKIE_SECURE: bool = False

# Database
Expand Down
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = [ "Adithya S K <Adithyaskolavi@gmail.com>" ]
readme = "README.md"

[tool.poetry.scripts]
generate = "app.engine.generate:generate_datasource"
generate = "app.api.chat.engine.generate:generate_datasource"

[tool.poetry.dependencies]
python = ">=3.11,<3.12"
Expand Down

0 comments on commit b431d3a

Please sign in to comment.