aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--vendor/github.com/google/generative-ai-go/genai/files.go14
-rw-r--r--vendor/github.com/google/generative-ai-go/genai/internal/version.go2
-rw-r--r--vendor/modules.txt2
5 files changed, 19 insertions, 5 deletions
diff --git a/go.mod b/go.mod
index 1906464e2..c49def71b 100644
--- a/go.mod
+++ b/go.mod
@@ -16,7 +16,7 @@ require (
github.com/dvyukov/go-fuzz v0.0.0-20220726122315-1d375ef9f9f6
github.com/golangci/golangci-lint v1.61.0
github.com/google/flatbuffers v24.3.25+incompatible
- github.com/google/generative-ai-go v0.17.0
+ github.com/google/generative-ai-go v0.18.0
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/gorilla/handlers v1.5.2
diff --git a/go.sum b/go.sum
index ecc473c46..349dce30b 100644
--- a/go.sum
+++ b/go.sum
@@ -935,8 +935,8 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ
github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/flatbuffers v24.3.25+incompatible h1:CX395cjN9Kke9mmalRoL3d81AtFUxJM+yDthflgJGkI=
github.com/google/flatbuffers v24.3.25+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
-github.com/google/generative-ai-go v0.17.0 h1:kUmCXUIwJouD7I7ev3OmxzzQVICyhIWAxaXk2yblCMY=
-github.com/google/generative-ai-go v0.17.0/go.mod h1:JYolL13VG7j79kM5BtHz4qwONHkeJQzOCkKXnpqtS/E=
+github.com/google/generative-ai-go v0.18.0 h1:6ybg9vOCLcI/UpBBYXOTVgvKmcUKFRNj+2Cj3GnebSo=
+github.com/google/generative-ai-go v0.18.0/go.mod h1:JYolL13VG7j79kM5BtHz4qwONHkeJQzOCkKXnpqtS/E=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
diff --git a/vendor/github.com/google/generative-ai-go/genai/files.go b/vendor/github.com/google/generative-ai-go/genai/files.go
index 12de62457..7fe57db15 100644
--- a/vendor/github.com/google/generative-ai-go/genai/files.go
+++ b/vendor/github.com/google/generative-ai-go/genai/files.go
@@ -19,6 +19,7 @@ package genai
import (
"context"
"io"
+ "os"
"strings"
gl "cloud.google.com/go/ai/generativelanguage/apiv1beta"
@@ -83,6 +84,19 @@ func (c *Client) UploadFile(ctx context.Context, name string, r io.Reader, opts
return c.GetFile(ctx, res.File.Name)
}
+// UploadFileFromPath is a convenience method wrapping [UploadFile]. It takes
+// a path to read the file from, and uses a default auto-generated ID for the
+// uploaded file.
+func (c *Client) UploadFileFromPath(ctx context.Context, path string, opts *UploadFileOptions) (*File, error) {
+ osf, err := os.Open(path)
+ if err != nil {
+ return nil, err
+ }
+ defer osf.Close()
+
+ return c.UploadFile(ctx, "", osf, opts)
+}
+
// GetFile returns the named file.
func (c *Client) GetFile(ctx context.Context, name string) (*File, error) {
req := &pb.GetFileRequest{Name: userNameToServiceName(name)}
diff --git a/vendor/github.com/google/generative-ai-go/genai/internal/version.go b/vendor/github.com/google/generative-ai-go/genai/internal/version.go
index c71bf93f9..e6f17360d 100644
--- a/vendor/github.com/google/generative-ai-go/genai/internal/version.go
+++ b/vendor/github.com/google/generative-ai-go/genai/internal/version.go
@@ -5,4 +5,4 @@
package internal
// Version is the current tagged release of the library.
-const Version = "0.17.0"
+const Version = "0.18.0"
diff --git a/vendor/modules.txt b/vendor/modules.txt
index e712ab7c8..a68afe1d8 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -599,7 +599,7 @@ github.com/golangci/unconvert
# github.com/google/flatbuffers v24.3.25+incompatible
## explicit
github.com/google/flatbuffers/go
-# github.com/google/generative-ai-go v0.17.0
+# github.com/google/generative-ai-go v0.18.0
## explicit; go 1.21
github.com/google/generative-ai-go/genai
github.com/google/generative-ai-go/genai/internal