@@ -20,7 +20,6 @@ import (
2020 "encoding/json"
2121 "io"
2222 "net/http"
23- "os"
2423 "reflect"
2524 "regexp"
2625 "strings"
@@ -32,47 +31,6 @@ import (
3231 "github.com/googleapis/genai-toolbox/tests"
3332)
3433
35- var (
36- AlloyDBAINLSourceType = "alloydb-postgres"
37- AlloyDBAINLToolType = "alloydb-ai-nl"
38- AlloyDBAINLProject = os .Getenv ("ALLOYDB_AI_NL_PROJECT" )
39- AlloyDBAINLRegion = os .Getenv ("ALLOYDB_AI_NL_REGION" )
40- AlloyDBAINLCluster = os .Getenv ("ALLOYDB_AI_NL_CLUSTER" )
41- AlloyDBAINLInstance = os .Getenv ("ALLOYDB_AI_NL_INSTANCE" )
42- AlloyDBAINLDatabase = os .Getenv ("ALLOYDB_AI_NL_DATABASE" )
43- AlloyDBAINLUser = os .Getenv ("ALLOYDB_AI_NL_USER" )
44- AlloyDBAINLPass = os .Getenv ("ALLOYDB_AI_NL_PASS" )
45- )
46-
47- func getAlloyDBAINLVars (t * testing.T ) map [string ]any {
48- switch "" {
49- case AlloyDBAINLProject :
50- t .Fatal ("'ALLOYDB_AI_NL_PROJECT' not set" )
51- case AlloyDBAINLRegion :
52- t .Fatal ("'ALLOYDB_AI_NL_REGION' not set" )
53- case AlloyDBAINLCluster :
54- t .Fatal ("'ALLOYDB_AI_NL_CLUSTER' not set" )
55- case AlloyDBAINLInstance :
56- t .Fatal ("'ALLOYDB_AI_NL_INSTANCE' not set" )
57- case AlloyDBAINLDatabase :
58- t .Fatal ("'ALLOYDB_AI_NL_DATABASE' not set" )
59- case AlloyDBAINLUser :
60- t .Fatal ("'ALLOYDB_AI_NL_USER' not set" )
61- case AlloyDBAINLPass :
62- t .Fatal ("'ALLOYDB_AI_NL_PASS' not set" )
63- }
64- return map [string ]any {
65- "type" : AlloyDBAINLSourceType ,
66- "project" : AlloyDBAINLProject ,
67- "cluster" : AlloyDBAINLCluster ,
68- "instance" : AlloyDBAINLInstance ,
69- "region" : AlloyDBAINLRegion ,
70- "database" : AlloyDBAINLDatabase ,
71- "user" : AlloyDBAINLUser ,
72- "password" : AlloyDBAINLPass ,
73- }
74- }
75-
7634func TestAlloyDBAINLToolEndpoints (t * testing.T ) {
7735 sourceConfig := getAlloyDBAINLVars (t )
7836 ctx , cancel := context .WithTimeout (context .Background (), time .Minute )
@@ -277,59 +235,6 @@ func runAINLToolInvokeTest(t *testing.T) {
277235
278236}
279237
280- func getAINLToolsConfig (sourceConfig map [string ]any ) map [string ]any {
281- // Write config into a file and pass it to command
282- toolsFile := map [string ]any {
283- "sources" : map [string ]any {
284- "my-instance" : sourceConfig ,
285- },
286- "authServices" : map [string ]any {
287- "my-google-auth" : map [string ]any {
288- "type" : "google" ,
289- "clientId" : tests .ClientId ,
290- },
291- },
292- "tools" : map [string ]any {
293- "my-simple-tool" : map [string ]any {
294- "type" : AlloyDBAINLToolType ,
295- "source" : "my-instance" ,
296- "description" : "Simple tool to test end to end functionality." ,
297- "nlConfig" : "my_nl_config" ,
298- },
299- "my-auth-tool" : map [string ]any {
300- "type" : AlloyDBAINLToolType ,
301- "source" : "my-instance" ,
302- "description" : "Tool to test authenticated parameters." ,
303- "nlConfig" : "my_nl_config" ,
304- "nlConfigParameters" : []map [string ]any {
305- {
306- "name" : "email" ,
307- "type" : "string" ,
308- "description" : "user email" ,
309- "authServices" : []map [string ]string {
310- {
311- "name" : "my-google-auth" ,
312- "field" : "email" ,
313- },
314- },
315- },
316- },
317- },
318- "my-auth-required-tool" : map [string ]any {
319- "type" : AlloyDBAINLToolType ,
320- "source" : "my-instance" ,
321- "description" : "Tool to test auth required invocation." ,
322- "nlConfig" : "my_nl_config" ,
323- "authRequired" : []string {
324- "my-google-auth" ,
325- },
326- },
327- },
328- }
329-
330- return toolsFile
331- }
332-
333238func runAINLMCPToolCallMethod (t * testing.T ) {
334239 sessionId := tests .RunInitialize (t , "2024-11-05" )
335240 header := map [string ]string {}
0 commit comments