class LLMEndpointOptimizer
- LLMEndpointOptimizer
- EndpointOptimizer
- Reference
- Object
Overview
Enhanced optimizer with LLM-based optimization capabilities for refining non-standard or unconventional paths and parameters
Defined in:
optimizer/llm_optimizer.crConstant Summary
-
LLM_OPTIMIZE_FORMAT =
"{\n \"type\": \"json_schema\",\n \"json_schema\": {\n \"name\": \"optimize_endpoint\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"optimized_url\": {\n \"type\": \"string\"\n },\n \"optimized_params\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"param_type\": {\n \"type\": \"string\"\n },\n \"value\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\"name\", \"param_type\", \"value\"],\n \"additionalProperties\": false\n }\n }\n },\n \"required\": [\"optimized_url\", \"optimized_params\"],\n \"additionalProperties\": false\n },\n \"strict\": true\n }\n}"
-
LLM response format for optimization
-
LLM_OPTIMIZE_PROMPT =
"Analyze the provided endpoint and optimize it for better structure, naming conventions, and parameter handling.\n\nFocus on:\n- Normalizing unusual URL patterns\n- Improving parameter naming conventions\n- Standardizing path structures\n- Removing redundant or confusing elements\n\nGuidelines:\n- Keep the core functionality and meaning intact\n- Use RESTful conventions where appropriate\n- Ensure parameter types are accurate\n- Maintain endpoint uniqueness\n- Do not include explanations or comments\n- Output only the JSON result according to the schema"
-
LLM prompt for optimization
Constructors
Instance Method Summary
-
#optimize(endpoints : Array(Endpoint)) : Array(Endpoint)
Enhanced optimization with LLM capabilities
Instance methods inherited from class EndpointOptimizer
add_path_parameters(endpoints : Array(Endpoint)) : Array(Endpoint)
add_path_parameters,
apply_pvalue(param_type, param_name, param_value) : String
apply_pvalue,
combine_url_and_endpoints(endpoints : Array(Endpoint)) : Array(Endpoint)
combine_url_and_endpoints,
optimize(endpoints : Array(Endpoint)) : Array(Endpoint)
optimize,
optimize_endpoints(endpoints : Array(Endpoint)) : Array(Endpoint)
optimize_endpoints
Constructor methods inherited from class EndpointOptimizer
new(logger : NoirLogger, options : Hash(String, YAML::Any))
new
Constructor Detail
Instance Method Detail
Enhanced optimization with LLM capabilities