-
Notifications
You must be signed in to change notification settings - Fork 346
Added GenAI Additional Operations #876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
ListAvailableModels Test file package main
import (
"context"
"fmt"
"log"
"strings"
"github.com/digitalocean/godo"
)
func main() {
token := "DO_TOKEN"
client := godo.NewFromToken(token)
ctx := context.TODO()
// List Available Models
fmt.Println("=== Listing Available Models ===")
listAvailableModels(client, ctx)
}
func listAvailableModels(client *godo.Client, ctx context.Context) {
// Set up list options
opt := &godo.ListOptions{
Page: 1,
PerPage: 10,
}
// Call ListAvailableModels
models, resp, err := client.GenAI.ListAvailableModels(ctx, opt)
if err != nil {
log.Fatalf("Error fetching available models: %v", err)
}
// Print response info
fmt.Printf("HTTP Status: %s\n", resp.Status)
fmt.Printf("Total Models Found: %d\n", len(models))
fmt.Println(strings.Repeat("-", 50))
// Print each model
for i, model := range models {
fmt.Printf("Model %d:\n", i+1)
fmt.Printf(" UUID: %s\n", model.Uuid)
fmt.Printf(" Name: %s\n", model.Name)
fmt.Printf(" Is Foundational: %t\n", model.IsFoundational)
fmt.Printf(" Upload Complete: %t\n", model.UploadComplete)
if model.Provider != "" {
fmt.Printf(" Provider: %s\n", model.Provider)
}
if model.Version != nil {
fmt.Printf(" Version: %d.%d.%d\n",
model.Version.Major,
model.Version.Minor,
model.Version.Patch)
}
if model.Agreement != nil {
fmt.Printf(" Agreement: %s\n", model.Agreement.Name)
if model.Agreement.Url != "" {
fmt.Printf(" Agreement URL: %s\n", model.Agreement.Url)
}
}
if len(model.Usecases) > 0 {
fmt.Printf(" Use Cases: %v\n", model.Usecases)
}
fmt.Println(" " + strings.Repeat("-", 30))
}
// Print pagination info if available
if resp.Links != nil && resp.Links.Pages != nil {
fmt.Printf("\nPagination Info:\n")
if resp.Links.Pages.First != "" {
fmt.Printf(" First: %s\n", resp.Links.Pages.First)
}
if resp.Links.Pages.Prev != "" {
fmt.Printf(" Previous: %s\n", resp.Links.Pages.Prev)
}
if resp.Links.Pages.Next != "" {
fmt.Printf(" Next: %s\n", resp.Links.Pages.Next)
}
if resp.Links.Pages.Last != "" {
fmt.Printf(" Last: %s\n", resp.Links.Pages.Last)
}
}
// Print meta info if available
if resp.Meta != nil {
fmt.Printf("\nMeta Info:\n")
fmt.Printf(" Total: %d\n", resp.Meta.Total)
fmt.Printf(" Current Page: %d\n", resp.Meta.Page)
fmt.Printf(" Total Pages: %d\n", resp.Meta.Pages)
}
}```
**ListDatacenterRegions Test file**
```go
func main() {
token := "DO_TOKEN"
client := godo.NewFromToken(token)
ctx := context.TODO()
// List Datacenter Regions
fmt.Println("=== Listing Datacenter Regions ===")
listDatacenterRegions(client, ctx)
}
func listDatacenterRegions(client *godo.Client, ctx context.Context) {
// Call ListDatacenterRegions
regions, resp, err := client.GenAI.ListDatacenterRegions(ctx)
if err != nil {
log.Fatalf("Error fetching datacenter regions: %v", err)
}
// Print response info
fmt.Printf("HTTP Status: %s\n", resp.Status)
fmt.Printf("Total Regions Found: %d\n", len(regions))
fmt.Println(strings.Repeat("-", 50))
// Print each region
for i, region := range regions {
fmt.Printf("Region %d:\n", i+1)
fmt.Printf(" Region: %s\n", region.Region)
fmt.Printf(" Inference URL: %s\n", region.InferenceUrl)
fmt.Printf(" Serves Batch: %t\n", region.ServesBatch)
fmt.Printf(" Serves Inference: %t\n", region.ServesInference)
fmt.Printf(" Stream Inference URL: %s\n", region.StreamInferenceUrl)
fmt.Println(" " + strings.Repeat("-", 30))
}
// Print response status
fmt.Printf("\nResponse Status Code: %d\n", resp.StatusCode)
}``` |
…version (#883) * Add GitHub Actions workflow to generate CHANGELOG.md and update libraryVersion * correct version check * version to run * Fix missing newline at end of file in update-release-info.yml * fix hard coded version * Update libraryVersion in godo.go to use dynamic version input * Release 1.160.1: update CHANGELOG and libraryVersion * Timetravel * Update CHANGELOG.md * Release 1.160.2: update CHANGELOG and libraryVersion * Release 1.160.3: update CHANGELOG and libraryVersion * Update 1-click_test.go * Update README.md * Update CHANGELOG.md * manual time change * Release 1.160.4: update CHANGELOG and libraryVersion * Release 1.160.5: update CHANGELOG and libraryVersion * Update CONTRIBUTING.md * Update update-release-info.yml * Update 1-click_test.go * Update godo.go * Update README.md * Update CHANGELOG.md --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
harshmaru7
approved these changes
Aug 4, 2025
Contributor
harshmaru7
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀 🎸
This was referenced Aug 7, 2025
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implemented GenAI additional Operations: