@@ -33,7 +33,7 @@ func TestInjectSessionState(t *testing.T) {
3333 testCases := []struct {
3434 name string // Name of the sub-test
3535 template string // Input template string
36- state map [string ]interface {} // Initial session state
36+ state map [string ]any // Initial session state
3737 artifacts map [string ]* genai.Part // Artifacts for the mock service
3838 expectNilService bool // Flag to test with a nil artifact service
3939 want string // Expected successful output
@@ -44,7 +44,7 @@ func TestInjectSessionState(t *testing.T) {
4444 {
4545 name : "successful state injection" ,
4646 template : "Hello {user_name}, you are in {app_state} state." ,
47- state : map [string ]interface {} {"user_name" : "Foo" , "app_state" : "active" },
47+ state : map [string ]any {"user_name" : "Foo" , "app_state" : "active" },
4848 want : "Hello Foo, you are in active state." ,
4949 },
5050 // Corresponds to: test_inject_session_state_with_artifact
@@ -61,14 +61,14 @@ func TestInjectSessionState(t *testing.T) {
6161 {
6262 name : "optional missing state variable" ,
6363 template : "Optional value: {optional_value?}" ,
64- state : map [string ]interface {} {},
64+ state : map [string ]any {},
6565 want : "Optional value: " ,
6666 },
6767 // Corresponds to: test_inject_session_state_with_missing_state_raises_key_error
6868 {
6969 name : "missing required state variable" ,
7070 template : "Hello {missing_key}!" ,
71- state : map [string ]interface {} {"user_name" : "Foo" },
71+ state : map [string ]any {"user_name" : "Foo" },
7272 wantErr : true ,
7373 wantErrMsg : "failed to get key \" missing_key\" from state: state key does not exist" ,
7474 },
@@ -86,28 +86,28 @@ func TestInjectSessionState(t *testing.T) {
8686 {
8787 name : "invalid state name is not replaced" ,
8888 template : "Hello {invalid-key}!" ,
89- state : map [string ]interface {} {"user_name" : "Foo" },
89+ state : map [string ]any {"user_name" : "Foo" },
9090 want : "Hello {invalid-key}!" ,
9191 },
9292 // Corresponds to: test_inject_session_state_with_invalid_prefix_state_name_returns_original
9393 {
9494 name : "invalid prefix state name is not replaced" ,
9595 template : "Hello {invalid:key}!" ,
96- state : map [string ]interface {} {"user_name" : "Foo" },
96+ state : map [string ]any {"user_name" : "Foo" },
9797 want : "Hello {invalid:key}!" ,
9898 },
9999 // Corresponds to: test_inject_session_state_with_valid_prefix_state
100100 {
101101 name : "valid prefixed state variable" ,
102102 template : "Hello {app:user_name}!" ,
103- state : map [string ]interface {} {"app:user_name" : "Foo" },
103+ state : map [string ]any {"app:user_name" : "Foo" },
104104 want : "Hello Foo!" ,
105105 },
106106 // Corresponds to: test_inject_session_state_with_none_state_value_returns_empty
107107 {
108108 name : "state value is nil" ,
109109 template : "Value: {test_key}" ,
110- state : map [string ]interface {} {"test_key" : nil },
110+ state : map [string ]any {"test_key" : nil },
111111 want : "Value: " ,
112112 },
113113 // Corresponds to: test_inject_session_state_with_optional_missing_artifact_returns_empty
@@ -145,7 +145,7 @@ Your favorite color is {favorite_color}.
145145The artifact says: {artifact.my_file}
146146And another optional artifact: {artifact.other_file?}
147147` ,
148- state : map [string ]interface {} {
148+ state : map [string ]any {
149149 "user_name" : "Foo" ,
150150 "user_age" : 30 ,
151151 "favorite_color" : "blue" ,
0 commit comments