Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ai-infra-curriculum/ai-infra-engineer-learning
/ functions
Functions
523 in github.com/ai-infra-curriculum/ai-infra-engineer-learning
⨍
Functions
523
◇
Types & classes
113
↳
Endpoints
19
Method
_index_batch
Index a batch of documents. TODO: Implement batch indexing - Prepare indexed documents - Check for duplicates
projects/project-103-llm-deployment/src/ingestion/indexer.py:168
Method
_is_quality_content
Check if content meets quality criteria. TODO: Implement quality checking - Check word count vs character count ratio
projects/project-103-llm-deployment/src/ingestion/processor.py:327
Method
_load_class_labels
TODO: Load ImageNet class labels Load the 1000 ImageNet class names for mapping predictions. Options: 1. Load from
projects/project-101-basic-model-serving/src/model.py:141
Method
_log_feature_importance
TODO: Log feature importance to MLflow Steps: 1. Extract feature importances from model 2. Create DataFrame with fea
projects/project-102-mlops-pipeline/src/training/train.py:421
Method
_measure_quantization_impact
Measure the impact of quantization on quality and performance. Args: original_model: Original unquantized model
projects/project-103-llm-deployment/src/llm/optimization.py:143
Method
_normalize_whitespace
Normalize whitespace. TODO: Implement whitespace normalization - Replace multiple spaces with single space - Replace
projects/project-103-llm-deployment/src/ingestion/processor.py:165
Method
_plot_confusion_matrix
TODO: Plot confusion matrix
projects/project-102-mlops-pipeline/src/training/evaluate.py:120
Method
_plot_roc_curve
TODO: Plot ROC curve
projects/project-102-mlops-pipeline/src/training/evaluate.py:124
Method
_reciprocal_rank_fusion
Combine results using Reciprocal Rank Fusion. Args: dense_results: Results from dense retrieval sparse_resul
projects/project-103-llm-deployment/src/rag/retriever.py:306
Method
_remove_control_characters
Remove control characters. TODO: Implement control character removal - Keep newlines and tabs - Remove other control
projects/project-103-llm-deployment/src/ingestion/processor.py:142
Method
_remove_duplicates
Remove duplicate documents. TODO: Implement duplicate removal - Use content hashing - Compare similar documents
projects/project-103-llm-deployment/src/ingestion/processor.py:298
Method
_rerank
Rerank candidates using cross-encoder. Args: query: Search query candidates: Retrieved documents Re
projects/project-103-llm-deployment/src/rag/retriever.py:416
Method
_rewrite_query
Rewrite query using conversation history. Args: question: Current question history: Conversation history
projects/project-103-llm-deployment/src/rag/pipeline.py:481
Method
_save_validation_report
TODO: Save validation report to file Steps: 1. Create reports directory 2. Generate timestamped filename 3.
projects/project-102-mlops-pipeline/src/data/validation.py:505
Method
_search_vector_db
Internal method to search the vector database. Args: query_embedding: Query vector top_k: Number of results
projects/project-103-llm-deployment/src/rag/retriever.py:181
Method
_split_sentences
Split text into sentences. Args: text: Input text Returns: List of sentences TODO: Impleme
projects/project-103-llm-deployment/src/rag/chunking.py:306
Method
_upsert_vectors
Upsert vectors to database. TODO: Implement vector upsert - Format data for vector database - Perform upsert operati
projects/project-103-llm-deployment/src/ingestion/indexer.py:263
Method
_upsert_vectors
Upsert vectors to Pinecone. TODO: Implement Pinecone upsert - Format documents for Pinecone - Perform upsert
projects/project-103-llm-deployment/src/ingestion/indexer.py:366
Method
_upsert_vectors
Upsert vectors to ChromaDB. TODO: Implement ChromaDB upsert - Format documents for ChromaDB - Perform add/update
projects/project-103-llm-deployment/src/ingestion/indexer.py:457
Method
_validate_api_key
Validate API key and return metadata. TODO: Implement key validation - Hash provided key - Look up in database/cache
projects/project-103-llm-deployment/src/api/middleware.py:386
Method
add_source
TODO: Add data source to pipeline Args: source: DataSource instance to add
projects/project-102-mlops-pipeline/src/data/ingestion.py:407
Method
add_token
Add token to buffer. TODO: Implement token addition - Add token to buffer - Check if should flush - Return b
projects/project-103-llm-deployment/src/api/streaming.py:468
Function
aggregate_metrics_for_dashboard
Aggregate metrics for Grafana dashboard. Returns: Dictionary of aggregated metrics TODO: 1. Query Prometheus for recent met
projects/project-102-mlops-pipeline/src/monitoring/metrics.py:449
Method
alert_on_unhealthy
Send alert when component becomes unhealthy. Args: component_health: Component health status TODO: 1. C
projects/project-102-mlops-pipeline/src/monitoring/health.py:363
Method
analyze_costs
Analyze costs and suggest optimizations. TODO: Implement cost analysis - Find high-cost customers - Calculate cost p
projects/project-103-llm-deployment/src/monitoring/cost_tracker.py:585
Method
apply_quantization
Apply quantization to reduce model size and memory. Args: model: PyTorch model to quantize method: Quantizat
projects/project-103-llm-deployment/src/llm/optimization.py:84
Function
batch_calculate_similarities
Calculate similarities between query and multiple documents efficiently. Args: query_embedding: Query embedding (1D array) d
projects/project-103-llm-deployment/src/rag/embeddings.py:421
Method
batch_generate
Generate text for multiple prompts in a batch. Args: prompts: List of input prompts **generation_kwargs: Gen
projects/project-103-llm-deployment/src/llm/server.py:245
Method
batch_query
Process multiple queries in batch. Args: questions: List of questions filters: Optional filters Ret
projects/project-103-llm-deployment/src/rag/pipeline.py:366
Method
benchmark_batch_sizes
Benchmark different batch sizes to find optimal throughput. Args: prompts: Test prompts engine: LLM engine
projects/project-103-llm-deployment/src/llm/optimization.py:322
Function
benchmark_inference_latency
Benchmark LLM inference latency across batch sizes. Args: prompts: List of test prompts batch_sizes: Batch sizes to test
projects/project-103-llm-deployment/notebooks/utils.py:163
Method
build_docker_image
TODO: Build Docker image with model Steps: 1. Create Dockerfile with model 2. Build image 3. Tag appropriate
projects/project-102-mlops-pipeline/src/deployment/deploy.py:51
Function
build_docker_image_with_model
TODO: Build Docker image containing the new model Steps: 1. Get model information from previous task 2. Create Dockerfile (or use te
projects/project-102-mlops-pipeline/dags/deployment_pipeline.py:176
Method
calculate_compute_cost
Calculate GPU compute cost. TODO: Implement compute cost calculation - Get hourly rate - Multiply by hours -
projects/project-103-llm-deployment/src/monitoring/cost_tracker.py:171
Function
calculate_cost_estimate
Calculate cost estimate for LLM usage. Args: prompt_tokens: Number of input tokens completion_tokens: Number of generated to
projects/project-103-llm-deployment/notebooks/utils.py:212
Function
calculate_embedding_similarity
Calculate similarity between two embeddings. Args: embedding1: First embedding embedding2: Second embedding metric:
projects/project-103-llm-deployment/src/rag/embeddings.py:386
Function
calculate_latency_percentiles
TODO: Calculate latency percentiles Steps to implement: 1. Sort latencies 2. Calculate p50, p95, p99 3. Calculate min, max, mean
projects/project-101-basic-model-serving/src/utils.py:402
Function
calculate_similarity_score
Calculate similarity between query and document embeddings. Args: query_embedding: Query vector doc_embedding: Document vect
projects/project-103-llm-deployment/src/rag/retriever.py:542
Method
calculate_storage_cost
Calculate storage cost. TODO: Implement storage cost calculation - Get storage rate - Multiply by GB-months
projects/project-103-llm-deployment/src/monitoring/cost_tracker.py:197
Function
calculate_stream_metrics
Calculate streaming performance metrics. TODO: Implement metrics calculation - Time to first token (TTFT) - Tokens per second (throu
projects/project-103-llm-deployment/src/api/streaming.py:493
Method
calculate_token_cost
Calculate cost for token processing. TODO: Implement token cost calculation - Get pricing for model - Calculate inpu
projects/project-103-llm-deployment/src/monitoring/cost_tracker.py:132
Method
calculate_total
TODO: Auto-calculate total_tokens Sum prompt_tokens and completion_tokens
projects/project-103-llm-deployment/src/api/models.py:383
Method
chat
Generate response for a chat conversation. Args: messages: List of message dicts with 'role' and 'content'
projects/project-103-llm-deployment/src/llm/server.py:378
Function
chat_completion
OpenAI-compatible chat completion endpoint. Args: request: Chat request with messages api_key: API key llm: Chat LLM
projects/project-103-llm-deployment/src/api/main.py:431
Method
check_budget
Check if budget threshold reached. TODO: Implement budget checking - Compare current cost to budget - Check alert th
projects/project-103-llm-deployment/src/monitoring/cost_tracker.py:529
Function
check_gpu_compatibility
Check if current GPU is compatible with the model. Args: model_name: Model to check Returns: Dictionary with compatibil
projects/project-103-llm-deployment/src/llm/server.py:455
Function
check_model_health
TODO: Check if model is healthy Steps to implement: 1. Verify model is loaded 2. Run test inference 3. Check device availability
projects/project-101-basic-model-serving/src/utils.py:623
Function
check_model_registry_for_promotion
TODO: Check MLflow Model Registry for newly promoted models Steps: 1. Connect to MLflow Model Registry 2. Check for models in "Produ
projects/project-102-mlops-pipeline/dags/deployment_pipeline.py:53
Method
chunk
Split text into chunks. Args: text: Input text metadata: Optional metadata to attach Returns:
projects/project-103-llm-deployment/src/rag/chunking.py:54
Method
chunk
Split text into fixed-size chunks. Args: text: Input text metadata: Optional metadata Returns:
projects/project-103-llm-deployment/src/rag/chunking.py:101
Method
chunk
Recursively split text. Args: text: Input text metadata: Optional metadata Returns: Lis
projects/project-103-llm-deployment/src/rag/chunking.py:177
Method
chunk
Split text semantically. Args: text: Input text metadata: Optional metadata Returns: Li
projects/project-103-llm-deployment/src/rag/chunking.py:278
Method
chunk
Split markdown text. Args: text: Markdown text metadata: Optional metadata Returns: Lis
projects/project-103-llm-deployment/src/rag/chunking.py:356
Method
clean
Clean text content. TODO: Implement text cleaning pipeline - Extract and preserve code blocks - Remove URLs if confi
projects/project-103-llm-deployment/src/ingestion/processor.py:84
Function
cleanup
TODO: Cleanup after each test Steps: 1. Run test (yield) 2. Clean up any resources 3. Reset state Example implementation:
projects/project-101-basic-model-serving/tests/test_api.py:658
Function
cleanup_tracker
Track resources that need cleanup. TODO: Implement cleanup tracker - Track resources created during test - Clean up after test -
projects/project-103-llm-deployment/tests/conftest.py:480
Method
clear
TODO: Clear all cache entries
projects/project-101-basic-model-serving/src/utils.py:607
Method
clear_cache
Clear the embedding cache. TODO: Clear the cache dictionary and log statistics
projects/project-103-llm-deployment/src/rag/embeddings.py:293
Function
client
TODO: Create test client Steps to implement: 1. Import your FastAPI app 2. Create TestClient 3. Return client for use in tests
projects/project-101-basic-model-serving/tests/test_api.py:32
Function
compare_embedding_models
Benchmark different embedding models. Args: texts: Test texts models: Model names to compare task: Task type (retrie
projects/project-103-llm-deployment/src/rag/embeddings.py:450
Method
compare_models
TODO: Compare multiple models
projects/project-102-mlops-pipeline/src/training/evaluate.py:128
Function
compare_quantization_quality
Compare quality between original and quantized models. Args: original_outputs: Outputs from original model quantized_outputs
projects/project-103-llm-deployment/src/llm/optimization.py:571
Function
compare_rag_vs_baseline
Compare RAG performance vs baseline LLM. Args: test_questions: List of test questions ground_truth_answers: Expected answers
projects/project-103-llm-deployment/notebooks/utils.py:285
Function
component_health
Individual component health check.
projects/project-102-mlops-pipeline/src/monitoring/health.py:408
Method
connect
TODO: Establish connection to data source Steps: 1. Validate configuration 2. Establish connection 3. Handle
projects/project-102-mlops-pipeline/src/data/ingestion.py:49
Method
connect
TODO: Validate file path or URL exists For local files: Check file exists For remote files: Check URL is accessible
projects/project-102-mlops-pipeline/src/data/ingestion.py:109
Method
connect
TODO: Establish database connection Steps: 1. Parse connection string 2. Create connection using appropriate library
projects/project-102-mlops-pipeline/src/data/ingestion.py:178
Method
connect
TODO: Validate API access Steps: 1. Setup authentication headers 2. Test connection with health endpoint 3.
projects/project-102-mlops-pipeline/src/data/ingestion.py:286
Function
count_tokens
Count tokens in text. Args: text: Input text tokenizer: Tokenizer to use Returns: Number of tokens TODO: I
projects/project-103-llm-deployment/src/rag/chunking.py:439
Function
count_tokens
Count tokens in text. Args: text: Input text tokenizer: Optional tokenizer Returns: Token count TODO: Impl
projects/project-103-llm-deployment/src/rag/pipeline.py:521
Function
create_health_api
Create FastAPI endpoint for health checks. Returns: FastAPI app with health endpoints TODO: 1. Create FastAPI app 2. Ad
projects/project-102-mlops-pipeline/src/monitoring/health.py:382
Function
create_indexer
Factory function to create appropriate indexer. TODO: Implement indexer factory - Support different database types - Pass configurat
projects/project-103-llm-deployment/src/ingestion/indexer.py:564
Function
create_metrics_endpoint
Create FastAPI endpoint for Prometheus metrics. TODO: Implement metrics endpoint - Return Prometheus metrics format - Set correct co
projects/project-103-llm-deployment/src/monitoring/metrics.py:579
Method
create_model
TODO: Create ML model based on configuration Steps: 1. Select model class based on model_type 2. Initialize with hyp
projects/project-102-mlops-pipeline/src/training/train.py:90
Method
create_pipeline
TODO: Create sklearn Pipeline for preprocessing Steps: 1. Identify numerical and categorical columns 2. Create separ
projects/project-102-mlops-pipeline/src/data/preprocessing.py:376
Function
create_sse_response
Create FastAPI StreamingResponse for SSE. TODO: Implement SSE response creation - Set proper content-type header (text/event-stream)
projects/project-103-llm-deployment/src/api/streaming.py:87
Method
cross_validate
TODO: Perform cross-validation Steps: 1. Setup k-fold cross-validation 2. Train model on each fold 3. Collec
projects/project-102-mlops-pipeline/src/training/train.py:356
Function
decide_deployment_action
TODO: Decide whether deployment is successful or needs rollback Decision Logic: 1. Check health check results 2. If all passed → pro
projects/project-102-mlops-pipeline/dags/deployment_pipeline.py:534
Function
decide_model_promotion
TODO: Decide whether to promote model to Staging/Production Decision logic: 1. Check if model meets minimum performance threshold 2.
projects/project-102-mlops-pipeline/dags/training_pipeline.py:244
Function
decorator
(func: Callable)
projects/project-103-llm-deployment/src/monitoring/metrics.py:371
Method
delete_by_ids
Delete documents by IDs. TODO: Implement deletion - Delete from vector database - Return count of deleted documents
projects/project-103-llm-deployment/src/ingestion/indexer.py:282
Method
delete_by_ids
Delete documents from Pinecone. TODO: Implement Pinecone deletion
projects/project-103-llm-deployment/src/ingestion/indexer.py:396
Method
delete_by_ids
Delete documents from ChromaDB. TODO: Implement ChromaDB deletion
projects/project-103-llm-deployment/src/ingestion/indexer.py:488
Method
delete_by_metadata
Delete documents matching metadata filter. TODO: Implement filtered deletion - Query documents matching filter - Del
projects/project-103-llm-deployment/src/ingestion/indexer.py:299
Method
deploy_to_kubernetes
TODO: Deploy to Kubernetes Steps: 1. Update deployment manifest with new image 2. Apply deployment 3. Wait f
projects/project-102-mlops-pipeline/src/deployment/deploy.py:64
Function
deploy_to_kubernetes_rolling_update
TODO: Deploy new model to Kubernetes using rolling update strategy Steps: 1. Get image information from previous task 2. Update Kube
projects/project-102-mlops-pipeline/dags/deployment_pipeline.py:276
Method
detect_memory_bottlenecks
Detect potential memory bottlenecks in the configuration. Args: engine: LLM engine to analyze Returns:
projects/project-103-llm-deployment/src/llm/optimization.py:390
Method
disconnect
TODO: Close connection to data source Steps: 1. Close connections 2. Release resources 3. Log disconnection
projects/project-102-mlops-pipeline/src/data/ingestion.py:80
Method
disconnect
No persistent connection for CSV files
projects/project-102-mlops-pipeline/src/data/ingestion.py:155
Method
disconnect
TODO: Close database connection Steps: 1. Commit any pending transactions 2. Close connection 3. Set connect
projects/project-102-mlops-pipeline/src/data/ingestion.py:254
Method
disconnect
No persistent connection for API calls
projects/project-102-mlops-pipeline/src/data/ingestion.py:379
Method
dispatch
Process request with rate limiting. TODO: Implement middleware dispatch - Get client ID - Try to consume token
projects/project-103-llm-deployment/src/api/middleware.py:194
Method
dispatch
Log request and response. TODO: Implement logging - Generate request ID - Log incoming request - Measure dur
projects/project-103-llm-deployment/src/api/middleware.py:271
Method
dispatch
Authenticate request. TODO: Implement authentication - Skip public endpoints - Extract API key from header -
projects/project-103-llm-deployment/src/api/middleware.py:419
Method
dispatch
Track request cost. TODO: Implement cost tracking - Process request - Extract token usage from response - Ca
projects/project-103-llm-deployment/src/api/middleware.py:515
Method
encode
Encode text(s) into embeddings. Args: texts: Single text or list of texts batch_size: Batch size for encodin
projects/project-103-llm-deployment/src/rag/embeddings.py:92
Method
encode_batch
Efficiently encode large batches of texts. Args: texts: List of texts to encode batch_size: Batch size for e
projects/project-103-llm-deployment/src/rag/embeddings.py:161
Method
encode_categorical_features
TODO: Encode categorical variables Steps: 1. Identify categorical columns 2. Apply encoding strategy 3. Save
projects/project-102-mlops-pipeline/src/data/preprocessing.py:138
Method
encode_document
Encode a document. Args: document: Document text normalize: Normalize embedding Returns:
projects/project-103-llm-deployment/src/rag/embeddings.py:220
Method
encode_multimodal
Encode text and/or image into shared embedding space. Args: text: Optional text input image: Optional image
projects/project-103-llm-deployment/src/rag/embeddings.py:351
← previous
next →
101–200 of 523, ranked by callers