MCPcopy Create free account

hub / github.com/aieng-abdullah/production-rag-assistant / functions

Functions205 in github.com/aieng-abdullah/production-rag-assistant

↓ 17 callersFunction_usage_from_lc_response
Extract token usage from a LangChain response object.
src/generation/chain.py:24
↓ 13 callersFunctioningest
Process a PDF file through the full ingestion pipeline. Steps: 1. Extract text from PDF pages 2. Split pages into chunks
src/ingestion/pipeline.py:13
↓ 11 callersFunctionretrieval
Retrieve relevant text chunks from a vector database using embeddings, using traditional BM25 search and vector search then uses a reranker
src/retrieval/pipeline.py:14
↓ 8 callersFunction_get_vectorstore
Get or initialize the LangChain Chroma vectorstore.
src/db/chroma_client.py:17
↓ 8 callersFunctionchunk_pages
Split pages into chunks while preserving metadata.
src/ingestion/chunker.py:17
↓ 7 callersFunctionrrf_fusion
Combine BM25 and vector search results using Reciprocal Rank Fusion (RRF).
src/retrieval/hybrid_fusion.py:11
↓ 6 callersFunction_build_sources
Convert raw retrieval chunks into Source objects.
src/generation/chain.py:40
↓ 6 callersFunction_invoke_llm
Call LLM providers with retry + exponential backoff + failover. Tries each provider in order (Groq → Anthropic → OpenAI). Each provider gets
src/generation/chain.py:48
↓ 6 callersFunctionbuild_provider_chain
Return providers that have API keys configured, in failover order. Order: Groq (free) → Anthropic → OpenAI. Only includes providers whose API
src/generation/providers.py:15
↓ 6 callersFunctionget_langfuse_client
Return a Langfuse client, or None if tracing is disabled or unavailable.
src/monitoring/langfuse_tracer.py:22
↓ 6 callersFunctionrerank
Rerank chunks against a query using a cross-encoder model.
src/retrieval/cross_encoder.py:16
↓ 5 callersFunction_run_pipeline
Core RAG pipeline: retrieve → build prompt → call LLM → validate citations.
src/generation/chain.py:90
↓ 5 callersFunctioncount_chunks
Return the total number of chunks in the vectorstore without loading them.
src/db/chroma_client.py:93
↓ 5 callersFunctioncreate_langchain_client
Instantiate the LangChain chat model for the given provider. Imports are local so users only need to install the package for providers they a
src/generation/providers.py:42
↓ 5 callersFunctionembed_query
Generate embedding for a single query text. Args: text: The text to embed. Returns: List of float embedding values.
src/ingestion/embedder.py:28
↓ 5 callersFunctionextract_pages
(pdf_path: str, doc_id: Optional[str] = None)
src/ingestion/parser.py:9
↓ 5 callersMethodvalidate
Call this once at app startup. Crashes immediately with a clear message if critical vars are missing. Much better than cra
src/config.py:58
↓ 4 callersFunction_chunks_to_documents
Convert chunk dictionaries to LangChain Documents.
src/retrieval/bm25_index.py:10
↓ 4 callersFunction_get_model
Get or initialize the embedding model.
src/ingestion/embedder.py:15
↓ 4 callersFunction_traced_step
(name: str, fn)
src/retrieval/pipeline.py:27
↓ 4 callersFunctionflush_langfuse
()
src/monitoring/langfuse_tracer.py:59
↓ 4 callersFunctiongenerate
Generate a cited answer for the given query using the RAG pipeline.
src/generation/chain.py:196
↓ 4 callersFunctionhas_chunks
Check if any chunks exist in the vectorstore without loading them.
src/db/chroma_client.py:88
↓ 4 callersFunctionvector_search
Semantic similarity search in vector store. Uses embed_query to embed the query.
src/retrieval/chroma_search.py:11
↓ 3 callersFunction_documents_to_chunks
Convert LangChain Documents back to chunk dictionaries.
src/retrieval/bm25_index.py:27
↓ 3 callersFunction_get_model
()
src/retrieval/cross_encoder.py:7
↓ 3 callersFunctionbm25_search
Search the BM25 index using LangChain retriever.
src/retrieval/bm25_index.py:53
↓ 3 callersFunctionbuild_bm25_index
Build a BM25 index from chunks using LangChain BM25Retriever.
src/retrieval/bm25_index.py:42
↓ 3 callersFunctionbuild_citation_prompt
Build the citation prompt for the RAG system.
src/generation/Citation_system.py:29
↓ 3 callersFunctionlangfuse_configured
()
src/monitoring/langfuse_tracer.py:18
↓ 3 callersFunctionload_all_chunks
Load all chunks from the vectorstore. Uses the underlying collection for efficient retrieval.
src/db/chroma_client.py:69
↓ 2 callersFunctioncosine_sim
(a, b)
tests/test_embedder.py:85
↓ 2 callersFunctionembed_chunks
Generate embeddings for chunks in batches.
src/ingestion/embedder.py:42
↓ 2 callersFunctionget_collection
Returns the underlying Chroma collection for compatibility. Accesses the internal _collection from LangChain Chroma.
src/db/chroma_client.py:31
↓ 2 callersFunctionupsert_chunks
Add or update chunks in the vectorstore using LangChain add_documents.
src/db/chroma_client.py:41
↓ 1 callersFunction_apply_provider_overrides
Inject provider API keys from sidebar UI into Config.
app.py:108
↓ 1 callersFunction_call_provider_with_retry
Call a single provider with retry + exponential backoff.
src/generation/chain.py:82
↓ 1 callersFunction_generate_traced
Run the RAG pipeline with Langfuse tracing spans around each step.
src/generation/chain.py:104
↓ 1 callersFunction_get_pipeline
()
eval/eval_runner.py:40
↓ 1 callersFunctionbuild_eval_samples
(eval_dataset: List[Dict[str, str]])
eval/eval_runner.py:61
↓ 1 callersFunctioncheck_thresholds
(scores: Dict[str, float])
eval/eval_runner.py:98
↓ 1 callersFunctiondisplay_cited_answer
Display answer with expandable citations.
app.py:90
↓ 1 callersFunctionget_bm25_retriever
Get a BM25Retriever for use in chains.
src/retrieval/bm25_index.py:75
↓ 1 callersFunctionget_vectorstore
Get the LangChain Chroma vectorstore for use in chains. Returns: Chroma vectorstore instance.
src/db/chroma_client.py:109
↓ 1 callersFunctionhandle_query
Handle user query and generate response.
app.py:120
↓ 1 callersFunctioninit_session_state
Initialize session state variables.
app.py:32
↓ 1 callersFunctionload_eval_dataset
(file_path: str)
eval/eval_runner.py:47
↓ 1 callersFunctionmain
Main app entry point.
app.py:272
↓ 1 callersFunctionmain
()
eval/eval_runner.py:114
↓ 1 callersFunctionprocess_pdf
Process PDF through ingestion pipeline.
app.py:58
↓ 1 callersFunctionrender_chat
Render main chat area.
app.py:245
↓ 1 callersFunctionrender_sidebar
Render left sidebar with upload and document list.
app.py:173
↓ 1 callersFunctionreset_client
Resets the singleton vectorstore (useful for tests).
src/db/chroma_client.py:100
↓ 1 callersFunctionrun_rag
(question: str)
eval/eval_runner.py:53
↓ 1 callersFunctionrun_ragas_evaluation
(samples: List[Dict[str, Any]])
eval/eval_runner.py:74
↓ 1 callersFunctionsave_results
(samples, scores, threshold_results, output_path)
eval/eval_runner.py:109
↓ 1 callersFunctionsave_uploaded_file
Save uploaded PDF to data/raw/ directory.
app.py:50
↓ 1 callersFunctiontest_embed_chunks
Test batch chunk embedding preserves metadata.
tests/test_embedder.py:28
↓ 1 callersFunctiontest_embed_query
Test single query embedding returns correct format.
tests/test_embedder.py:9
↓ 1 callersFunctiontest_model_singleton
Test that model is lazy-loaded and reused.
tests/test_embedder.py:58
↓ 1 callersFunctiontest_similarity_consistency
Test that similar texts have higher similarity.
tests/test_embedder.py:74
Methodmust_have_citation
(cls, validate)
src/generation/Citation_system.py:22
Functionreset_langfuse_state
Reset module-level state before each test.
tests/test_langfuse_tracer.py:8
Functionreset_model
()
tests/test_cross_encoder.py:8
Functionreset_vectorstore
()
tests/test_chroma_client.py:8
Methodtest_all_providers_fail_raises
(self, mock_call, mock_chain)
tests/test_generate.py:241
Methodtest_all_three_providers
(self)
tests/test_providers.py:28
Methodtest_answer_relevancy_threshold_is_between_0_and_1
(self)
tests/test_config.py:80
Methodtest_anthropic_and_openai_only
(self)
tests/test_providers.py:38
Methodtest_anthropic_client
(self, mock_chat_anthropic)
tests/test_providers.py:77
Methodtest_base_dir_is_project_root
(self)
tests/test_config.py:10
Methodtest_bm25_error_wrapped
(self, mock_bm25)
tests/test_retrieval_pipeline.py:96
Functiontest_bm25_search
(mock_bm25_cls)
tests/test_bm25.py:65
Functiontest_bm25_search_error
(mock_bm25_cls)
tests/test_bm25.py:76
Functiontest_build_bm25_index
(mock_bm25_cls)
tests/test_bm25.py:55
Functiontest_build_prompt_contains_sources
()
tests/test_citations.py:15
Functiontest_build_sources
()
tests/test_chain_utils.py:58
Functiontest_build_sources_empty
()
tests/test_chain_utils.py:72
Methodtest_chroma_dir_is_under_data_dir
(self)
tests/test_config.py:16
Methodtest_chroma_dir_path_is_absolute
(self)
tests/test_config.py:19
Methodtest_chroma_host_is_string
(self)
tests/test_config.py:27
Methodtest_chroma_port_is_int
(self)
tests/test_config.py:30
Methodtest_chunk_metadata_preserved_through_pipeline
Verify doc_id and page_num survive from extract through chunk to embed.
tests/test_pipeline_ingest.py:44
Methodtest_chunk_overlap_is_less_than_chunk_size
(self)
tests/test_config.py:68
Functiontest_chunk_pages_basic
()
tests/test_chunker.py:6
Functiontest_chunk_pages_empty_page_skipped
()
tests/test_chunker.py:19
Functiontest_chunk_pages_global_index_increments
()
tests/test_chunker.py:67
Functiontest_chunk_pages_metadata_preserved
()
tests/test_chunker.py:28
Functiontest_chunk_pages_no_pages
()
tests/test_chunker.py:62
Functiontest_chunk_pages_small_chunks_filtered
()
tests/test_chunker.py:54
Functiontest_chunk_pages_total_chunks_added
()
tests/test_chunker.py:42
Methodtest_chunk_size_is_positive
(self)
tests/test_config.py:65
Methodtest_chunking_error
(self, mock_extract, mock_chunk)
tests/test_pipeline_ingest.py:120
Methodtest_chunks_have_total_chunks_metadata
Verify chunk_pages adds total_chunks metadata.
tests/test_pipeline_ingest.py:82
Functiontest_chunks_to_documents
()
tests/test_bm25.py:14
Functiontest_chunks_to_documents_defaults
()
tests/test_bm25.py:27
Methodtest_collection_name_is_nonempty
(self)
tests/test_config.py:83
Methodtest_converts_chunks_to_sources
(self)
tests/test_generate.py:88
Functiontest_count_chunks
(mock_embed, mock_chroma)
tests/test_chroma_client.py:116
Methodtest_data_dir_exists
(self)
tests/test_config.py:13
next →1–100 of 205, ranked by callers