Skip to content

Commit

Permalink
Merge pull request kubeagi#446 from Abirdcfly/typo
Browse files Browse the repository at this point in the history
feat: add spell test and fix existed misspellings
  • Loading branch information
bjwswang authored Dec 26, 2023
2 parents 4a54e73 + 850d2d1 commit 249850e
Show file tree
Hide file tree
Showing 67 changed files with 148 additions and 122 deletions.
1 change: 1 addition & 0 deletions .github/.codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ue
19 changes: 19 additions & 0 deletions .github/workflows/codespell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Common misspellings

on: pull_request

jobs:
misspellings:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up misspell
uses: codespell-project/actions-codespell@v2
# plese update Makefile as well
with:
ignore_words_file: .github/.codespellignore
check_filenames: true
skip: go.*,**/*.drawio,./deploy/charts/*,./config/crd/*

6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,9 @@ DATA_PROCESSING_IMAGE ?= kubebb/dp-base
.PHONY: docker-build-dp-base
docker-build-dp-base:
docker build -f ./data-process/Dockerfile.base -t $(DATA_PROCESSING_IMAGE):$(VERSION) ./data-process/

.PHONY: codespell
codespell:
echo "you need: pip install codespell"
# please update .github/workflows/codespell.yaml as well
codespell -w --ignore-words ".github/.codespellignore" --check-filenames --skip "go.*,**/*.drawio,./deploy/charts/*,./config/crd/*"
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

## What is Arcadia?

**Arcadia** comes from [Greek mythology](https://www.greekmythology.com/Myths/Places/Arcadia/arcadia.html)(a tranquil and idyllic region, representing harmony, serenity, and natural beauty).We aim to help everyone find a more perfect integration between humans and AI.
**Arcadia** comes from [Greek mythology](https://www.greekmythology.com/Myths/Places/Arcadia/arcadia.html)(a tranquil and idyllic region, representing harmony, serenity, and natural beauty). We aim to help everyone find a more perfect integration between humans and AI.

To archieve this goal, we provides this one-stop LLMOps solution:
To achieve this goal, we provide this one-stop LLMOps solution:

- Dataset Management: storage/real-time data,multimodal,pre-processing,vectorization
- Models Management: local/online LLMs(development,training,deployment),inference acceleration
- Application Management: development,optimization,deployment with visual editor

Furthermore,we can easily host **Arcadia** at any kubernetes cluster as production ready by integrating [kubebb](https://github.com/kubebb)(A kubernetes building blocks),
Furthermore, we can easily host **Arcadia** at any kubernetes cluster as production ready by integrating [kubebb](https://github.com/kubebb)(A kubernetes building blocks).

## Architecture

Expand All @@ -37,7 +37,7 @@ Our design and development in Arcadia design follows operator pattern which exte

2. [Kubernetes](https://kubernetes.io/)

If you don't have a kubernetes cluster, you can schedule a [kind cluster](https://kind.sigs.k8s.io/). Depends on your choice on CPU or GPU when running LLM worker,you can choose to:
If you don't have a kubernetes cluster, you can schedule a [kind cluster](https://kind.sigs.k8s.io/). Depends on your choice on CPU or GPU when running LLM worker, you can choose to:

- [Create a kind cluster with/without GPU enabled](http://kubeagi.k8s.com.cn/docs/Quick%20Start/create-cluster-using-kind)

Expand All @@ -54,7 +54,7 @@ We provide a Command Line Tool `arctl` to interact with `arcadia`. See [here](./

## Pure Go Toolchains

To enhace the AI capability in Golang, we developed some packages.Here are the examples of how to use them.
To enhance the AI capability in Golang, we developed some packages.Here are the examples of how to use them.

- [chat_with_document](https://github.com/kubeagi/arcadia/tree/main/examples/chat_with_document): a chat server which allows you to chat with your document
- [embedding](https://github.com/kubeagi/arcadia/tree/main/examples/embedding) shows how to embedes your document to vector store with embedding service
Expand Down
8 changes: 4 additions & 4 deletions api/base/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ const (

// Provider defines how to prvoide the service
type Provider struct {
// Enpoint defines connection info
Enpoint *Endpoint `json:"endpoint,omitempty"`
// Endpoint defines connection info
Endpoint *Endpoint `json:"endpoint,omitempty"`

// Worker defines the worker info
// Means this LLM is provided by a arcadia worker
Worker *TypedObjectReference `json:"worker,omitempty"`
}

// GetType returnes the type of this provider
// GetType returns the type of this provider
func (p Provider) GetType() ProviderType {
// if endpoint provided, then 3rd_party
if p.Enpoint != nil {
if p.Endpoint != nil {
return ProviderType3rdParty
}
// if worker provided, then worker
Expand Down
4 changes: 2 additions & 2 deletions api/base/v1alpha1/datasource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
type DatasourceSpec struct {
CommonSpec `json:",inline"`

// Enpoint defines connection info
Enpoint Endpoint `json:"endpoint"`
// Endpoint defines connection info
Endpoint Endpoint `json:"endpoint"`

// OSS defines info for object storage service
OSS *OSS `json:"oss,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions api/base/v1alpha1/embedder.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (
)

func (e Embedder) AuthAPIKey(ctx context.Context, c client.Client, cli dynamic.Interface) (string, error) {
if e.Spec.Enpoint == nil {
if e.Spec.Endpoint == nil {
return "", nil
}
return e.Spec.Enpoint.AuthAPIKey(ctx, e.GetNamespace(), c, cli)
return e.Spec.Endpoint.AuthAPIKey(ctx, e.GetNamespace(), c, cli)
}

// GetModelList returns a model list provided by this LLM based on different provider
Expand Down
4 changes: 2 additions & 2 deletions api/base/v1alpha1/llm.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (
)

func (llm LLM) AuthAPIKey(ctx context.Context, c client.Client, cli dynamic.Interface) (string, error) {
if llm.Spec.Enpoint == nil {
if llm.Spec.Endpoint == nil {
return "", nil
}
return llm.Spec.Enpoint.AuthAPIKey(ctx, llm.GetNamespace(), c, cli)
return llm.Spec.Endpoint.AuthAPIKey(ctx, llm.GetNamespace(), c, cli)
}

func (llmStatus LLMStatus) LLMReady() (string, bool) {
Expand Down
2 changes: 1 addition & 1 deletion api/base/v1alpha1/model_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type ModelSpec struct {
CommonSpec `json:",inline"`

// Type defines what kind of model this is
// Comma separated field which can be wrapped by {llm,embdding}
// Comma separated field which can be wrapped by {llm,embedding}
Types string `json:"types,omitempty"`

// TODO: extend model to utilize third party storage sources
Expand Down
2 changes: 1 addition & 1 deletion api/base/v1alpha1/vectorstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
)

func (vs VectorStoreSpec) Type() VectorStoreType {
if vs.Enpoint == nil {
if vs.Endpoint == nil {
return VectorStoreTypeUnknown
}

Expand Down
4 changes: 2 additions & 2 deletions api/base/v1alpha1/vectorstore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
type VectorStoreSpec struct {
CommonSpec `json:",inline"`

// Enpoint defines connection info
Enpoint *Endpoint `json:"endpoint,omitempty"`
// Endpoint defines connection info
Endpoint *Endpoint `json:"endpoint,omitempty"`

Chroma *Chroma `json:"chroma,omitempty"`
}
Expand Down
10 changes: 5 additions & 5 deletions api/base/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apiserver/examples/upload-download-file/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ I1220 14:44:59.444794 12365 main.go:424] [Step 5], Congratulations, the file w
I1211 15:16:42.701067 2904044 main.go:410] [Step 1] get file size
I1211 15:16:42.703150 2904044 main.go:436] [DEBUG] file size is 51392595
I1211 15:16:42.703168 2904044 main.go:440] [Step 2] create local file tmp.gz
I1211 15:16:42.703225 2904044 main.go:461] [Step 3] start to donwload...
I1211 15:16:42.703225 2904044 main.go:461] [Step 3] start to download...
I1211 15:16:42.703303 2904044 main.go:482] [Chunk 41943040-51392595] send request to http://localhost:8099/bff/versioneddataset/files/download?bucket=abc&bucketPath=def&end=51392595&fileName=tmp.tar.gz&from=41943040
I1211 15:16:42.703391 2904044 main.go:482] [Chunk 10485760-20971520] send request to http://localhost:8099/bff/versioneddataset/files/download?bucket=abc&bucketPath=def&end=20971520&fileName=tmp.tar.gz&from=10485760
I1211 15:16:42.703452 2904044 main.go:482] [Chunk 20971520-31457280] send request to http://localhost:8099/bff/versioneddataset/files/download?bucket=abc&bucketPath=def&end=31457280&fileName=tmp.tar.gz&from=20971520
Expand Down
2 changes: 1 addition & 1 deletion apiserver/examples/upload-download-file/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func downloadFile(bucket, bucketPath, fileName string, transport http.RoundTripp
first := true
lock := make(chan struct{}, 1)
done := true
klog.Infof("[Step 3] start to donwload...")
klog.Infof("[Step 3] start to download...")
var wg sync.WaitGroup
for i := 0; i < int(parts); i++ {
if !first {
Expand Down
12 changes: 6 additions & 6 deletions apiserver/pkg/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func ListApplicationMeatadatas(ctx context.Context, c dynamic.Interface, input g
return res.Items[i].GetCreationTimestamp().After(res.Items[j].GetCreationTimestamp().Time)
})

filterd := make([]generated.PageNode, 0)
filtered := make([]generated.PageNode, 0)
for _, u := range res.Items {
if keyword != "" {
displayName, _, _ := unstructured.NestedString(u.Object, "spec", "displayName")
Expand All @@ -288,25 +288,25 @@ func ListApplicationMeatadatas(ctx context.Context, c dynamic.Interface, input g
if err != nil {
return nil, err
}
filterd = append(filterd, m)
filtered = append(filtered, m)
}
totalCount := len(filterd)
totalCount := len(filtered)

end := page * pageSize
if end > totalCount {
end = totalCount
}
start := (page - 1) * pageSize
if start < totalCount {
filterd = filterd[start:end]
filtered = filtered[start:end]
} else {
filterd = []generated.PageNode{}
filtered = []generated.PageNode{}
}

return &generated.PaginatedResult{
TotalCount: totalCount,
HasNextPage: end < totalCount,
Nodes: filterd,
Nodes: filtered,
Page: &page,
PageSize: &pageSize,
}, nil
Expand Down
2 changes: 1 addition & 1 deletion apiserver/pkg/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func SystemDatasourceOSS(ctx context.Context, mgrClient client.Client, dynamicCl
if err != nil {
return nil, err
}
endpoint := systemDatasource.Spec.Enpoint.DeepCopy()
endpoint := systemDatasource.Spec.Endpoint.DeepCopy()
if endpoint.AuthSecret != nil && endpoint.AuthSecret.Namespace == nil {
endpoint.AuthSecret.WithNameSpace(systemDatasource.Namespace)
}
Expand Down
2 changes: 1 addition & 1 deletion apiserver/pkg/common/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func MakeAuthSecret(ctx context.Context, c dynamic.Interface, secret generated.T

_, err = ResouceGet(ctx, c, secret, metav1.GetOptions{})
if err != nil {
// Create is not fount
// Create is not found
if apierrors.IsNotFound(err) {
_, err = c.Resource(schema.GroupVersionResource{Group: corev1.SchemeGroupVersion.Group, Version: corev1.SchemeGroupVersion.Version, Resource: "secrets"}).
Namespace(*secret.Namespace).Create(ctx, &unstructured.Unstructured{Object: unstructuredDatasource}, metav1.CreateOptions{})
Expand Down
14 changes: 7 additions & 7 deletions apiserver/pkg/datasource/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ func datasource2model(obj *unstructured.Unstructured) *generated.Datasource {

// parse endpoint
endpoint := generated.Endpoint{
URL: &datasource.Spec.Enpoint.URL,
Insecure: &datasource.Spec.Enpoint.Insecure,
URL: &datasource.Spec.Endpoint.URL,
Insecure: &datasource.Spec.Endpoint.Insecure,
}
if datasource.Spec.Enpoint.AuthSecret != nil {
if datasource.Spec.Endpoint.AuthSecret != nil {
endpoint.AuthSecret = &generated.TypedObjectReference{
Kind: "Secret",
Name: datasource.Spec.Enpoint.AuthSecret.Name,
Namespace: datasource.Spec.Enpoint.AuthSecret.Namespace,
Name: datasource.Spec.Endpoint.AuthSecret.Name,
Namespace: datasource.Spec.Endpoint.AuthSecret.Namespace,
}
}

Expand Down Expand Up @@ -132,7 +132,7 @@ func CreateDatasource(ctx context.Context, c dynamic.Interface, input generated.
if err != nil {
return nil, err
}
datasource.Spec.Enpoint = endpoint
datasource.Spec.Endpoint = endpoint

if input.Ossinput != nil {
datasource.Spec.OSS = &v1alpha1.OSS{
Expand Down Expand Up @@ -206,7 +206,7 @@ func UpdateDatasource(ctx context.Context, c dynamic.Interface, input *generated
if err != nil {
return nil, err
}
datasource.Spec.Enpoint = endpoint
datasource.Spec.Endpoint = endpoint
}

// Update ossinput
Expand Down
6 changes: 3 additions & 3 deletions apiserver/pkg/embedder/embedder.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func Embedder2model(ctx context.Context, c dynamic.Interface, obj *unstructured.
case v1alpha1.ProviderTypeWorker:
baseURL, _ = common.GetAPIServer(ctx, c, true)
case v1alpha1.ProviderType3rdParty:
baseURL = embedder.Spec.Enpoint.URL
baseURL = embedder.Spec.Endpoint.URL
}

md := generated.Embedder{
Expand Down Expand Up @@ -112,7 +112,7 @@ func CreateEmbedder(ctx context.Context, c dynamic.Interface, input generated.Cr
Description: description,
},
Provider: v1alpha1.Provider{
Enpoint: &v1alpha1.Endpoint{
Endpoint: &v1alpha1.Endpoint{
URL: input.Endpointinput.URL,
},
},
Expand All @@ -131,7 +131,7 @@ func CreateEmbedder(ctx context.Context, c dynamic.Interface, input generated.Cr
if err != nil {
return nil, err
}
embedder.Spec.Enpoint.AuthSecret = &v1alpha1.TypedObjectReference{
embedder.Spec.Endpoint.AuthSecret = &v1alpha1.TypedObjectReference{
Kind: "Secret",
Name: secret,
Namespace: &input.Namespace,
Expand Down
4 changes: 2 additions & 2 deletions apiserver/pkg/knowledgebase/knowledgebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func knowledgebase2model(obj *unstructured.Unstructured) *generated.KnowledgeBas
return &md
}

func CreateKnowledgeBase(ctx context.Context, c dynamic.Interface, name, namespace, displayname, discription, embedder string, vectorstore v1alpha1.TypedObjectReference, filegroups []v1alpha1.FileGroup) (*generated.KnowledgeBase, error) {
func CreateKnowledgeBase(ctx context.Context, c dynamic.Interface, name, namespace, displayname, description, embedder string, vectorstore v1alpha1.TypedObjectReference, filegroups []v1alpha1.FileGroup) (*generated.KnowledgeBase, error) {
knowledgebase := v1alpha1.KnowledgeBase{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand All @@ -129,7 +129,7 @@ func CreateKnowledgeBase(ctx context.Context, c dynamic.Interface, name, namespa
Spec: v1alpha1.KnowledgeBaseSpec{
CommonSpec: v1alpha1.CommonSpec{
DisplayName: displayname,
Description: discription,
Description: description,
},
Embedder: &v1alpha1.TypedObjectReference{
Kind: "Embedder",
Expand Down
6 changes: 3 additions & 3 deletions apiserver/pkg/llm/llm.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func LLM2model(ctx context.Context, c dynamic.Interface, obj *unstructured.Unstr
case v1alpha1.ProviderTypeWorker:
baseURL, _ = common.GetAPIServer(ctx, c, true)
case v1alpha1.ProviderType3rdParty:
baseURL = llm.Spec.Enpoint.URL
baseURL = llm.Spec.Endpoint.URL
}

md := generated.Llm{
Expand Down Expand Up @@ -188,7 +188,7 @@ func CreateLLM(ctx context.Context, c dynamic.Interface, input generated.CreateL
Description: description,
},
Provider: v1alpha1.Provider{
Enpoint: &v1alpha1.Endpoint{
Endpoint: &v1alpha1.Endpoint{
URL: input.Endpointinput.URL,
},
},
Expand All @@ -206,7 +206,7 @@ func CreateLLM(ctx context.Context, c dynamic.Interface, input generated.CreateL
if err != nil {
return nil, err
}
llm.Spec.Enpoint.AuthSecret = &v1alpha1.TypedObjectReference{
llm.Spec.Endpoint.AuthSecret = &v1alpha1.TypedObjectReference{
Kind: "Secret",
Name: secret,
Namespace: &input.Namespace,
Expand Down
2 changes: 1 addition & 1 deletion apiserver/pkg/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func ModelFiles(ctx context.Context, c dynamic.Interface, modelName, namespace s
return nil, err
}

endpoint := systemDatasource.Spec.Enpoint.DeepCopy()
endpoint := systemDatasource.Spec.Endpoint.DeepCopy()
if endpoint.AuthSecret != nil && endpoint.AuthSecret.Namespace == nil {
endpoint.AuthSecret.WithNameSpace(systemDatasource.Namespace)
}
Expand Down
Loading

0 comments on commit 249850e

Please sign in to comment.