GenkitG
Genkitโ€ข7mo agoโ€ข
14 replies
scornful-crimson

Hey guys! I am looking into using the

Hey guys! I am looking into using the Genkit Go package for my project, replacing github.com/google/generative-ai-go/genai

I currently have code which uses a specific genai FileData fn

uploadedFile, err := client.UploadFileFromPath(ctx, localPath, uploadOpts)

parts = append(parts, genai.FileData{URI: uploadedFile.URI, MIMEType: mimeType})


I guess I'll probably replace it with something like this using genkit, but I am not sure the code for Go's library

//Either this, or calling the files API directly
uploadedFile, err := client.UploadFileFromPath(ctx, localPath, uploadOpts)

  //From the Node.JS examples... I am not really sure how to reproduce this in Go
 const { output } = await ai.generate({
    system, // default: "Identify all of the ojects in the provided image."
    prompt: [{ media: { url: imageUrl } }]

// GO equivalent?
mediaPart := uploadedFile.URI // ??? 
resp, err := genkit.Generate(ctx, g, ai.WithPrompt(mediaPart)


I saw a post on this Discord: ID 1271483576692772884 announcing support for Gemini Files API URLs. Not sure if this made it to Go's package?

Can anyone confirm that Genkit Go is accepting large images from Files API upload URIs? And maybe help get me some code to include the image URI? ๐Ÿ™‚
Was this page helpful?