Documentation ¶
Overview ¶
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.
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.
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.
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.
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.
Index ¶
- Constants
- Variables
- func DeleteAllOptions(input *generated.DeleteCommonInput) ([]client.DeleteAllOfOption, error)
- func EditCSV(r io.Reader, updateLines []CSVLine, addLines [][]string, delLines []int) (io.Reader, int64, error)
- func GenerateAuthSecretName(base string, ownerKind string) string
- func GetAPIServer(ctx context.Context, cli client.Client, external bool) (string, error)
- func GetAppCategory(app *v1alpha1.Application) []*string
- func GetObjStatus(obj client.Object) string
- func ListReources(items []client.Object, page, pageSize int, converter ResourceConverter, ...) (*generated.PaginatedResult, error)
- func MakeAuthSecret(ctx context.Context, c client.Client, secretNamespace, secretName string, ...) error
- func MakeEndpoint(ctx context.Context, c client.Client, owner client.Object, ...) (v1alpha1.Endpoint, error)
- func NewListOptions(input generated.ListCommonInput) ([]client.ListOption, error)
- func PagePosition(page, size, total int) (int, int)
- func SetCreator(ctx context.Context, common *v1alpha1.CommonSpec)
- func SystemDatasourceOSS(ctx context.Context, mgrClient client.Client) (*datasource.OSS, error)
- func SystemEmbeddingSuite(ctx context.Context, cli client.Client) (*v1alpha1.Embedder, *v1alpha1.VectorStore, error)
- func TypedObjectReferenceToInput(ref generated.TypedObjectReference) generated.TypedObjectReferenceInput
- type CSVLine
- type ListOptions
- type ListOptionsFunc
- type PageNodeConvertFunc
- type PageNodeSorter
- type ReadCSVResult
- type ResourceConverter
- type ResourceFilter
- func FilterApplicationByCategory(category string) ResourceFilter
- func FilterApplicationByKeyword(keyword string) ResourceFilter
- func FilterByNameContains(name string) ResourceFilter
- func FilterByRAGKeyword(keyword string) ResourceFilter
- func FilterDatasetByDisplayName(displayName string) ResourceFilter
- func FilterDatasetByKeyword(keyword string) ResourceFilter
- func FilterDatasourceByKeyword(keyword string) ResourceFilter
- func FilterEmbedderByKeyword(keyword string) ResourceFilter
- func FilterKnowledgeByDisplayName(displayName string) ResourceFilter
- func FilterLLMByKeyword(keyword string) ResourceFilter
- func FilterModelByKeyword(keyword string) ResourceFilter
- func FilterRAGByStatus(status string) ResourceFilter
- func FilterVersionedDatasetByDisplayName(displayName string) ResourceFilter
- func FilterVersionedDatasetByKeyword(keyword string) ResourceFilter
- func FilterWorkerByKeyword(keyword string) ResourceFilter
- func FilterWorkerByType(c client.Client, namespace, modelType string) ResourceFilter
- type UpdateCSVBody
Constants ¶
const ( // The creation time of the file in minio, // in this case the generation time of the uplaodid when it was sliced. CreationTimestamp = "creationTimestamp" // This field refers to the file type // In the data returned by minio, there is usually content-type in userMetadata, // but this is made explicit by the content-type when the file is uploaded, // and if there are other types, we should need to determine them by userTags. FileContentType = "content-type" FileNotUploaded int = iota FileUploaded // maxPartsCount - maximum number of parts for a single multipart session. MaxPartsCount = 10000 // maxMultipartPutObjectSize - maximum size 5TiB of object for // Multipart operation. MaxMultipartPutObjectSize = 1024 * 1024 * 1024 * 1024 * 5 // minPartSize - minimum part size 128MiB per object after which // putObject behaves internally as multipart. MinPartSize = 1024 * 1024 * 64 )
Variables ¶
var ( DefaultNamespace = "default" ErrNoResourceKind = errors.New("must provide resource kind") // Common status StatusTrue = "True" StatusFalse = "False" )
var ( ModelTypeAll = "llm,embedding" ModelTypeLLM = "llm" ModelTypeEmbedding = "embedding" )
ModelType
var ( ModelSourceLocal = "local" ModelSourceModelscope = "modelscope" ModelSourceHuggingface = "huggingface" )
ModelSource
var ( DefaultPageNodeConvertFunc = func(node any) generated.PageNode { pageNode, ok := node.(generated.PageNode) if !ok { return nil } return pageNode } )
var (
// UnlimitedPageSize which means all
UnlimitedPageSize = -1
)
Functions ¶
func DeleteAllOptions ¶ added in v0.2.0
func DeleteAllOptions(input *generated.DeleteCommonInput) ([]client.DeleteAllOfOption, error)
func GenerateAuthSecretName ¶ added in v0.2.0
GenerateAuthSecretName returns a secret name based on its base name and owner's kind
func GetAPIServer ¶
GetAPIServer returns the api server url to access arcadia's worker if external is true,then this func will return the external api server
func GetAppCategory ¶ added in v0.2.0
func GetAppCategory(app *v1alpha1.Application) []*string
func GetObjStatus ¶
GetObjStatus is used to calculate the state of the resource, unified management, in general, a resource will only record its own state, then the state calculation of this resource, should be written to this function. But for some special resources. For example, VersionedDataset, he needs to calculate multiple states, it is not suitable for this function.
func ListReources ¶ added in v0.2.0
func ListReources(items []client.Object, page, pageSize int, converter ResourceConverter, options ...ResourceFilter) (*generated.PaginatedResult, error)
ListReources filtering resources based on conditions will modify the original array, so if you want to preserve the original data, make a backup before calling the function
func MakeAuthSecret ¶
func MakeAuthSecret(ctx context.Context, c client.Client, secretNamespace, secretName string, input map[string]interface{}, owner client.Object) error
MakeAuthSecret will create or update a secret based on auth input When owner is not nil, owner reference will be set
func MakeEndpoint ¶
func MakeEndpoint(ctx context.Context, c client.Client, owner client.Object, input generated.EndpointInput) (v1alpha1.Endpoint, error)
MakeEndpoint provides a common way to handle endpoint input owner means the resource who owns this endpoint
func NewListOptions ¶ added in v0.2.0
func NewListOptions(input generated.ListCommonInput) ([]client.ListOption, error)
func PagePosition ¶ added in v0.2.0
func SetCreator ¶
func SetCreator(ctx context.Context, common *v1alpha1.CommonSpec)
func SystemDatasourceOSS ¶
func SystemEmbeddingSuite ¶ added in v0.2.0
func SystemEmbeddingSuite(ctx context.Context, cli client.Client) (*v1alpha1.Embedder, *v1alpha1.VectorStore, error)
SystemEmbeddingSuite returns the embedder and vectorstore which are built-in in system config Embedder and vectorstore are both required when generating a new embedding.That's why we call it a `EmbeddingSuit`
func TypedObjectReferenceToInput ¶ added in v0.2.0
func TypedObjectReferenceToInput(ref generated.TypedObjectReference) generated.TypedObjectReferenceInput
Types ¶
type ListOptions ¶
type ListOptions struct {
ConvertFunc PageNodeConvertFunc
}
ListOptions for graphql list
func DefaultListOptions ¶
func DefaultListOptions() *ListOptions
DefaultListOptions initialize a ListOptions with default settings
type ListOptionsFunc ¶
type ListOptionsFunc func(options *ListOptions)
func WithPageNodeConvertFunc ¶
func WithPageNodeConvertFunc(convertFunc PageNodeConvertFunc) ListOptionsFunc
WithPageNodeConvertFunc update the PageNodeConvertFunc
type PageNodeConvertFunc ¶
PageNodeConvertFunc convert `any` to a `PageNode`
type PageNodeSorter ¶ added in v0.2.0
func (*PageNodeSorter) Len ¶ added in v0.2.0
func (p *PageNodeSorter) Len() int
func (*PageNodeSorter) Less ¶ added in v0.2.0
func (p *PageNodeSorter) Less(i, j int) bool
func (*PageNodeSorter) Pop ¶ added in v0.2.0
func (p *PageNodeSorter) Pop() any
func (*PageNodeSorter) Push ¶ added in v0.2.0
func (p *PageNodeSorter) Push(x any)
func (*PageNodeSorter) Swap ¶ added in v0.2.0
func (p *PageNodeSorter) Swap(i, j int)
type ReadCSVResult ¶
type ReadCSVResult struct { Rows [][]string `json:"rows"` Total int64 `json:"total"` Version string `json:"version"` }
func ReadCSV ¶
func ReadCSV(o io.Reader, startLine, lines, cachedTotalLines int64) (ReadCSVResult, error)
ReadCSV Reads the contents of a csv file by lines according to startLine and lines, if cacheLines=0 then the total number of lines in the file will be counted, otherwise the total number of lines in the file will not be counted and the speedup function returns.
type ResourceConverter ¶ added in v0.2.0
type ResourceFilter ¶ added in v0.2.0
func FilterApplicationByCategory ¶ added in v0.2.0
func FilterApplicationByCategory(category string) ResourceFilter
func FilterApplicationByKeyword ¶ added in v0.2.0
func FilterApplicationByKeyword(keyword string) ResourceFilter
Application
func FilterByNameContains ¶ added in v0.2.0
func FilterByNameContains(name string) ResourceFilter
func FilterByRAGKeyword ¶ added in v0.2.0
func FilterByRAGKeyword(keyword string) ResourceFilter
func FilterDatasetByDisplayName ¶ added in v0.2.0
func FilterDatasetByDisplayName(displayName string) ResourceFilter
Dataset Filter
func FilterDatasetByKeyword ¶ added in v0.2.0
func FilterDatasetByKeyword(keyword string) ResourceFilter
func FilterDatasourceByKeyword ¶ added in v0.2.0
func FilterDatasourceByKeyword(keyword string) ResourceFilter
Datasource
func FilterEmbedderByKeyword ¶ added in v0.2.0
func FilterEmbedderByKeyword(keyword string) ResourceFilter
Embedder
func FilterKnowledgeByDisplayName ¶ added in v0.2.0
func FilterKnowledgeByDisplayName(displayName string) ResourceFilter
KnowledgeBase
func FilterLLMByKeyword ¶ added in v0.2.0
func FilterLLMByKeyword(keyword string) ResourceFilter
LLM
func FilterModelByKeyword ¶ added in v0.2.0
func FilterModelByKeyword(keyword string) ResourceFilter
Model
func FilterRAGByStatus ¶ added in v0.2.0
func FilterRAGByStatus(status string) ResourceFilter
func FilterVersionedDatasetByDisplayName ¶ added in v0.2.0
func FilterVersionedDatasetByDisplayName(displayName string) ResourceFilter
VersionedData
func FilterVersionedDatasetByKeyword ¶ added in v0.2.0
func FilterVersionedDatasetByKeyword(keyword string) ResourceFilter
func FilterWorkerByKeyword ¶ added in v0.2.0
func FilterWorkerByKeyword(keyword string) ResourceFilter
Worekr
func FilterWorkerByType ¶ added in v0.2.0
func FilterWorkerByType(c client.Client, namespace, modelType string) ResourceFilter
type UpdateCSVBody ¶ added in v0.2.1
type UpdateCSVBody struct { // BucketName string `json:"bucketName"`, from header BucketPath string `json:"bucketPath"` FileName string `json:"fileName"` Version string `json:"version"` // The version to be edited is inconsistent with the latest version. // Do you want to force an update? ForceUpdate bool `json:"forceUpdate"` UpdateLines []CSVLine `json:"updateLines"` NewLines [][]string `json:"newLines,omitempty"` DelLines []int `json:"delLines"` }