Skip to content

Commit

Permalink
Addressing Action Recognition Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
feiskyer committed Jul 8, 2023
1 parent 2f7f899 commit acd4fb9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 17 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ Features:

```sh
# Option 1: OpenAI
export OPENAI_API_KEY="<replace-this>"
helm install kube-copilot kube-copilot \
--repo https://feisky.xyz/kube-copilot \
--set openai.apiModel=gpt-4 \
--set openai.apiKey=$OPENAI_API_KEY \
--set openai.apiBase=$OPENAI_API_BASE
--set openai.apiKey=$OPENAI_API_KEY

# Option 2: Azure OpenAI Service
export OPENAI_API_KEY="<replace-this>"
export OPENAI_API_BASE="<replace-this>"
helm install kube-copilot kube-copilot \
--repo https://feisky.xyz/kube-copilot \
--set openai.apiModel=gpt-4 \
Expand Down
4 changes: 2 additions & 2 deletions helm/kube-copilot/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.19
version: 0.1.20
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: 0.1.19
appVersion: 0.1.20
12 changes: 3 additions & 9 deletions helm/kube-copilot/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "kube-copilot.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "kube-copilot.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "kube-copilot.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "kube-copilot.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- else }}
echo "Visit http://127.0.0.1:8080 to use the copilot"
kubectl port-forward --namespace {{ .Release.Namespace }} service/kube-copilot 8080:80
{{- end }}
2 changes: 1 addition & 1 deletion helm/kube-copilot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replicaCount: 1
image:
repository: ghcr.io/feiskyer/kube-copilot
pullPolicy: Always
tag: v0.1.19
tag: v0.1.20
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
Expand Down
4 changes: 2 additions & 2 deletions kube_copilot/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def get_format_instructions(self) -> str:
def parse(self, text: str) -> Union[AgentAction, AgentFinish]:
includes_answer = FINAL_ANSWER_ACTION in text
try:
action = text.split("```")[1]
action = text.split("```")[1].strip()
if action.startswith('python\n'):
# Ensure the Python code snippets are handled by the Python action.
response = {
Expand All @@ -30,7 +30,7 @@ def parse(self, text: str) -> Union[AgentAction, AgentFinish]:
}
else:
# JSON object is expected by default.
response = json.loads(action.strip())
response = json.loads(action.strip(), strict=False)

includes_action = "action" in response and "action_input" in response
if includes_answer and includes_action:
Expand Down
10 changes: 10 additions & 0 deletions kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
### Option 1: Install with OpenAI

```sh
export OPENAI_API_KEY="<replace-this>"

helm install kube-copilot kube-copilot \
--repo https://feisky.xyz/kube-copilot \
--set openai.apiModel=gpt-4 \
Expand All @@ -14,6 +16,9 @@ helm install kube-copilot kube-copilot \
### Option 2: Install with Azure OpenAI Service

```sh
export OPENAI_API_KEY="<replace-this>"
export OPENAI_API_BASE="<replace-this>"

helm install kube-copilot kube-copilot \
--repo https://feisky.xyz/kube-copilot \
--set openai.apiModel=gpt-4 \
Expand All @@ -24,6 +29,11 @@ helm install kube-copilot kube-copilot \
### Option 3: Azure OpenAI Service + Google Search

```sh
export OPENAI_API_KEY="<replace-this>"
export OPENAI_API_BASE="<replace-this>"
export GOOGLE_API_KEY="<replace-this>"
export GOOGLE_CSE_ID="<replace-this>"

helm install kube-copilot kube-copilot \
--repo https://feisky.xyz/kube-copilot \
--set openai.apiModel=gpt-4 \
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "kube-copilot"
version = "0.1.19"
version = "0.1.20"
description = "Kubernetes Copilot"
authors = ["Pengfei Ni <feiskyer@gmail.com>"]
readme = "README.md"
Expand Down

0 comments on commit acd4fb9

Please sign in to comment.