Skip to content

Commit 13e8329

Browse files
committed
feat: add indexing and chunking to the API
1 parent 96e8d74 commit 13e8329

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

api.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,10 @@ async def index_project(request: IndexRequest):
640640
chroma_client = get_chroma_client()
641641
logger.info("Initialized Chroma client")
642642
except Exception as e:
643-
logger.error(f"Failed to initialize Chroma client: {e}")
643+
logger.error(f"Failed to initialize Chroma client: {e!s}")
644644
raise HTTPException(
645645
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
646-
detail=f"Failed to initialize Chroma client: {str(e)}",
646+
detail=f"Failed to initialize Chroma client: {e!s}",
647647
) from e
648648

649649
# Get or create collection
@@ -661,10 +661,10 @@ async def index_project(request: IndexRequest):
661661
collection = chroma_client.get_or_create_collection(name=collection_name)
662662
logger.info(f"Using collection: {collection_name}")
663663
except Exception as e:
664-
logger.error(f"Failed to create collection: {e}")
664+
logger.error(f"Failed to create collection: {e!s}")
665665
raise HTTPException(
666666
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
667-
detail=f"Failed to create collection: {str(e)}",
667+
detail=f"Failed to create collection: {e!s}",
668668
) from e
669669

670670
# Path to the Ignition project
@@ -689,7 +689,6 @@ async def index_project(request: IndexRequest):
689689
max_tokens_per_minute = 80000 # Conservative limit below OpenAI's 100K TPM
690690

691691
# Set limits for chunking
692-
max_chunk_size = 7000
693692
hard_token_limit = 7500
694693

695694
# Helper function for character chunking (copied from main.py)

0 commit comments

Comments
 (0)