66
77 "github.com/BurntSushi/toml"
88 "github.com/stretchr/testify/suite"
9- "gopkg.in/yaml.v3"
109)
1110
1211// PromptSerializationSuite tests serialization of prompt data structures
@@ -45,33 +44,6 @@ func (s *PromptSerializationSuite) TestPromptJSONSerialization() {
4544 })
4645}
4746
48- func (s * PromptSerializationSuite ) TestPromptYAMLSerialization () {
49- s .Run ("marshals and unmarshals Prompt correctly" , func () {
50- original := Prompt {
51- Name : "test-prompt" ,
52- Title : "Test Prompt" ,
53- Description : "A test prompt" ,
54- Arguments : []PromptArgument {
55- {Name : "arg1" , Description : "First argument" , Required : true },
56- },
57- Templates : []PromptTemplate {
58- {Role : "user" , Content : "Hello {{arg1}}" },
59- },
60- }
61-
62- data , err := yaml .Marshal (original )
63- s .Require ().NoError (err , "failed to marshal Prompt to YAML" )
64-
65- var unmarshaled Prompt
66- err = yaml .Unmarshal (data , & unmarshaled )
67- s .Require ().NoError (err , "failed to unmarshal Prompt from YAML" )
68-
69- s .Equal (original .Name , unmarshaled .Name )
70- s .Equal (original .Title , unmarshaled .Title )
71- s .Equal (original .Description , unmarshaled .Description )
72- })
73- }
74-
7547func (s * PromptSerializationSuite ) TestPromptTOMLSerialization () {
7648 s .Run ("unmarshals Prompt from TOML correctly" , func () {
7749 tomlData := `
@@ -152,15 +124,6 @@ func (s *PromptSerializationSuite) TestPromptArgumentSerialization() {
152124 s .Require ().NoError (err )
153125 s .Equal (arg .Name , jsonArg .Name )
154126 s .True (jsonArg .Required )
155-
156- // YAML
157- yamlData , err := yaml .Marshal (arg )
158- s .Require ().NoError (err )
159- var yamlArg PromptArgument
160- err = yaml .Unmarshal (yamlData , & yamlArg )
161- s .Require ().NoError (err )
162- s .Equal (arg .Name , yamlArg .Name )
163- s .True (yamlArg .Required )
164127 })
165128
166129 s .Run ("serializes optional argument" , func () {
@@ -227,15 +190,6 @@ func (s *PromptSerializationSuite) TestPromptMessageSerialization() {
227190 s .Equal (msg .Role , jsonMsg .Role )
228191 s .Equal (msg .Content .Type , jsonMsg .Content .Type )
229192 s .Equal (msg .Content .Text , jsonMsg .Content .Text )
230-
231- // YAML
232- yamlData , err := yaml .Marshal (msg )
233- s .Require ().NoError (err )
234- var yamlMsg PromptMessage
235- err = yaml .Unmarshal (yamlData , & yamlMsg )
236- s .Require ().NoError (err )
237- s .Equal (msg .Role , yamlMsg .Role )
238- s .Equal (msg .Content .Text , yamlMsg .Content .Text )
239193 })
240194}
241195
@@ -254,15 +208,6 @@ func (s *PromptSerializationSuite) TestPromptContentSerialization() {
254208 s .Require ().NoError (err )
255209 s .Equal (content .Type , jsonContent .Type )
256210 s .Equal (content .Text , jsonContent .Text )
257-
258- // YAML
259- yamlData , err := yaml .Marshal (content )
260- s .Require ().NoError (err )
261- var yamlContent PromptContent
262- err = yaml .Unmarshal (yamlData , & yamlContent )
263- s .Require ().NoError (err )
264- s .Equal (content .Type , yamlContent .Type )
265- s .Equal (content .Text , yamlContent .Text )
266211 })
267212}
268213
0 commit comments