-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from Abirdcfly/app
feat: add CRD Application
- Loading branch information
Showing
100 changed files
with
3,896 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Copyright 2023 KubeAGI. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package v1alpha1 contains API Schema definitions for the arcadia v1alpha1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=chain.arcadia.kubeagi.k8s.com.cn | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
const ( | ||
Group = "chain.arcadia.kubeagi.k8s.com.cn" | ||
Version = "v1alpha1" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: Group, Version: Version} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
Copyright 2023 KubeAGI. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
node "github.com/kubeagi/arcadia/api/app-node" | ||
"github.com/kubeagi/arcadia/api/base/v1alpha1" | ||
) | ||
|
||
// LLMChainSpec defines the desired state of LLMChain | ||
type LLMChainSpec struct { | ||
v1alpha1.CommonSpec `json:",inline"` | ||
|
||
CommonChainConfig `json:",inline"` | ||
|
||
Input Input `json:"input"` | ||
Output Output `json:"output"` | ||
} | ||
|
||
type Input struct { | ||
LLM node.LLMRef `json:"llm"` | ||
Prompt node.PromptRef `json:"prompt"` | ||
} | ||
type Output struct { | ||
node.CommonOrInPutOrOutputRef `json:",inline"` | ||
} | ||
|
||
type CommonChainConfig struct { | ||
// 记忆相关参数 | ||
Memory Memory `json:"memory,omitempty"` | ||
} | ||
|
||
type Memory struct { | ||
// 能记住的最大 token 数 | ||
MaxTokenLimit int `json:"maxTokenLimit,omitempty"` | ||
} | ||
|
||
// LLMChainStatus defines the observed state of LLMChain | ||
type LLMChainStatus struct { | ||
// ObservedGeneration is the last observed generation. | ||
// +optional | ||
ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
|
||
// ConditionedStatus is the current status | ||
v1alpha1.ConditionedStatus `json:",inline"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
// LLMChain is the Schema for the LLMChains API | ||
type LLMChain struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec LLMChainSpec `json:"spec,omitempty"` | ||
Status LLMChainStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// LLMChainList contains a list of LLMChain | ||
type LLMChainList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []LLMChain `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&LLMChain{}, &LLMChainList{}) | ||
} |
Oops, something went wrong.