| 69 | } |
| 70 | |
| 71 | func getToolDefinitions() []uctypes.ToolDefinition { |
| 72 | var schemas map[string]any |
| 73 | if err := json.Unmarshal([]byte(testSchemaJSON), &schemas); err != nil { |
| 74 | log.Printf("Error parsing schema: %v\n", err) |
| 75 | return nil |
| 76 | } |
| 77 | |
| 78 | var configSchema map[string]any |
| 79 | if rawSchema, ok := schemas["config"]; ok && rawSchema != nil { |
| 80 | if schema, ok := rawSchema.(map[string]any); ok { |
| 81 | configSchema = schema |
| 82 | } |
| 83 | } |
| 84 | if configSchema == nil { |
| 85 | configSchema = map[string]any{"type": "object"} |
| 86 | } |
| 87 | |
| 88 | return []uctypes.ToolDefinition{ |
| 89 | { |
| 90 | Name: "get_config", |
| 91 | Description: "Get the current GitHub Actions Monitor configuration settings including repository, workflow, polling interval, and max workflow runs", |
| 92 | InputSchema: map[string]any{ |
| 93 | "type": "object", |
| 94 | }, |
| 95 | }, |
| 96 | { |
| 97 | Name: "update_config", |
| 98 | Description: "Update GitHub Actions Monitor configuration settings", |
| 99 | InputSchema: configSchema, |
| 100 | }, |
| 101 | { |
| 102 | Name: "get_data", |
| 103 | Description: "Get the current GitHub Actions workflow run data including workflow runs, loading state, and errors", |
| 104 | InputSchema: map[string]any{ |
| 105 | "type": "object", |
| 106 | }, |
| 107 | }, |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | func testOpenAI(ctx context.Context, model, message string, tools []uctypes.ToolDefinition) { |
| 112 | apiKey := os.Getenv("OPENAI_APIKEY") |