Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Extract LLM validate logic & add ZhiPuAI validator #57

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

Lanture1064
Copy link
Collaborator

Towards #28

@bjwswang
Copy link
Collaborator

@Lanture1064 You can define a common interface in pkg/llms/llms.go like

type Validator interface {
   Validate(llmUrl string) error
}

Then implement this in different llms. Take zhipuai as an example

func (z *ZhiPuAI)Validate(url string) error

pkg/llms/zhipuai/api.go Outdated Show resolved Hide resolved
if err != nil {
return "", err
}
responseMsg := "TaskID:" + response.Data.TaskID
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the status code in reponse data is 200,error can be nil here. Otherwise return a error indicates why this failed.

pkg/llms/openai/api.go Outdated Show resolved Hide resolved
@bjwswang bjwswang merged commit 6a9be8d into kubeagi:main Aug 24, 2023
3 of 4 checks passed
nkwangleiGIT pushed a commit to nkwangleiGIT/arcadia that referenced this pull request Dec 1, 2023
refactor: Extract LLM validate logic & add ZhiPuAI validator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants