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

Add X-Firebase-AppId header to VertexAI requests #8809

Merged
merged 7 commits into from
Mar 25, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Run formatter
  • Loading branch information
dlarocque committed Feb 25, 2025
commit 7f14785bacbfd74bfa1190daf34ccfc14ea2a2b1
10 changes: 3 additions & 7 deletions packages/vertexai/src/api.test.ts
Original file line number Diff line number Diff line change
@@ -83,14 +83,12 @@ describe('Top level API', () => {
it('getGenerativeModel throws if no appId is provided', () => {
const fakeVertexNoProject = {
...fakeVertexAI,
app: { options: { apiKey: 'my-key' , projectId: 'my-projectid'} }
app: { options: { apiKey: 'my-key', projectId: 'my-projectid' } }
} as VertexAI;
try {
getGenerativeModel(fakeVertexNoProject, { model: 'my-model' });
} catch (e) {
expect((e as VertexAIError).code).includes(
VertexAIErrorCode.NO_APP_ID
);
expect((e as VertexAIError).code).includes(VertexAIErrorCode.NO_APP_ID);
expect((e as VertexAIError).message).equals(
`VertexAI: The "appId" field is empty in the local` +
` Firebase config. Firebase VertexAI requires this field ` +
@@ -156,9 +154,7 @@ describe('Top level API', () => {
try {
getImagenModel(fakeVertexNoProject, { model: 'my-model' });
} catch (e) {
expect((e as VertexAIError).code).includes(
VertexAIErrorCode.NO_APP_ID
);
expect((e as VertexAIError).code).includes(VertexAIErrorCode.NO_APP_ID);
expect((e as VertexAIError).message).equals(
`VertexAI: The "appId" field is empty in the local` +
` Firebase config. Firebase VertexAI requires this field ` +
4 changes: 1 addition & 3 deletions packages/vertexai/src/models/vertexai-model.test.ts
Original file line number Diff line number Diff line change
@@ -116,9 +116,7 @@ describe('VertexAIModel', () => {
try {
new TestModel(fakeVertexAI, 'my-model');
} catch (e) {
expect((e as VertexAIError).code).to.equal(
VertexAIErrorCode.NO_APP_ID
);
expect((e as VertexAIError).code).to.equal(VertexAIErrorCode.NO_APP_ID);
}
});
});
Loading