Initial Draft of Information
Co-Authored-By: Patrick Devine <pdevine@sonic.net>
This commit is contained in:
parent
ccd624ca44
commit
30f7064363
16
api/types.go
16
api/types.go
@ -232,14 +232,14 @@ type ShowRequest struct {
|
||||
|
||||
// ShowResponse is the response returned from [Client.Show].
|
||||
type ShowResponse struct {
|
||||
License string `json:"license,omitempty"`
|
||||
Modelfile string `json:"modelfile,omitempty"`
|
||||
Parameters string `json:"parameters,omitempty"`
|
||||
Template string `json:"template,omitempty"`
|
||||
System string `json:"system,omitempty"`
|
||||
Details ModelDetails `json:"details,omitempty"`
|
||||
Messages []Message `json:"messages,omitempty"`
|
||||
ModelInfo string `json:"model_info,omitempty"`
|
||||
License string `json:"license,omitempty"`
|
||||
Modelfile string `json:"modelfile,omitempty"`
|
||||
Parameters string `json:"parameters,omitempty"`
|
||||
Template string `json:"template,omitempty"`
|
||||
System string `json:"system,omitempty"`
|
||||
Details ModelDetails `json:"details,omitempty"`
|
||||
Messages []Message `json:"messages,omitempty"`
|
||||
ModelInfo json.RawMessage `json:"model_info,omitempty"`
|
||||
}
|
||||
|
||||
// CopyRequest is the request passed to [Client.Copy].
|
||||
|
@ -724,7 +724,7 @@ func GetModelInfo(req api.ShowRequest) (*api.ShowResponse, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.ModelInfo = string(ggmlData)
|
||||
resp.ModelInfo = ggmlData
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
@ -740,32 +740,27 @@ func getGGMLData(model *Model) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
kv := ggml.KV()
|
||||
var keys []string
|
||||
for k := range kv {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
f.Close()
|
||||
|
||||
kv := ggml.KV()
|
||||
kvMap := make(map[string]any)
|
||||
|
||||
for _, k := range keys {
|
||||
for k := range kv {
|
||||
val := kv[k]
|
||||
|
||||
switch v := val.(type) {
|
||||
case []interface{}:
|
||||
if len(v) > 5 {
|
||||
kvMap[k] = []string{}
|
||||
continue
|
||||
}
|
||||
default:
|
||||
kvMap[k] = val
|
||||
}
|
||||
kvMap[k] = val
|
||||
}
|
||||
|
||||
ggmlMap := make(map[string]any)
|
||||
ggmlMap["kv"] = kvMap
|
||||
ggmlMap["tensors"] = ggml.Tensors()
|
||||
kvMap["embedding_model"] = model.IsEmbedding()
|
||||
|
||||
ggmlJson, err := json.Marshal(ggmlMap)
|
||||
ggmlJson, err := json.Marshal(kvMap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user