Skip to content

Commit

Permalink
feat: add cases for migration
Browse files Browse the repository at this point in the history
  • Loading branch information
chuang8511 committed Oct 29, 2024
1 parent f2cea0e commit 73f96e4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/db/migration/convert/convert000034/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type ConvertInstillModel struct {
// https://instill.tech/abrc/pipelines/stomavision/playground?version=v1.0.0
// https://instill.tech/leochen5/pipelines/index-preprocess-img-desc/playground?version=v1.0.0
// https://instill.tech/instill-wombat/pipelines/jumbotron-visual-understanding/preview?version=v4.0.0
// https://instill.tech/leochen5/pipelines/vlm-text-extraction-id/playground?view=BE8zvSpABUSjscJOGp1nRUaSOuHBUusr
// https://instill.tech/leochen5/pipelines/image-quality-assureance/playground?view=ruuafgHXWiZtTHZiHVsMiUITK1BeWIA4

func (c *ConvertInstillModel) Migrate() error {
if err := c.migratePipeline(); err != nil {
Expand Down Expand Up @@ -381,6 +383,26 @@ func (c *ConvertInstillModel) updateInstillModelChatRelatedTasks(compName string
delete(input, "prompt-images")
}

if v, ok := input["system-message"]; ok {
messages := input["data"].(map[string]interface{})["messages"].([]map[string]interface{})

newMessage := map[string]interface{}{
"content": []map[string]interface{}{
{
"text": v,
"type": "text",
},
},
"role": "system",
}

messages = append(messages, newMessage)

input["data"].(map[string]interface{})["messages"] = messages

delete(input, "system-message")
}

if v, ok := input["max-new-tokens"]; ok {
input["parameter"] = map[string]interface{}{
"max-tokens": v,
Expand Down

0 comments on commit 73f96e4

Please sign in to comment.