Skip to content

Conversation

@hadi2f244
Copy link
Contributor

@hadi2f244 hadi2f244 commented Apr 1, 2025

Closes #842

📑 Description

This pull request introduces support for custom prompts in AI backends. Previously, the system relied on predefined prompts within prompts.go. Now, users can define and override prompts (In k8sgpt.yaml) based on their specific use cases.

ai:
  promptmap:
    default: "Resolve the issue with this custom prompt"

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

The documentation needs to be updated to reflect the changes in the k8sgpt.yaml file and how to implement custom prompt.

@codecov
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

❌ Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.12%. Comparing base (173e4dc) to head (30bd580).
⚠️ Report is 177 commits behind head on main.

Files with missing lines Patch % Lines
pkg/analysis/analysis.go 54.54% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1416      +/-   ##
==========================================
+ Coverage   34.76%   43.12%   +8.35%     
==========================================
  Files          94      107      +13     
  Lines        6342     7636    +1294     
==========================================
+ Hits         2205     3293    +1088     
- Misses       4046     4193     +147     
- Partials       91      150      +59     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hadi2f244
Copy link
Contributor Author

I noticed that the TestNewAnalysis ( In analysis_test.go) function in analysis_test.go is actually testing the behavior of GetAIResults, which seems misaligned with its naming. It would be more appropriate to rename it to TestGetAIResults for better clarity. Additionally, if we need to test the functionality specifically related to NewAnalysis, we could consider creating a separate function called TestNewAnalysis.

@AlexsJones, Is it correct !?

@godenja
Copy link

godenja commented Jun 6, 2025

this sounds like an excelent idea.

@AlexsJones AlexsJones self-assigned this Jun 10, 2025
Client *kubernetes.Client
Language string
AIClient ai.IAI
PromptMap map[string]string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this bit do? We pass the prompt map into result, err := a.getAIResultForSanitizedFailures(texts, promptTemplate)

@AlexsJones AlexsJones added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

Status: Proposed

Development

Successfully merging this pull request may close these issues.

Custom prompt prefix for specific problem / analysis.

3 participants