Skip to content

Commit

Permalink
Merge branch 'master' into main-2440-global-instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
itisallgood authored Dec 23, 2024
2 parents 32606d6 + 2a01c7e commit b59ad18
Show file tree
Hide file tree
Showing 7 changed files with 275 additions and 5 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,45 @@ export OPENAI_API_KEY=123
holmes ask "what pods are unhealthy in my cluster?" --model="openai/llama3.1"
```

</details>
<details>
<summary>Gemini/Google AI Studio</summary>

To use Gemini, set the `GEMINI_API_KEY` environment variable as follows:

```bash
export GEMINI_API_KEY="your-gemini-api-key"
```

Once the environment variable is set, you can run the following command to interact with Gemini:

```bash
holmes ask "what pods are unhealthy and why?" --model=gemini/<MODEL_NAME>
```

Be sure to replace `MODEL_NAME` with a model you have access to - e.g., `gemini-pro`,`gemini/gemini-1.5-flash`, etc.

</details>
<details>
<summary>Vertex AI Gemini</summary>

To use Vertex AI with Gemini models, set the following environment variables:

```bash
export VERTEXAI_PROJECT="your-project-id"
export VERTEXAI_LOCATION="us-central1"
export GOOGLE_APPLICATION_CREDENTIALS="path/to/your/service_account_key.json"
```

Once the environment variables are set, you can run the following command to interact with Vertex AI Gemini models:

```bash
poetry run python holmes.py ask "what pods are unhealthy and why?" --model "vertex_ai/<MODEL_NAME>"
```

Be sure to replace `MODEL_NAME` with a model you have access to - e.g., `gemini-pro`,`gemini-2.0-flash-exp`, etc.
Ensure you have the correct project, location, and credentials for accessing the desired Vertex AI model.

</details>
<details>
<summary>Using other OpenAI-compatible models</summary>
Expand Down
7 changes: 6 additions & 1 deletion helm/holmes/templates/holmes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ spec:
mountPath: /etc/robusta/config
- name: custom-toolsets-configmap
mountPath: /etc/holmes/config
{{- if .Values.additionalVolumeMounts -}}
{{ toYaml .Values.additionalVolumeMounts | nindent 10 }}
{{- end }}
resources:
requests:
cpu: {{ .Values.resources.requests.cpu }}
Expand All @@ -74,7 +77,9 @@ spec:
configMap:
name: custom-toolsets-configmap
optional: true

{{- if .Values.additionalVolumes -}}
{{ toYaml .Values.additionalVolumes | nindent 8 }}
{{- end }}
---
apiVersion: v1
kind: Service
Expand Down
3 changes: 3 additions & 0 deletions helm/holmes/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ resources:
memory: 1024Mi
limits:
memory: 1024Mi

additionalVolumes: []
additionalVolumeMounts: []
2 changes: 2 additions & 0 deletions holmes/core/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def _strip_model_prefix(self) -> str:
model_name = model_name[len('openai/'):] # Strip the 'openai/' prefix
elif model_name.startswith('bedrock/'):
model_name = model_name[len('bedrock/'):] # Strip the 'bedrock/' prefix
elif model_name.startswith('vertex_ai/'):
model_name = model_name[len('vertex_ai/'):] # Strip the 'vertex_ai/' prefix

return model_name

Expand Down
6 changes: 5 additions & 1 deletion holmes/core/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ def get_openai_format(self):
},
},
}

# gemini doesnt have parameters object if it is without params
if tool_properties is None:
result["function"].pop("parameters")

return result

@abstractmethod
Expand Down Expand Up @@ -391,7 +396,6 @@ def get_tool_by_name(self, name: str) -> Optional[YAMLTool]:
def get_all_tools_openai_format(self):
return [tool.get_openai_format() for tool in self.tools_by_name.values()]


class ToolsetYamlFromConfig(Toolset):
name: str
enabled: bool = True
Expand Down
222 changes: 219 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ playwright = "1.48.0"
bs4 = "^0.0.2"
markdownify = "^0.13.1"
starlette = "^0.40"
google-api-python-client = "^2.156.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.3.3"
Expand Down

0 comments on commit b59ad18

Please sign in to comment.