diff --git a/apiserver/pkg/modelservice/modelservice.go b/apiserver/pkg/modelservice/modelservice.go index 087a8095e..d11b87688 100644 --- a/apiserver/pkg/modelservice/modelservice.go +++ b/apiserver/pkg/modelservice/modelservice.go @@ -378,9 +378,9 @@ func CheckModelService(ctx context.Context, c client.Client, input generated.Cre switch *input.APIType { case "openai": - info, err = checkOpenAI(ctx, c, input) + info, err = checkOpenAI(ctx, input) case "zhipuai": - info, err = checkZhipuAI(ctx, c, input) + info, err = checkZhipuAI(ctx, input) default: err = fmt.Errorf("not support api type %s", *input.APIType) } @@ -399,22 +399,31 @@ func CheckModelService(ctx context.Context, c client.Client, input generated.Cre return nil, ErrNoAuthProvided } -func checkOpenAI(ctx context.Context, c client.Client, input generated.CreateModelServiceInput) (string, error) { +func checkOpenAI(ctx context.Context, input generated.CreateModelServiceInput) (string, error) { apiKey := input.Endpoint.Auth["apiKey"].(string) client, err := openai.NewOpenAI(apiKey, input.Endpoint.URL) if err != nil { return "", err } - // TODO: able to validate openai models - res, err := client.Validate(ctx, llms.WithModel("")) + // use the first model if specified by user + model := "gpt-3.5" + if input.LlmModels != nil && len(input.LlmModels) > 0 { + model = input.LlmModels[0] + } + if input.EmbeddingModels != nil && len(input.EmbeddingModels) > 0 { + model = input.EmbeddingModels[0] + } + + // able to validate openai models + res, err := client.Validate(ctx, llms.WithModel(model)) if err != nil { return "", err } return res.String(), nil } -func checkZhipuAI(ctx context.Context, c client.Client, input generated.CreateModelServiceInput) (string, error) { +func checkZhipuAI(ctx context.Context, input generated.CreateModelServiceInput) (string, error) { apiKey := input.Endpoint.Auth["apiKey"].(string) client := zhipuai.NewZhiPuAI(apiKey) res, err := client.Validate(ctx) diff --git a/deploy/charts/arcadia/Chart.yaml b/deploy/charts/arcadia/Chart.yaml index 7a5d68118..d3c5ac610 100644 --- a/deploy/charts/arcadia/Chart.yaml +++ b/deploy/charts/arcadia/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: arcadia description: A Helm chart(Also a KubeBB Component) for KubeAGI Arcadia type: application -version: 0.3.11 +version: 0.3.12 appVersion: "0.2.0" keywords: diff --git a/deploy/charts/arcadia/charts/fastchat/templates/ingress.yaml b/deploy/charts/arcadia/charts/fastchat/templates/ingress.yaml deleted file mode 100644 index 6b0431311..000000000 --- a/deploy/charts/arcadia/charts/fastchat/templates/ingress.yaml +++ /dev/null @@ -1,61 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := .Release.Name -}} -{{- $svcPort := .Values.service.apiServer.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }}-fastchat - labels: - control-plane: {{ .Release.Name }}-fastchat - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ .port }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ .port }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/deploy/charts/arcadia/templates/agent-portal.yaml b/deploy/charts/arcadia/templates/agent-portal.yaml index deae422a8..91fcc6fdb 100644 --- a/deploy/charts/arcadia/templates/agent-portal.yaml +++ b/deploy/charts/arcadia/templates/agent-portal.yaml @@ -56,6 +56,9 @@ spec: name: agentportal-config-volume subPath: .env.production restartPolicy: Always + {{- if .Values.global.hostConfig.enabled }} + hostAliases: {{ toYaml .Values.global.hostConfig.hostAliases | nindent 6 }} + {{- end }} volumes: - hostPath: path: /etc/localtime diff --git a/deploy/charts/arcadia/templates/apiserver.yaml b/deploy/charts/arcadia/templates/apiserver.yaml index c44271dfb..ce8e562b3 100644 --- a/deploy/charts/arcadia/templates/apiserver.yaml +++ b/deploy/charts/arcadia/templates/apiserver.yaml @@ -14,6 +14,9 @@ spec: app: {{ .Release.Name }}-apiserver spec: serviceAccountName: {{ .Release.Name }} + {{- if .Values.global.hostConfig.enabled }} + hostAliases: {{ toYaml .Values.global.hostConfig.hostAliases | nindent 6 }} + {{- end }} containers: - name: apiserver image: {{ .Values.apiserver.image }} diff --git a/deploy/charts/arcadia/templates/controller.yaml b/deploy/charts/arcadia/templates/controller.yaml index dd800303d..4cfc2b479 100644 --- a/deploy/charts/arcadia/templates/controller.yaml +++ b/deploy/charts/arcadia/templates/controller.yaml @@ -67,3 +67,6 @@ spec: resources: {{ toYaml .Values.controller.resources | nindent 10 }} serviceAccountName: {{ .Release.Name }} terminationGracePeriodSeconds: 10 + {{- if .Values.global.hostConfig.enabled }} + hostAliases: {{ toYaml .Values.global.hostConfig.hostAliases | nindent 6 }} + {{- end }} diff --git a/deploy/charts/arcadia/templates/dataprocess.yaml b/deploy/charts/arcadia/templates/dataprocess.yaml index 65ae38b95..876f8621c 100644 --- a/deploy/charts/arcadia/templates/dataprocess.yaml +++ b/deploy/charts/arcadia/templates/dataprocess.yaml @@ -16,6 +16,9 @@ spec: control-plane: {{ .Release.Name }}-dataprocess spec: serviceAccountName: {{ .Release.Name }} + {{- if .Values.global.hostConfig.enabled }} + hostAliases: {{ toYaml .Values.global.hostConfig.hostAliases | nindent 6 }} + {{- end }} containers: - name: data-process image: {{ .Values.dataprocess.image }} diff --git a/deploy/charts/arcadia/templates/ops-console.yaml b/deploy/charts/arcadia/templates/ops-console.yaml index dba756f87..fcf4d3161 100644 --- a/deploy/charts/arcadia/templates/ops-console.yaml +++ b/deploy/charts/arcadia/templates/ops-console.yaml @@ -14,6 +14,9 @@ spec: labels: app: {{ .Release.Name }}-opsconsole spec: + {{- if .Values.global.hostConfig.enabled }} + hostAliases: {{ toYaml .Values.global.hostConfig.hostAliases | nindent 6 }} + {{- end }} containers: - image: {{ .Values.opsconsole.image }} imagePullPolicy: IfNotPresent diff --git a/deploy/charts/arcadia/templates/rag_job_rbac.yaml b/deploy/charts/arcadia/templates/rag_job_rbac.yaml deleted file mode 100644 index 6f24edcd5..000000000 --- a/deploy/charts/arcadia/templates/rag_job_rbac.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: ragas-eval-clusterrole -rules: -- apiGroups: - - "" - resources: - - configmaps - - secrets - verbs: - - get - - list -- apiGroups: - - arcadia.kubeagi.k8s.com.cn - resources: - - datasources - - versioneddatasets - - applications - - llms - - knowledgebases - - embedders - - vectorstores - verbs: - - get - - list -- apiGroups: - - evaluation.arcadia.kubeagi.k8s.com.cn - resources: - - rags - verbs: - - get - - list -- apiGroups: - - chain.arcadia.kubeagi.k8s.com.cn - resources: - - llmchains - - retrievalqachains - verbs: - - get - - list -- apiGroups: - - prompt.arcadia.kubeagi.k8s.com.cn - resources: - - prompts - verbs: - - get - - list -- apiGroups: - - retriever.arcadia.kubeagi.k8s.com.cn - resources: - - knowledgebaseretrievers - verbs: - - list - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: ragas-eval-clusterrolebinding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: ragas-eval-clusterrole diff --git a/deploy/charts/arcadia/templates/rbac.yaml b/deploy/charts/arcadia/templates/rbac.yaml index e55fd19ed..9c5ff6e30 100644 --- a/deploy/charts/arcadia/templates/rbac.yaml +++ b/deploy/charts/arcadia/templates/rbac.yaml @@ -703,3 +703,68 @@ rules: verbs: - get - list +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: ragas-eval-clusterrole +rules: +- apiGroups: + - "" + resources: + - configmaps + - secrets + verbs: + - get + - list +- apiGroups: + - arcadia.kubeagi.k8s.com.cn + resources: + - datasources + - versioneddatasets + - applications + - llms + - knowledgebases + - embedders + - vectorstores + verbs: + - get + - list +- apiGroups: + - evaluation.arcadia.kubeagi.k8s.com.cn + resources: + - rags + verbs: + - get + - list +- apiGroups: + - chain.arcadia.kubeagi.k8s.com.cn + resources: + - llmchains + - retrievalqachains + verbs: + - get + - list +- apiGroups: + - prompt.arcadia.kubeagi.k8s.com.cn + resources: + - prompts + verbs: + - get + - list +- apiGroups: + - retriever.arcadia.kubeagi.k8s.com.cn + resources: + - knowledgebaseretrievers + verbs: + - list + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: ragas-eval-clusterrolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: ragas-eval-clusterrole diff --git a/deploy/charts/arcadia/values.yaml b/deploy/charts/arcadia/values.yaml index 1e15ff49b..694459256 100644 --- a/deploy/charts/arcadia/values.yaml +++ b/deploy/charts/arcadia/values.yaml @@ -6,6 +6,20 @@ global: ## When the option is `pgvector`, it needs `postgresql.enabled` to be `true` as well to work. defaultVectorStoreType: pgvector + # Enable and update the ip if nip.io is NOT accessible in deployed environment + hostConfig: + enabled: true + hostAliases: + - hostnames: + - portal..nip.io + - gpts..nip.io + - minio-api..nip.io + - fastchat-api..nip.io + - fastchat-controller..nip.io + - minio-api..nip.io + - postgresql..nip.io + ip: + # @section controller is used as the core controller for arcadia # @param image Image to be used # @param imagePullPolcy ImagePullPolicy diff --git a/tests/deploy-values.yaml b/tests/deploy-values.yaml index 11300f841..46b76c766 100644 --- a/tests/deploy-values.yaml +++ b/tests/deploy-values.yaml @@ -1,5 +1,9 @@ global: defaultVectorStoreType: pgvector + + # Enable and update the ip if nip.io is NOT accessible in deployed environment + hostConfig: + enabled: false # @section controller is used as the core controller for arcadia # @param image Image to be used # @param imagePullPolcy ImagePullPolicy