From 2fc75355a9e491882c56ad2ab97b0954de0d9999 Mon Sep 17 00:00:00 2001 From: SSharma-10 Date: Mon, 19 Oct 2026 14:33:50 +0530 Subject: [PATCH] trim Inference chat/responses to one Go code sample each --- .../inference_create_chat_completion_kb.yml | 37 ---------------- .../inference_create_chat_completion_mcp.yml | 42 ------------------- .../inference_create_chat_completion_vlm.yml | 41 ------------------ ...erence_create_response_model_synthesis.yml | 33 --------------- .../inference_create_response_tool_search.yml | 38 ----------------- .../inference_create_response_web_fetch.yml | 31 -------------- .../inference_create_response_web_search.yml | 31 -------------- .../inference_create_chat_completion.yml | 3 -- .../inference/inference_create_response.yml | 4 -- 9 files changed, 260 deletions(-) delete mode 100644 specification/resources/inference/examples/go/inference_create_chat_completion_kb.yml delete mode 100644 specification/resources/inference/examples/go/inference_create_chat_completion_mcp.yml delete mode 100644 specification/resources/inference/examples/go/inference_create_chat_completion_vlm.yml delete mode 100644 specification/resources/inference/examples/go/inference_create_response_model_synthesis.yml delete mode 100644 specification/resources/inference/examples/go/inference_create_response_tool_search.yml delete mode 100644 specification/resources/inference/examples/go/inference_create_response_web_fetch.yml delete mode 100644 specification/resources/inference/examples/go/inference_create_response_web_search.yml diff --git a/specification/resources/inference/examples/go/inference_create_chat_completion_kb.yml b/specification/resources/inference/examples/go/inference_create_chat_completion_kb.yml deleted file mode 100644 index bf7f3fc30..000000000 --- a/specification/resources/inference/examples/go/inference_create_chat_completion_kb.yml +++ /dev/null @@ -1,37 +0,0 @@ -lang: Go -label: Knowledge base -source: |- - package main - - import ( - "context" - "encoding/json" - "fmt" - "os" - - "github.com/digitalocean/godo" - ) - - func main() { - client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN")) - ctx := context.Background() - - completion, _, err := client.Chat.Completions.New(ctx, &godo.ChatCompletionNewParams{ - Model: "openai-gpt-oss-20b", - Messages: []godo.ChatCompletionMessage{ - godo.UserMessage("What are some features of DigitalOcean Inference?"), - }, - Tools: []godo.ChatCompletionTool{ - godo.ChatKnowledgeBaseRetrievalTool(os.Getenv("KNOWLEDGE_BASE_ID")), - }, - ToolChoice: json.RawMessage(`"auto"`), - MaxTokens: godo.PtrTo(1024), - }) - if err != nil { - panic(err) - } - - if msg := completion.Choices[0].Message.Content; msg != nil { - fmt.Println(msg.Text()) - } - } diff --git a/specification/resources/inference/examples/go/inference_create_chat_completion_mcp.yml b/specification/resources/inference/examples/go/inference_create_chat_completion_mcp.yml deleted file mode 100644 index 88d8d4c05..000000000 --- a/specification/resources/inference/examples/go/inference_create_chat_completion_mcp.yml +++ /dev/null @@ -1,42 +0,0 @@ -lang: Go -label: MCP tool -source: |- - package main - - import ( - "context" - "encoding/json" - "fmt" - "os" - - "github.com/digitalocean/godo" - ) - - func main() { - client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN")) - ctx := context.Background() - - completion, _, err := client.Chat.Completions.New(ctx, &godo.ChatCompletionNewParams{ - Model: "openai-gpt-oss-20b", - Messages: []godo.ChatCompletionMessage{ - godo.UserMessage("Fetch my DigitalOcean account information and summarize it in 2 bullets."), - }, - Tools: []godo.ChatCompletionTool{ - godo.ChatMCPTool(godo.MCPToolParams{ - ServerLabel: "digitalocean", - ServerURL: "https://accounts.mcp.digitalocean.com/mcp", - Authorization: "Bearer " + os.Getenv("DIGITALOCEAN_API_TOKEN"), - AllowedTools: []string{"account-get-information"}, - }), - }, - ToolChoice: json.RawMessage(`"required"`), - MaxTokens: godo.PtrTo(512), - }) - if err != nil { - panic(err) - } - - if msg := completion.Choices[0].Message.Content; msg != nil { - fmt.Println(msg.Text()) - } - } diff --git a/specification/resources/inference/examples/go/inference_create_chat_completion_vlm.yml b/specification/resources/inference/examples/go/inference_create_chat_completion_vlm.yml deleted file mode 100644 index 58439273b..000000000 --- a/specification/resources/inference/examples/go/inference_create_chat_completion_vlm.yml +++ /dev/null @@ -1,41 +0,0 @@ -lang: Go -label: Vision (VLM) -source: |- - package main - - import ( - "context" - "fmt" - "os" - - "github.com/digitalocean/godo" - ) - - func main() { - client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN")) - ctx := context.Background() - - // IMAGE_URL may be an HTTPS URL or a data:image/...;base64,... URI. - imageURL := os.Getenv("IMAGE_URL") - if imageURL == "" { - imageURL = "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Online_Bicycles.jpg/640px-Online_Bicycles.jpg" - } - - completion, _, err := client.Chat.Completions.New(ctx, &godo.ChatCompletionNewParams{ - Model: "nemotron-nano-12b-v2-vl", - Messages: []godo.ChatCompletionMessage{ - godo.UserMessageParts( - godo.TextPart("Describe this image."), - godo.ImageURLPart(imageURL), - ), - }, - MaxTokens: godo.PtrTo(512), - }) - if err != nil { - panic(err) - } - - if msg := completion.Choices[0].Message.Content; msg != nil { - fmt.Println(msg.Text()) - } - } diff --git a/specification/resources/inference/examples/go/inference_create_response_model_synthesis.yml b/specification/resources/inference/examples/go/inference_create_response_model_synthesis.yml deleted file mode 100644 index 49b92b9db..000000000 --- a/specification/resources/inference/examples/go/inference_create_response_model_synthesis.yml +++ /dev/null @@ -1,33 +0,0 @@ -lang: Go -label: Model synthesis -source: |- - package main - - import ( - "context" - "fmt" - "os" - - "github.com/digitalocean/godo" - ) - - func main() { - client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN")) - ctx := context.Background() - - resp, _, err := client.Responses.New(ctx, &godo.ResponseNewParams{ - Model: "openai-gpt-oss-20b", - Input: "Compare approaches for reducing inference latency.", - Tools: []godo.ResponseTool{ - godo.ModelSynthesisTool(godo.ModelSynthesisToolParams{ - Preset: "balanced", - }), - }, - MaxOutputTokens: godo.PtrTo(1024), - }) - if err != nil { - panic(err) - } - - fmt.Println(resp.OutputText()) - } diff --git a/specification/resources/inference/examples/go/inference_create_response_tool_search.yml b/specification/resources/inference/examples/go/inference_create_response_tool_search.yml deleted file mode 100644 index 40ac3c803..000000000 --- a/specification/resources/inference/examples/go/inference_create_response_tool_search.yml +++ /dev/null @@ -1,38 +0,0 @@ -lang: Go -label: Tool search -source: |- - package main - - import ( - "context" - "fmt" - "os" - - "github.com/digitalocean/godo" - ) - - func main() { - client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN")) - ctx := context.Background() - - resp, _, err := client.Responses.New(ctx, &godo.ResponseNewParams{ - Model: "openai-gpt-5.5", - Input: "Compare the current weather in zip code 94107 and 10001.", - Tools: []godo.ResponseTool{ - godo.FunctionTool("get_weather", "Get weather for a zip code", map[string]interface{}{ - "type": "object", - "properties": map[string]interface{}{ - "zip": map[string]interface{}{"type": "string"}, - }, - "required": []string{"zip"}, - }), - godo.ToolSearchTool(), - }, - MaxOutputTokens: godo.PtrTo(1024), - }) - if err != nil { - panic(err) - } - - fmt.Println(resp.OutputText()) - } diff --git a/specification/resources/inference/examples/go/inference_create_response_web_fetch.yml b/specification/resources/inference/examples/go/inference_create_response_web_fetch.yml deleted file mode 100644 index 7d7130537..000000000 --- a/specification/resources/inference/examples/go/inference_create_response_web_fetch.yml +++ /dev/null @@ -1,31 +0,0 @@ -lang: Go -label: Web fetch -source: |- - package main - - import ( - "context" - "fmt" - "os" - - "github.com/digitalocean/godo" - ) - - func main() { - client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN")) - ctx := context.Background() - - resp, _, err := client.Responses.New(ctx, &godo.ResponseNewParams{ - Model: "openai-gpt-oss-20b", - Input: "Summarize https://www.digitalocean.com/pricing", - Tools: []godo.ResponseTool{ - godo.WebFetchTool(godo.PtrTo(3)), - }, - MaxOutputTokens: godo.PtrTo(1024), - }) - if err != nil { - panic(err) - } - - fmt.Println(resp.OutputText()) - } diff --git a/specification/resources/inference/examples/go/inference_create_response_web_search.yml b/specification/resources/inference/examples/go/inference_create_response_web_search.yml deleted file mode 100644 index 6a3486f8f..000000000 --- a/specification/resources/inference/examples/go/inference_create_response_web_search.yml +++ /dev/null @@ -1,31 +0,0 @@ -lang: Go -label: Web search -source: |- - package main - - import ( - "context" - "fmt" - "os" - - "github.com/digitalocean/godo" - ) - - func main() { - client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN")) - ctx := context.Background() - - resp, _, err := client.Responses.New(ctx, &godo.ResponseNewParams{ - Model: "openai-gpt-oss-20b", - Input: "What are the latest pricing changes for DigitalOcean Droplets?", - Tools: []godo.ResponseTool{ - godo.WebSearchTool(godo.PtrTo(3), godo.PtrTo(5)), - }, - MaxOutputTokens: godo.PtrTo(1024), - }) - if err != nil { - panic(err) - } - - fmt.Println(resp.OutputText()) - } diff --git a/specification/resources/inference/inference_create_chat_completion.yml b/specification/resources/inference/inference_create_chat_completion.yml index f8dc1de76..5fefca8c5 100644 --- a/specification/resources/inference/inference_create_chat_completion.yml +++ b/specification/resources/inference/inference_create_chat_completion.yml @@ -42,9 +42,6 @@ x-codeSamples: - $ref: 'examples/curl/inference_create_chat_completion.yml' - $ref: 'examples/python/inference_create_chat_completion.yml' - $ref: 'examples/go/inference_create_chat_completion.yml' - - $ref: 'examples/go/inference_create_chat_completion_mcp.yml' - - $ref: 'examples/go/inference_create_chat_completion_vlm.yml' - - $ref: 'examples/go/inference_create_chat_completion_kb.yml' - $ref: 'examples/dots/inference_create_chat_completion.yml' security: - inference_bearer_auth: [] diff --git a/specification/resources/inference/inference_create_response.yml b/specification/resources/inference/inference_create_response.yml index ca3cc181a..3250a5afd 100644 --- a/specification/resources/inference/inference_create_response.yml +++ b/specification/resources/inference/inference_create_response.yml @@ -43,10 +43,6 @@ x-codeSamples: - $ref: 'examples/curl/inference_create_response.yml' - $ref: 'examples/python/inference_create_response.yml' - $ref: 'examples/go/inference_create_response.yml' - - $ref: 'examples/go/inference_create_response_web_search.yml' - - $ref: 'examples/go/inference_create_response_web_fetch.yml' - - $ref: 'examples/go/inference_create_response_model_synthesis.yml' - - $ref: 'examples/go/inference_create_response_tool_search.yml' - $ref: 'examples/dots/inference_create_response.yml' security: - inference_bearer_auth: []