Skip to content
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

chore: Add sample code for base64 encoded image in Orchestration #466

Merged
merged 8 commits into from
Jan 29, 2025

Conversation

shibeshduw
Copy link
Contributor

Context

Closes SAP/ai-sdk-js-backlog#213.

What this PR does and why it is needed

@shibeshduw shibeshduw marked this pull request as draft January 17, 2025 08:55
sample-code/src/orchestration.ts Outdated Show resolved Hide resolved
@@ -354,10 +356,14 @@ export async function orchestrationChatCompletionImage(): Promise<OrchestrationR
}
});

const imageFilePath = join(__dirname, 'src', 'media', 'sample-image.png');
const mimeType = lookup(extname(imageFilePath).toLowerCase());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pp] Computing the mime type is maybe a bit overkill, since we anyway hardcode png here in the filename. Thus might Asseln hard code the mime type ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that hardcoding the mime type here is probably enough, but please keep it separate from the template string, so our users still know which part to replace, in case their image is of a different type.

@shibeshduw shibeshduw marked this pull request as ready for review January 28, 2025 09:12
@shibeshduw shibeshduw merged commit f0d290f into main Jan 29, 2025
10 checks passed
@shibeshduw shibeshduw deleted the base64-image-sample branch January 29, 2025 12:04
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.

5 participants