Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions decentralized-api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
decentralized-api/validation.test
5 changes: 5 additions & 0 deletions decentralized-api/apiconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Config struct {
LastUsedVersion string `koanf:"last_used_version" json:"last_used_version"`
ValidationParams ValidationParamsCache `koanf:"validation_params" json:"validation_params"`
BandwidthParams BandwidthParamsCache `koanf:"bandwidth_params" json:"bandwidth_params"`
Validator ValidatorConfig `koanf:"validator" json:"validator"`
}

type NatsServerConfig struct {
Expand Down Expand Up @@ -161,3 +162,7 @@ type BandwidthParamsCache struct {
KbPerInputToken float64 `koanf:"kb_per_input_token" json:"kb_per_input_token"`
KbPerOutputToken float64 `koanf:"kb_per_output_token" json:"kb_per_output_token"`
}

type ValidatorConfig struct {
VllmUrl string `koanf:"vllm_url" json:"vllm_url"`
}
8 changes: 7 additions & 1 deletion decentralized-api/completionapi/completionresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ type EnforcedToken struct {
}

type EnforcedTokens struct {
Tokens []EnforcedToken `json:"tokens"`
Tokens []EnforcedToken `json:"tokens"`
RunSeed string `json:"run_seed,omitempty"`
}

func (r *JsonCompletionResponse) GetEnforcedTokens() (EnforcedTokens, error) {
Expand All @@ -102,6 +103,7 @@ func (r *JsonCompletionResponse) GetEnforcedTokens() (EnforcedTokens, error) {
}

var enforcedTokens EnforcedTokens
enforcedTokens.RunSeed = r.Resp.Choices[0].Logprobs.RunSeed
for _, c := range r.Resp.Choices[0].Logprobs.Content {
if c.TopLogprobs == nil {
continue
Expand Down Expand Up @@ -146,6 +148,10 @@ func (r *StreamedCompletionResponse) GetEnforcedTokens() (EnforcedTokens, error)
}

for _, choice := range c.Choices {
if enforcedTokens.RunSeed == "" {
enforcedTokens.RunSeed = choice.Logprobs.RunSeed
}

if choice.Logprobs.Content == nil {
continue
}
Expand Down
1 change: 1 addition & 0 deletions decentralized-api/completionapi/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Choice struct {
Delta *Delta `json:"delta"`
Logprobs struct {
Content []Logprob `json:"content"`
RunSeed string `json:"run_seed,omitempty"`
} `json:"logprobs"`
FinishReason string `json:"finish_reason"`
StopReason string `json:"stop_reason"`
Expand Down
2 changes: 2 additions & 0 deletions decentralized-api/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ chain_node:
keyring_backend: "test"
keyring_dir: "~/.inference" # We use a custom function to expand ~ to /root
is_genesis: false
validator:
vllm_url: "http://localhost:8080"
Loading