Skip to content

Commit

Permalink
Improve the Ollama analyzer for validating responses.
Browse files Browse the repository at this point in the history
Signed-off-by: ksg <[email protected]>
  • Loading branch information
ksg97031 committed Jan 25, 2025
1 parent 4069803 commit 1641e38
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/analyzer/analyzers/llm_analyzers/ollama.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ module Analyzer::AI
filter_prompt = <<-PROMPT
Analyze the following list of file paths and identify which files are likely to represent endpoints, including API endpoints, web pages, or static resources.
If no files are found, return:
{"files": []}
Guidelines:
- Focus only on individual files.
- Do not include directories.
- Do not include explanations, comments or additional text.
Input Files:
#{all_paths.map { |path| File.expand_path(path) }.join("\n")}
#{all_paths.map { |path| "- #{File.expand_path(path)}" }.join("\n")}
PROMPT

format = <<-FORMAT
Expand Down Expand Up @@ -82,9 +79,6 @@ module Analyzer::AI
prompt = <<-PROMPT
Analyze the provided source code to extract details about the endpoints and their parameters.
If no endpoints are found, return:
{"endpoints": []}
Guidelines:
- The "method" field should strictly use one of these values: "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD".
- The "param_type" must strictly use one of these values: "query", "json", "form", "header", "cookie" and "path".
Expand Down Expand Up @@ -131,7 +125,8 @@ module Analyzer::AI
"required": ["url", "method", "params"]
}
}
}
},
"required": ["endpoints"]
}
FORMAT

Expand Down

0 comments on commit 1641e38

Please sign in to comment.