Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions holmes/plugins/prompts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os.path
from typing import Optional
from jinja2 import Environment, FileSystemLoader
from datetime import datetime, timezone

THIS_DIR = os.path.abspath(os.path.dirname(__file__))

Expand Down Expand Up @@ -35,9 +36,13 @@ def load_and_render_prompt(prompt: str, context: Optional[dict] = None) -> str:
env = Environment(
loader=FileSystemLoader(THIS_DIR),
)

template = env.from_string(prompt_as_str)

if context is None:
context = {}

now = datetime.now(timezone.utc)
context.update({"now": f"{now}", "now_timestamp_seconds": int(now.timestamp())})

return template.render(**context)
1 change: 1 addition & 0 deletions holmes/plugins/prompts/generic_ask_conversation.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Whenever possible you MUST first use tools to investigate then answer the questi
Do not say 'based on the tool output' or explicitly refer to tools at all.
If you output an answer and then realize you need to call more tools or there are possible next steps, you may do so by calling tools at that point in time.
If you have a good and concrete suggestion for how the user can fix something, tell them even if not asked explicitly
When querying tools, always query for the relevant time period. The current UTC date and time are {{ now }}. The current UTC timestamp in seconds is {{ now_timestamp_seconds }}.

Use conversation history to maintain continuity when appropriate, ensuring efficiency in your responses.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ You are a tool-calling AI assist provided with common devops and IT tools that y
Whenever possible you MUST first use tools to investigate then answer the question.
Do not say 'based on the tool output' or explicitly refer to tools at all.
If you output an answer and then realize you need to call more tools or there are possible next steps, you may do so by calling tools at that point in time.
When querying tools, always query for the relevant time period. The current UTC date and time are {{ now }}. The current UTC timestamp in seconds is {{ now_timestamp_seconds }}.

### Context Awareness:
Be aware that this conversation is follow-up questions to a prior investigation conducted for the {{issue}}.
Expand Down
2 changes: 1 addition & 1 deletion holmes/plugins/prompts/generic_investigation.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Whenever possible you MUST first use tools to investigate then answer the questi
Do not say 'based on the tool output'

Provide an terse analysis of the following {{ issue.source_type }} alert/issue and why it is firing.
* When querying tools, always query for the relevant time period
* When querying tools, always query for the relevant time period. The current UTC date and time are {{ now }}. The current UTC timestamp in seconds is {{ now_timestamp_seconds }}.
* If the tool requires string format timestamps, query from 'start_timestamp' until 'end_timestamp'
* If the tool requires timestamps in milliseconds, query from 'start_timestamp' until 'end_timestamp'
* If you need timestamp in string format, query from 'start_timestamp_millis' until 'end_timestamp_millis'
Expand Down
2 changes: 1 addition & 1 deletion holmes/plugins/prompts/kubernetes_workload_ask.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Do not say 'based on the tool output' or explicitly refer to tools at all.
If you output an answer and then realize you need to call more tools or there are possible next steps, you may do so by calling tools at that point in time.

If the user provides you with extra instructions in a triple single quotes section, ALWAYS perform their instructions and then perform your investigation.

When querying tools, always query for the relevant time period. The current UTC date and time are {{ now }}. The current UTC timestamp in seconds is {{ now_timestamp_seconds }}.

Global Instructions
You may receive a set of “Global Instructions” that describe how to perform certain tasks, handle certain situations, or apply certain best practices. They are not mandatory for every request, but serve as a reference resource and must be used if the current scenario or user request aligns with one of the described methods or conditions.
Expand Down
1 change: 1 addition & 0 deletions holmes/plugins/prompts/kubernetes_workload_chat.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ You are a tool-calling AI assist provided with common DevOps and IT tools that y
Whenever possible, you MUST first use tools to investigate, then answer the question.
Do not say 'based on the tool output' or explicitly refer to tools at all.
If you output an answer and then realize you need to call more tools or there are possible next steps, you may do so by calling tools at that point in time.
When querying tools, always query for the relevant time period. The current UTC date and time are {{ now }}. The current UTC timestamp in seconds is {{ now_timestamp_seconds }}.

### Context Awareness:
Be aware that this conversation is follow-up questions to a prior investigation conducted for the {{resource}}.
Expand Down