-
Notifications
You must be signed in to change notification settings - Fork 25
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 #800 from Abirdcfly/MultiQueryRetriever
feat: add multiQueryRetriever
- Loading branch information
Showing
31 changed files
with
1,168 additions
and
40 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
77 changes: 77 additions & 0 deletions
77
api/app-node/retriever/v1alpha1/multiqueryretriever_types.go
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,77 @@ | ||
/* | ||
Copyright 2024 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" | ||
) | ||
|
||
// MultiQueryRetrieverSpec defines the desired state of MultiQueryRetriever | ||
type MultiQueryRetrieverSpec struct { | ||
v1alpha1.CommonSpec `json:",inline"` | ||
CommonRetrieverConfig `json:",inline"` | ||
} | ||
|
||
// MultiQueryRetrieverStatus defines the observed state of MultiQueryRetriever | ||
type MultiQueryRetrieverStatus 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 | ||
|
||
// MultiQueryRetriever is the Schema for the MultiQueryRetriever API | ||
type MultiQueryRetriever struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec MultiQueryRetrieverSpec `json:"spec,omitempty"` | ||
Status MultiQueryRetrieverStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// MultiQueryRetrieverList contains a list of MultiQueryRetriever | ||
type MultiQueryRetrieverList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []MultiQueryRetriever `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&MultiQueryRetriever{}, &MultiQueryRetrieverList{}) | ||
} | ||
|
||
var _ node.Node = (*MultiQueryRetriever)(nil) | ||
|
||
func (c *MultiQueryRetriever) SetRef() { | ||
annotations := node.SetRefAnnotations(c.GetAnnotations(), []node.Ref{node.RetrieverRef.Len(1)}, []node.Ref{node.RetrievalQAChainRef.Len(1)}) | ||
if c.GetAnnotations() == nil { | ||
c.SetAnnotations(annotations) | ||
} | ||
for k, v := range annotations { | ||
c.Annotations[k] = v | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
112 changes: 112 additions & 0 deletions
112
config/crd/bases/retriever.arcadia.kubeagi.k8s.com.cn_multiqueryretrievers.yaml
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,112 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.9.2 | ||
creationTimestamp: null | ||
name: multiqueryretrievers.retriever.arcadia.kubeagi.k8s.com.cn | ||
spec: | ||
group: retriever.arcadia.kubeagi.k8s.com.cn | ||
names: | ||
kind: MultiQueryRetriever | ||
listKind: MultiQueryRetrieverList | ||
plural: multiqueryretrievers | ||
singular: multiqueryretriever | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: MultiQueryRetriever is the Schema for the MultiQueryRetriever | ||
API | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: MultiQueryRetrieverSpec defines the desired state of MultiQueryRetriever | ||
properties: | ||
creator: | ||
description: Creator defines datasource creator (AUTO-FILLED by webhook) | ||
type: string | ||
description: | ||
description: Description defines datasource description | ||
type: string | ||
displayName: | ||
description: DisplayName defines datasource display name | ||
type: string | ||
numDocuments: | ||
default: 5 | ||
description: NumDocuments is the max number of documents to return. | ||
maximum: 50 | ||
minimum: 1 | ||
type: integer | ||
scoreThreshold: | ||
default: 0.3 | ||
description: ScoreThreshold is the cosine distance float score threshold. | ||
Lower score represents more similarity. | ||
maximum: 1 | ||
minimum: 0 | ||
type: number | ||
type: object | ||
status: | ||
description: MultiQueryRetrieverStatus defines the observed state of MultiQueryRetriever | ||
properties: | ||
conditions: | ||
description: Conditions of the resource. | ||
items: | ||
description: A Condition that may apply to a resource. | ||
properties: | ||
lastSuccessfulTime: | ||
description: LastSuccessfulTime is repository Last Successful | ||
Update Time | ||
format: date-time | ||
type: string | ||
lastTransitionTime: | ||
description: LastTransitionTime is the last time this condition | ||
transitioned from one status to another. | ||
format: date-time | ||
type: string | ||
message: | ||
description: A Message containing details about this condition's | ||
last transition from one status to another, if any. | ||
type: string | ||
reason: | ||
description: A Reason for this condition's last transition from | ||
one status to another. | ||
type: string | ||
status: | ||
description: Status of this condition; is it currently True, | ||
False, or Unknown | ||
type: string | ||
type: | ||
description: Type of this condition. At most one of each condition | ||
type may apply to a resource at any point in time. | ||
type: string | ||
required: | ||
- lastTransitionTime | ||
- reason | ||
- status | ||
- type | ||
type: object | ||
type: array | ||
observedGeneration: | ||
description: ObservedGeneration is the last observed generation. | ||
format: int64 | ||
type: integer | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
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
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
Oops, something went wrong.