Skip to content

Conversation

@BenjaminGoehry
Copy link
Contributor

@BenjaminGoehry BenjaminGoehry commented Jan 26, 2026

Closes #99

Changes

Modified Files

  • agent_test.go – Updated tests to reflect the new struct.
  • client.go – Adapted request handling for OpenRouter compatibility.
  • client_test.go – Updated tests to use the new struct.
  • config.go – Added transformForOpenRouter to map OpenAI-style JSON to OpenRouter format.
  • request.go
    • Updated structs for OpenAI-style image inputs.
    • Added WithImageFile, WithImageURL, and WithImageBytes for image support.
  • request_test.go – Added tests for the new image-related functions.
  • README.md – Updated documentation for the new options.

New File

  • multimodal.go: Added helper functions such as detectMIMEType.

Features

✅ Image Support:

  • Send images via file path, URL, or raw bytes
  • Automatic MIME type detection for common formats (JPEG, PNG, etc.)

✅ Error Handling:

  • Skip empty inputs for WithImageBytes and WithAudioBytes
  • Return errors for non-existent files

@github-actions
Copy link
Contributor

github-actions bot commented Jan 26, 2026

Performance

SDK Memory Δ Latency Δ Tests Status
Go 225 B -20% 0.78 µs -22%

✓ No regressions detected

@AbirAbbas
Copy link
Contributor

@BenjaminGoehry just checking to see if I should review this or not (seems to be in draft)

@BenjaminGoehry BenjaminGoehry force-pushed the feat/add_support_image_and_audio branch from cda4c41 to 207cda8 Compare February 11, 2026 15:31
@BenjaminGoehry BenjaminGoehry force-pushed the feat/add_support_image_and_audio branch from 71ccf05 to 14dc063 Compare February 11, 2026 22:07
@BenjaminGoehry BenjaminGoehry force-pushed the feat/add_support_image_and_audio branch from 45f4afb to be04ab9 Compare February 11, 2026 22:41
@BenjaminGoehry BenjaminGoehry changed the title feat(sdk/go): add support for image and audio inputs in ai calls feat(sdk/go): add support for image inputs in ai calls Feb 11, 2026
@BenjaminGoehry
Copy link
Contributor Author

BenjaminGoehry commented Feb 11, 2026

Hi @AbirAbbas ,
I’ve updated all the files. The image input now works fully with the OpenRouter API. I wasn’t able to get audio files working yet—I don’t have an OpenAI key to test, but I implemented the mapping based on OpenAI docs and OpenRouter docs.

The changes for images were more significant than expected, so I think the PR is ready to review as-is. I can follow up with a separate PR for audio input later if that’s ok.

Thanks!

@BenjaminGoehry BenjaminGoehry marked this pull request as ready for review February 11, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Go SDK] Add support for image and audio inputs in AI calls

2 participants