-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: implement validators commands #162
Open
epsjunior
wants to merge
14
commits into
main
Choose a base branch
from
59-implement-validators-commands
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,159
−26
Open
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
95c06e6
fix: CLI hardcoded version and solving issues with containers and images
epsjunior b3c09af
fix: merging main and resolving conflicts
epsjunior 3a6d1b1
Merge branch 'main' into 157-cli-is-always-breaking-when-a-new-studio…
epsjunior 33a4c02
feat: new global var to deal with compatible version
epsjunior 1d47d3f
Release v0.10.0-beta.0 [skip ci]
6930cc2
fix: removing default value from .env.example
epsjunior 515b430
feat: all validators commands
epsjunior 6a360ed
fix: json rpc bug and tests
epsjunior bd96c40
Merge branch '157-cli-is-always-breaking-when-a-new-studio-version-is…
epsjunior 3b8a4f2
Merge branch 'main' into 59-implement-validators-commands
epsjunior eb34ea1
Merge branch 'main' into 59-implement-validators-commands
epsjunior 4e3f49c
fix: merging main and resolving conflicts
epsjunior 5881d91
feat: non interactive validator creation
epsjunior df57fe6
feat: adding models to create random
epsjunior File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,84 @@ | ||
import { Command } from "commander"; | ||
import { ValidatorsAction } from "./validators"; | ||
|
||
export function initializeValidatorCommands(program: Command) { | ||
const validatorsAction = new ValidatorsAction(); | ||
|
||
const validatorsCommand = program | ||
.command("validators") | ||
.description("Manage validator operations"); | ||
|
||
validatorsCommand | ||
.command("get") | ||
|
||
.description("Retrieve details of a specific validator or all validators") | ||
.option("--address <validatorAddress>", "The address of the validator to retrieve (omit to retrieve all validators)") | ||
.action(async (options) => { | ||
await validatorsAction.getValidator({ address: options.address }); | ||
}); | ||
|
||
validatorsCommand | ||
.command("delete") | ||
.description("Delete a specific validator or all validators") | ||
.option("--address <validatorAddress>", "The address of the validator to delete (omit to delete all validators)") | ||
.action(async (options) => { | ||
await validatorsAction.deleteValidator({ address: options.address }); | ||
}); | ||
|
||
validatorsCommand | ||
.command("count") | ||
.description("Count all validators") | ||
.action(async () => { | ||
await validatorsAction.countValidators(); | ||
}); | ||
|
||
validatorsCommand | ||
.command("update <validatorAddress>") | ||
.description("Update a validator's details") | ||
.option("--stake <stake>", "New stake for the validator") | ||
.option("--provider <provider>", "New provider for the validator") | ||
.option("--model <model>", "New model for the validator") | ||
.option("--config <config>", "New JSON config for the validator") | ||
.action(async (validatorAddress, options) => { | ||
await validatorsAction.updateValidator({ | ||
address: validatorAddress, | ||
stake: options.stake, | ||
provider: options.provider, | ||
model: options.model, | ||
config: options.config, | ||
}); | ||
}); | ||
|
||
validatorsCommand | ||
.command("create-random") | ||
.description("Create random validators") | ||
.option("--count <count>", "Number of validators to create", "1") // Default to "1" | ||
.option( | ||
"--providers <providers...>", | ||
"Space-separated list of provider names (e.g., openai ollama)", | ||
[] | ||
) | ||
.action(async (options) => { | ||
await validatorsAction.createRandomValidators({ | ||
count: options.count, | ||
providers: options.providers, | ||
}); | ||
}); | ||
|
||
validatorsCommand | ||
.command("create") | ||
.description("Create a new validator") | ||
.option("--stake <stake>", "Stake amount for the validator (default: 1)", "1") | ||
.option( | ||
"--config <config>", | ||
'Optional JSON configuration for the validator (e.g., \'{"max_tokens": 500, "temperature": 0.75}\')' | ||
) | ||
.action(async (options) => { | ||
await validatorsAction.createValidator({ | ||
stake: options.stake, | ||
config: options.config, | ||
}); | ||
}); | ||
|
||
return program; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@epsjunior we are also missing the --models option to match the endpoint full parameters: https://github.com/yeagerai/genlayer-studio/blob/main/backend/protocol_rpc/endpoints.py#L190