MCPcopy Create free account

hub / github.com/THESIS-AGENT/AIRouter / functions

Functions186 in github.com/THESIS-AGENT/AIRouter

↓ 31 callersMethodadd_test
(self, test_name: str, description: str, status: str, details: dict)
unit_test/edge_case_tests.py:42
↓ 27 callersMethodadd_metric
(self, test_name: str, metric_name: str, value: float)
unit_test/performance_test.py:42
↓ 21 callersMethodadd_test
(self, test_name: str, status: str, details: dict)
unit_test/comprehensive_test_suite.py:40
↓ 20 callersMethodgenerate
( model_name, prompt, mode="fast_first", timeout=30, input_proportion=
LLMwrapper.py:313
↓ 14 callersFunctionis_model_health_check_blacklisted
检查模型是否在健康检测屏蔽清单中 支持层级屏蔽逻辑: 1. 精确匹配:如果模型名称直接在屏蔽清单中,则被屏蔽 2. 层级屏蔽:如果是多模态模型(_mm后缀),还需检查其基础模型是否被屏蔽 Args: model_name
ew_config/source.py:77
↓ 13 callersMethodlog_test_result
记录测试结果
test_blacklist_integration.py:58
↓ 12 callersMethod_generate_request_id
Generate a unique request ID based on content and finish time.
LLMwrapper.py:151
↓ 10 callersMethod_send_api_key_usage
Send API key usage information to the API key manager.
LLMwrapper.py:110
↓ 10 callersMethodget_config
维护两套策略, 一套是以便宜为导向, 一套是以时间最少为导向的. Args: model_name (str): 模型名称 mode (str): 模式,可以是"cheap_first"或"fast_f
LoadBalancing.py:322
↓ 10 callersMethodget_response
(self, messages: list, tools: list, model: str, timeout, stream = Fals
ew_api/curl_infra.py:20
↓ 9 callersMethodget_api_key
从API密钥管理服务获取API密钥,失败时使用备用方案 Args: source_name (str): 源名称 Returns: str: API密钥
LoadBalancing.py:59
↓ 8 callersMethodgenerate_fromTHEbest
从多个模型中选择最优的一个进行文本生成 Args: model_list (list): 候选模型名称列表 prompt (str): 输入提示 mode (str): 选择策略,"cheap_
LLMwrapper.py:984
↓ 6 callersMethod_get_actual_model_name
获取实际模型名称,处理多模态模型 Args: source_name (str): 源名称 model_name (str): 模型名称 Returns:
LoadBalancing.py:299
↓ 6 callersMethodgenerate_mm
( model_name: str, prompt: str, img_base64: str, img_url = None, timeo
LLMwrapper.py:470
↓ 6 callersMethodget_response
(self, messages: list, tools: list, model: str, timeout, stream = False, additional_params={})
ew_api/openai_infra.py:25
↓ 6 callersMethodget_sources_from_ranking
基于预设排名获取源和模型配置 当健康检查数据为空时,基于预设的源排名获取配置。 Args: model_name (str): 模型名称 Returns:
LoadBalancing.py:242
↓ 5 callersMethod_check_valid_model
检查模型是否在源上有效 Args: source_name (str): 源名称 model_name (str): 模型名称 Returns: boo
LoadBalancing.py:141
↓ 5 callersFunctionget_available_sources
获取有效的可用源列表(过滤掉空的源)
api_key_manager/unit_test.py:90
↓ 5 callersFunctionremove_thinking
Remove thinking chains from text content. Args: text (str): Input text that may contain thinking chains. Returns:
LLMwrapper.py:62
↓ 5 callersMethodrun
()
CheckHealthy.py:186
↓ 4 callersMethodfunction_calling
( model_name, prompt, tools, timeout=30, mode="fast_first", in
LLMwrapper.py:779
↓ 4 callersMethodis_health_data_empty
检查健康数据是否为空 检查指定模型在所有源上的健康数据是否全部为空数组。 对于健康检测屏蔽清单中的模型,始终返回True以强制使用预设排名。 Args: model_name (str): 要
LoadBalancing.py:202
↓ 4 callersMethodnotice_api_key_usage
通知服务关于API密钥的使用情况。 参数: api_key: 使用的API密钥 model_name: 模型名称 source_name: 接口供应商名称 create_
api_key_manager/client.py:41
↓ 4 callersFunctionrecord_api_key_usage
记录API密钥使用情况
api_key_manager/unit_test.py:141
↓ 3 callersMethod_build_image_url_with_fallback
Build image URL content that supports both formats: 1. Direct format: "image_url": "url_string" 2. Nested format: "image_url"
LLMwrapper.py:278
↓ 3 callersMethod_verify_model_mapping
Verify that model mappings are valid and not None
LLMwrapper.py:157
↓ 3 callersMethodcalculate_summary
计算汇总统计
unit_test/performance_test.py:50
↓ 3 callersMethodcheck_healthy
从本地健康检查服务获取API健康状态数据 Returns: dict: 包含时间戳、检查间隔和健康数据的字典
LoadBalancing.py:29
↓ 3 callersFunctioncreate_error_summary
创建简洁的错误摘要 Args: error_message: 原始错误消息 error_type: 错误类型 source_name: 源名称 model_name: 模型名称 Return
ew_config/logging_config.py:174
↓ 3 callersFunctionget_api_key
获取指定源的API密钥
api_key_manager/unit_test.py:116
↓ 3 callersMethodsave
(self, filename: str)
unit_test/performance_test.py:67
↓ 3 callersMethodselect_the_best_fromAbatch
从一批模型中选择帕累托最优的模型 Args: model_list (list): 模型名称列表 mode (str): 选择模式,"fast_first"或"cheap_first" inpu
LoadBalancing.py:527
↓ 2 callersFunction_get_error_level_and_message
根据错误类型确定日志级别和消息 Args: error_message (str): 错误消息 error_type (str): 错误类型 source_name (str): 源名称 model_name (str
CheckHealthy.py:104
↓ 2 callersMethod_validate_model_for_function_calling
Validate that the model is in the allowed list for function_calling method
LLMwrapper.py:216
↓ 2 callersMethod_validate_model_for_generate
Validate that the model is in the allowed list for generate method
LLMwrapper.py:196
↓ 2 callersMethod_validate_model_for_generate_mm
Validate that the model is in the allowed list for generate_mm method
LLMwrapper.py:206
↓ 2 callersMethodfilter
过滤和清理日志记录
ew_config/logging_config.py:17
↓ 2 callersFunctionfunction_with_custom_default
使用自定义默认超时值的函数
ew_decorator/test_with_timeout.py:24
↓ 2 callersFunctionfunction_with_custom_param_name
使用自定义超时参数名的函数
ew_decorator/test_with_timeout.py:30
↓ 2 callersFunctionfunction_with_param_timeout
使用带有timeout参数的函数
ew_decorator/test_with_timeout.py:12
↓ 2 callersFunctiongenerate_test_report
生成测试报告汇总
unit_test/run_all_tests.py:126
↓ 2 callersMethodget_api_key
获取特定源的API密钥。 参数: source_name: 接口供应商名称 返回: API密钥,如果请求失败则返回None
api_key_manager/client.py:17
↓ 2 callersFunctionget_available_sources
动态获取可用的源列表
test_performance.py:20
↓ 2 callersFunctionprint_menu
打印测试菜单
unit_test/run_all_tests.py:46
↓ 2 callersFunctionrun_single_test
运行单个测试脚本
unit_test/run_all_tests.py:102
↓ 2 callersFunctionrun_test
运行指定的测试
unit_test/run_all_tests.py:58
↓ 2 callersFunctiontest_concurrent_load
测试并发负载
unit_test/performance_test.py:186
↓ 2 callersFunctiontest_response_time_distribution
测试响应时间分布
unit_test/performance_test.py:145
↓ 2 callersFunctionupdate_failed_keys_cache
定时任务:更新失败的API密钥缓存
api_key_manager/api.py:81
↓ 2 callersMethodwait
等待直到允许进行调用
api_key_manager/unit_test.py:73
↓ 1 callersFunction_build_multimodal_message
根据不同供应商构建正确格式的多模态消息 Args: prompt (str): 文本提示 test_image_base64 (str): Base64编码的测试图像 source_name (str): 供应商名称
CheckHealthy.py:135
↓ 1 callersMethod_download_image_to_base64
Download an image from URL and convert it to base64. Args: img_url (str): The URL of the image to download
LLMwrapper.py:80
↓ 1 callersFunction_generate_failed_keys_summary_report
生成失败密钥的汇总报告
api_key_manager/api.py:177
↓ 1 callersFunction_generate_health_check_summary_report
生成健康检查的详细汇总报告
CheckHealthy.py:466
↓ 1 callersFunction_is_commercial_error
判断是否为商业性错误(如余额不足、配额超限等) Args: error_message (str): 错误消息 Returns: bool: 如果是商业性错误返回True,技术性错误返回False
CheckHealthy.py:53
↓ 1 callersFunction_is_timeout_error
判断是否为超时错误 Args: error_message (str): 错误消息 Returns: bool: 如果是超时错误返回True
CheckHealthy.py:79
↓ 1 callersMethod_validate_model_for_embedding
Validate that the model is in the allowed list for embedding method
LLMwrapper.py:247
↓ 1 callersMethod_validate_model_for_generate_doc
Validate that the model is in the allowed list for generate_doc method
LLMwrapper.py:225
↓ 1 callersMethod_validate_model_for_reranker
Validate that the model is in the allowed list for reranker method
LLMwrapper.py:256
↓ 1 callersMethod_validate_model_is_google_source
Validate that the model is available on Google source
LLMwrapper.py:234
↓ 1 callersFunctionanalyze_edge_case_results
分析边界测试结果
unit_test/analyze_test_results.py:77
↓ 1 callersFunctionanalyze_performance_results
分析性能测试结果
unit_test/analyze_test_results.py:11
↓ 1 callersFunctionanalyze_results
分析测试结果
test_performance.py:143
↓ 1 callersFunctioncalculate_cost_savings
计算成本节省
test_real_services_integration.py:186
↓ 1 callersFunctioncheck_service_health
检查API服务的健康状态
api_key_manager/unit_test.py:503
↓ 1 callersFunctioncheck_source_availability
检查各源的可用性
test_performance.py:265
↓ 1 callersFunctioncount_model_sources
统计每个模型在多少个源(供应商)中可用 考虑多模态模型和非多模态模型的映射关系: - 如果多模态模型值为None,则使用对应的非多模态模型 - 统计每个模型实际可用的源数量 返回: - model_source_count: 字典
ew_config/source.py:553
↓ 1 callersFunctioncreate_tables
创建所有数据库表,如果表已存在则跳过,并处理表结构迁移
api_key_manager/models.py:105
↓ 1 callersFunctionend_to_end_test_scenario
端到端场景测试
unit_test/comprehensive_test_suite.py:574
↓ 1 callersFunctionfunction_with_default_timeout
使用默认超时值的函数
ew_decorator/test_with_timeout.py:18
↓ 1 callersMethodgenerate_doc
使用PDF文档处理模型生成响应(仅支持Google源的模型) 使用requests直接调用Google的generateContent API Args: model_name (str): 模型名称(必须是Google源支
LLMwrapper.py:1388
↓ 1 callersMethodgenerate_mm_fromTHEbest
从多个多模态模型中选择最优的一个进行生成 Args: model_list (list): 候选多模态模型名称列表 prompt (str): 文本提示 img_base64 (str): Ba
LLMwrapper.py:1088
↓ 1 callersFunctiongenerate_recommendations
生成改进建议
unit_test/analyze_test_results.py:113
↓ 1 callersFunctiongenerate_request_id
生成唯一的请求ID,基于时间戳和随机数的MD5哈希
api_key_manager/unit_test.py:83
↓ 1 callersMethodgenerate_test_report
生成测试报告
test_blacklist_integration.py:385
↓ 1 callersMethodget_combinedRanking
融合两个不同指标的排序 将两个不同指标的排序结果按给定权重融合为一个新的排序结果。 Args: ranking_1 (dict): 第一个指标的排序结果 ranking_2 (dict
LoadBalancing.py:161
↓ 1 callersFunctionget_db
获取数据库会话
api_key_manager/models.py:164
↓ 1 callersFunctionget_engine
尝试创建数据库引擎并处理连接错误
api_key_manager/models.py:65
↓ 1 callersFunctionmain
主函数
test_real_services_integration.py:231
↓ 1 callersFunctionmain
()
test_summary.py:19
↓ 1 callersFunctionmain
主函数
test_blacklist_integration.py:429
↓ 1 callersFunctionmain
主函数
unit_test/run_all_tests.py:162
↓ 1 callersFunctionmain
主函数
unit_test/analyze_test_results.py:161
↓ 1 callersFunctionmain
主函数
api_key_manager/unit_test.py:517
↓ 1 callersMethodplot_results
生成性能图表
unit_test/performance_test.py:74
↓ 1 callersFunctionprint_model_source_statistics
打印每个模型的源可用性统计信息 按模型类型分组显示,并提供详细的统计信息
ew_config/source.py:599
↓ 1 callersFunctionrecord_all_api_keys_usage
记录所有源和所有API密钥的使用情况
api_key_manager/unit_test.py:184
↓ 1 callersFunctionrun_all_tests
运行所有测试
unit_test/comprehensive_test_suite.py:691
↓ 1 callersMethodrun_all_tests
运行所有测试
test_blacklist_integration.py:369
↓ 1 callersFunctionrun_edge_case_tests
运行所有边界测试
unit_test/edge_case_tests.py:619
↓ 1 callersFunctionrun_performance_tests
运行所有性能测试
unit_test/performance_test.py:502
↓ 1 callersFunctionrun_quick_test
快速测试(用于验证基本功能)
unit_test/comprehensive_test_suite.py:739
↓ 1 callersFunctionrun_stress_test
运行压力测试
unit_test/performance_test.py:545
↓ 1 callersFunctionrun_stress_test
运行压力测试 Args: num_processes: 进程数 num_threads: 每个进程的线程数 requests_per_worker: 每个工作线程的请求数 sources: 要测试的源列表,如
api_key_manager/unit_test.py:362
↓ 1 callersMethodsave
(self, filename: str)
unit_test/comprehensive_test_suite.py:48
↓ 1 callersMethodsave
(self, filename: str)
unit_test/edge_case_tests.py:59
↓ 1 callersFunctionsetup_optimized_logging
设置优化的日志配置 Args: log_level: 日志级别 console_format: 控制台输出格式 ('simple', 'detailed', 'structured') file_format: 文件输出格式
ew_config/logging_config.py:93
↓ 1 callersFunctionshow_simplification_summary
显示简化总结
test_simplified_import.py:142
↓ 1 callersFunctionshow_usage_examples
显示使用示例
test_simplified_import.py:99
↓ 1 callersFunctionstress_test_concurrent_requests
并发请求压力测试
unit_test/comprehensive_test_suite.py:402
next →1–100 of 186, ranked by callers