Skip to content

Commit

Permalink
Merge pull request #54 from bjwswang/llms
Browse files Browse the repository at this point in the history
fix: ignore Create if condtions not zero
  • Loading branch information
bjwswang authored Aug 23, 2023
2 parents 8dc2aad + ec82d38 commit 90448ef
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 19 deletions.
74 changes: 74 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# based on https://github.com/kubernetes/kubernetes/blame/e6218f3d3bede036b2d67a4349dd761aac06ae97/hack/golangci-strict.yaml

run:
timeout: 30m
skip-files:
- "^zz_generated.*"

issues:
max-same-issues: 0
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# exclude ineffassign linter for generated files for conversion
- path: conversion\.go
linters:
- ineffassign
# The Kubernetes naming convention for conversion functions uses underscores
# and intentionally deviates from normal Go conventions to make those function
# names more readable. Same for SetDefaults_*.
- linters:
- stylecheck
text: "ST1003: should not use underscores in Go names; func (Convert_.*_To_.*|SetDefaults_)"
# This check currently has some false positives (https://github.com/nunnatsa/ginkgolinter/issues/91).
- linters:
- ginkgolinter
text: use a function call in (Eventually|Consistently)

linters:
disable-all: false # in contrast to golangci.yaml, the default set of linters remains enabled
enable: # please keep this alphabetized and in sync with golangci.yaml
- dupword # add by kubeagi
- ginkgolinter
- gci # add by kubeagi
- gocritic
- govet
- ineffassign
# - logcheck # we do not need this linter
- mirror # add by kubeagi
- staticcheck
- stylecheck
- unused
- whitespace

linters-settings: # please keep this alphabetized
# we do not import logcheck source code and package
# custom:
# logcheck:
# # Installed there by hack/verify-golangci-lint.sh.
# path: ../_output/local/bin/logcheck.so
# description: structured logging checker
# original-url: k8s.io/logtools/logcheck
gocritic:
staticcheck:
checks:
- "all"
stylecheck:
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/kubeagi/arcadia) # Custom section: groups all imports with the specified Prefix.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
# Skip generated files.
# Default: true
skip-generated: true
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
custom-order: true
23 changes: 5 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,14 @@ Output:
{"code":200,"data":{"choices":[{"content":"\" Kubernetes (also known as K8s) is an open-source container orchestration system for automating the deployment, scaling, and management of containerized applications. It was originally designed by Google, and is now maintained by the Cloud Native Computing Foundation (CNCF).\\n\\nKubernetes provides a platform-as-a-service (PaaS) model, which allows developers to deploy, run, and scale containerized applications with minimal configuration and effort. It does this by abstracting the underlying infrastructure and providing a common set of APIs and tools that can be used to deploy, manage, and scale applications consistently across different environments.\\n\\nKubernetes is widely adopted by organizations of all sizes and has a large, active community of developers contributing to its continued development and improvement. It is available on a variety of platforms, including Linux, Windows, and 移动设备,and can be deployed on-premises, in the cloud, or in a hybrid environment.\"","role":"assistant"}],"request_id":"7865480399259975113","task_id":"7865480399259975113","task_status":"SUCCESS","usage":{"total_tokens":203}},"msg":"操作成功","success":true}
```

## Why in Kubernetes?
## Library

Kubernetes provides an ideal platform for building the intelligent systems required to realize our vision of an AI-powered utopia. Some of the key reasons are:
To support different kinds of LLM services,we developed some libs.

• Scalability: Kubernetes can easily scale from a few nodes to thousands, allowing the system to grow as our utopia expands.
### ZhiPuAI

• Portability: Kubernetes abstracts the underlying infrastructure, making the system hardware agnostic and portable.

• Auto-healing: Kubernetes' self-healing capabilities ensure that applications keep running smoothly with minimal human intervention.

• Service discovery and load balancing: Exposing applications as Kubernetes services provides a unified way for them to discover and communicate with each other.

• Resource Optimization: Kubernetes automatically manages and schedules compute resources, ensuring optimal utilization.

• Extensibility: The ecosystem of Kubernetes operators and custom controllers allows extending the platform to meet our futuristic needs.

• Integrations: Kubernetes seamlessly integrates with other cloud-native technologies like Istio, Prometheus etc., which are essential for building intelligent systems.

• Abstraction: Kubernetes abstracts the complexities of container and cluster orchestration, allowing us to focus on building the AI models and applications.

In summary, Kubernetes provides an ideal foundation for building a distributed intelligent system of the scale and complexity required to realize our vision of an AI-powered utopia. Its maturity, robustness and cloud-native design make it a perfect vehicle for our lofty goals.
- [Library](https://github.com/kubeagi/arcadia/tree/main/pkg/llms/zhipuai)
- [Examples on How to use this Library](https://github.com/kubeagi/arcadia/blob/main/examples/zhipuai/main.go)

## Contribute to Arcadia

Expand Down
14 changes: 13 additions & 1 deletion controllers/prompt_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
)

Expand Down Expand Up @@ -131,6 +134,15 @@ func (r *PromptReconciler) CallLLM(ctx context.Context, logger logr.Logger, prom
// SetupWithManager sets up the controller with the Manager.
func (r *PromptReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&arcadiav1alpha1.Prompt{}).
For(&arcadiav1alpha1.Prompt{}, builder.WithPredicates(PromptPredicates{})).
Complete(r)
}

type PromptPredicates struct {
predicate.Funcs
}

func (p PromptPredicates) Create(ce event.CreateEvent) bool {
prompt := ce.Object.(*arcadiav1alpha1.Prompt)
return len(prompt.Status.ConditionedStatus.Conditions) == 0
}

0 comments on commit 90448ef

Please sign in to comment.