Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/THESIS-AGENT/AIRouter
/ functions
Functions
186 in github.com/THESIS-AGENT/AIRouter
⨍
Functions
186
◇
Types & classes
20
↳
Endpoints
9
↓ 1 callers
Function
stress_test_model_switching
测试模型切换性能
unit_test/comprehensive_test_suite.py:530
↓ 1 callers
Function
stress_test_sustained_load
持续负载压力测试
unit_test/comprehensive_test_suite.py:465
↓ 1 callers
Function
test_api_key_rotation
测试API密钥轮询
api_key_manager/unit_test.py:219
↓ 1 callers
Method
test_blacklist_configuration
测试1: 验证屏蔽配置是否正确
test_blacklist_integration.py:69
↓ 1 callers
Function
test_blacklist_filtering
测试屏蔽功能
test_real_services_integration.py:65
↓ 1 callers
Function
test_blacklisted_model_usability
测试屏蔽模型仍然可用
test_real_services_integration.py:138
↓ 1 callers
Method
test_blacklisted_models_still_usable
测试5: 验证屏蔽模型仍然可以通过LoadBalancing使用
test_blacklist_integration.py:251
↓ 1 callers
Function
test_cache_refresh
测试缓存刷新功能
test_performance.py:212
↓ 1 callers
Method
test_checkHealthy_filtering
测试2: 验证CheckHealthy是否正确过滤屏蔽模型
test_blacklist_integration.py:109
↓ 1 callers
Function
test_concurrent_edge_cases
测试并发边界情况
unit_test/edge_case_tests.py:454
↓ 1 callers
Function
test_concurrent_performance
测试并发性能
test_performance.py:99
↓ 1 callers
Function
test_cost_optimization
测试成本优化模式
unit_test/performance_test.py:449
↓ 1 callers
Function
test_error_recovery
测试错误恢复能力
unit_test/performance_test.py:353
↓ 1 callers
Function
test_extreme_inputs
测试极端输入情况
unit_test/edge_case_tests.py:67
↓ 1 callers
Function
test_function_calling
测试函数调用功能
unit_test/comprehensive_test_suite.py:194
↓ 1 callers
Function
test_function_calling_edge_cases
测试函数调用边界情况
unit_test/edge_case_tests.py:369
↓ 1 callers
Method
test_health_check_integration
测试6: 健康检查集成测试(模拟运行)
test_blacklist_integration.py:322
↓ 1 callers
Function
test_health_check_service
测试健康检查服务
test_real_services_integration.py:40
↓ 1 callers
Function
test_invalid_parameters
测试无效参数
unit_test/edge_case_tests.py:160
↓ 1 callers
Function
test_llm_wrapper_imports
测试 LLM_Wrapper 的导入功能
test_simplified_import.py:6
↓ 1 callers
Method
test_loadBalancing_api_key_access
测试3: 验证LoadBalancing能否正确获取API key
test_blacklist_integration.py:155
↓ 1 callers
Method
test_loadBalancing_blacklist_handling
测试4: 验证LoadBalancing对屏蔽模型的处理
test_blacklist_integration.py:189
↓ 1 callers
Function
test_load_balancing_edge_cases
测试负载均衡边界情况
unit_test/edge_case_tests.py:548
↓ 1 callers
Function
test_load_balancing_failover
测试负载均衡故障转移
unit_test/comprehensive_test_suite.py:368
↓ 1 callers
Function
test_loadbalancing_with_blacklist
测试LoadBalancing对屏蔽模型的处理
test_real_services_integration.py:99
↓ 1 callers
Function
test_model_switching_overhead
测试模型切换开销
unit_test/performance_test.py:274
↓ 1 callers
Function
test_multimodal_edge_cases
测试多模态边界情况
unit_test/edge_case_tests.py:280
↓ 1 callers
Function
test_multimodal_models
测试多模态模型
unit_test/comprehensive_test_suite.py:144
↓ 1 callers
Function
test_multimodal_performance
测试多模态性能
unit_test/performance_test.py:403
↓ 1 callers
Function
test_package_import
测试包导入功能(需要安装后测试)
test_simplified_import.py:81
↓ 1 callers
Function
test_pareto_optimal_selection
测试帕累托最优选择
unit_test/comprehensive_test_suite.py:294
↓ 1 callers
Function
test_stats_endpoint
测试统计信息端点
test_performance.py:231
↓ 1 callers
Function
test_text_generation_models
测试所有文本生成模型
unit_test/comprehensive_test_suite.py:56
↓ 1 callers
Function
test_thinking_models
测试推理模型
unit_test/comprehensive_test_suite.py:105
↓ 1 callers
Function
validate_mappings
验证所有的模型列表和映射是否一致和互相包含 检查: 1. 所有模型列表中的模型都在source_mapping中 2. 所有配置中的源是否一致(source_config, source_ranking, source_mapping, source_pr
ew_config/source.py:716
↓ 1 callers
Function
worker_process
工作进程函数,模拟多个用户同时请求API密钥
api_key_manager/unit_test.py:250
Method
__call__
检查是否允许当前调用,并在允许时记录调用 Returns: bool: 如果允许调用返回True,否则返回False
api_key_manager/unit_test.py:56
Method
__init__
初始化LoadBalancing实例,获取健康检查数据和配置
LoadBalancing.py:126
Method
__init__
(self)
test_blacklist_integration.py:51
Method
__init__
(self, base_url, api_key)
ew_api/openai_infra.py:13
Method
__init__
(self, base_url, api_key)
ew_api/curl_infra.py:14
Method
__init__
(self)
unit_test/comprehensive_test_suite.py:34
Method
__init__
(self)
unit_test/performance_test.py:34
Method
__init__
(self)
unit_test/edge_case_tests.py:30
Method
__init__
初始化客户端。 参数: base_url: API密钥管理器服务的基础URL
api_key_manager/client.py:9
Method
__init__
初始化限流器 Args: max_calls: 在period秒内允许的最大调用次数 period: 时间窗口大小(秒)
api_key_manager/unit_test.py:43
Method
__init__
(self)
ew_config/logging_config.py:10
Method
__repr__
(self)
api_key_manager/models.py:61
Method
_validate_model_is_deepinfra_source
Validate that the model is available on DeepInfra source
LLMwrapper.py:265
Function
check_healthy
专门用于Docker健康检查的端点
api_key_manager/api.py:283
Function
counting_time
(func)
ew_decorator/counting_time.py:5
Function
decorator
(func)
ew_decorator/with_timeout.py:20
Function
docker_health_check
专门为Docker健康检查设计的端点,验证服务是否正常运行
CheckHealthy.py:636
Method
format
(self, record)
ew_config/logging_config.py:52
Method
format
(self, record)
ew_config/logging_config.py:68
Method
function_calling_fromTHEbest
从多个支持函数调用的模型中选择最优的一个 Args: model_list (list): 候选模型名称列表(必须支持函数调用) prompt (str): 输入提示 tools (list):
LLMwrapper.py:1239
Method
generate_embedding
生成文本嵌入向量 Args: model_name (str): 模型名称,仅支持embedding模型 prompt (str): 输入文本 test_response (dict, opt
LLMwrapper.py:1527
Method
generate_reranker
使用reranker模型对文档进行重新排序 Args: model_name (str): 模型名称,仅支持reranker模型 prompt (str): 查询文本 documents_li
LLMwrapper.py:1654
Function
get_api_key
获取给定源的最佳API密钥。 使用缓存的失败密钥列表,实现高性能的密钥选择。
api_key_manager/api.py:294
Function
get_health_data
Return the sliding window data for all API checks
CheckHealthy.py:616
Function
get_stats
获取API密钥统计信息
api_key_manager/api.py:410
Function
health_check
健康检查端点
api_key_manager/api.py:278
Function
log_requests
记录所有HTTP请求
api_key_manager/api.py:266
Function
make_request
执行单个请求
unit_test/comprehensive_test_suite.py:406
Function
monitor_queue
监控队列大小的线程函数
api_key_manager/unit_test.py:445
Function
notice_api_key
记录API密钥使用信息。
api_key_manager/api.py:370
Function
refresh_cache
手动刷新失败密钥缓存
api_key_manager/api.py:420
Function
run_threaded_workers
在一个进程内运行多个线程
api_key_manager/unit_test.py:458
Function
shutdown_event
Shutdown the scheduler when the app stops and save health data to a local file
CheckHealthy.py:587
Function
shutdown_event
关闭定时任务
api_key_manager/api.py:257
Function
startup_event
Run initial health check and start the scheduler
CheckHealthy.py:562
Function
startup_event
在启动时初始化数据库表和定时任务
api_key_manager/api.py:212
Method
test_custom_default_timeout
测试自定义默认超时值
ew_decorator/test_with_timeout.py:55
Method
test_custom_param_name
测试自定义参数名
ew_decorator/test_with_timeout.py:65
Method
test_default_timeout
测试默认超时参数
ew_decorator/test_with_timeout.py:49
Function
test_get_api_key
测试获取API密钥的性能
test_performance.py:62
Method
test_normal_execution
测试正常执行情况
ew_decorator/test_with_timeout.py:37
Method
test_timeout_exception
测试超时情况,应该引发TimeoutError
ew_decorator/test_with_timeout.py:43
Function
thread_worker
线程工作函数,用于多线程测试
api_key_manager/unit_test.py:358
Function
timeout_handler
超时信号处理函数
ew_decorator/with_timeout.py:10
Function
trigger_health_check
Manually trigger a health check (runs in background)
CheckHealthy.py:629
Function
update_health_data
Run the health check and update the sliding window data
CheckHealthy.py:532
Function
with_timeout
函数超时装饰器 修改为始终使用ThreadPoolExecutor实现超时功能, 因为signal模块只能在主线程中使用。
ew_decorator/with_timeout.py:14
Function
worker
工作线程函数
unit_test/performance_test.py:195
Function
wrapper
(*args, **kwargs)
ew_decorator/with_timeout.py:25
Function
wrapper
(*args, **kwargs)
ew_decorator/counting_time.py:7
← previous
101–186 of 186, ranked by callers