Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5413ad8

Browse files
committed
Add test for google
1 parent b67b0da commit 5413ad8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { GoogleGenAI } from '@google/genai'
2+
import { describe, expect } from 'vitest'
3+
import { test } from '../setup'
4+
5+
describe('google', () => {
6+
test('should call google via gateway', async ({ gateway }) => {
7+
const { fetch, otelBatch } = gateway
8+
9+
// The `authToken` is passed as `Authorization` header with the anthropic client.
10+
const client = new GoogleGenAI({
11+
apiKey: 'healthy',
12+
httpOptions: { baseUrl: 'https://example.com/google-vertex' },
13+
})
14+
15+
const response = await client.models.generateContent({
16+
model: 'gemini-2.5-flash',
17+
contents: 'What is the capital of france?',
18+
config: { maxOutputTokens: 1024, topP: 0.95, topK: 1, temperature: 0.5, stopSequences: ['potato'] },
19+
})
20+
21+
expect(response).toMatchSnapshot('llm')
22+
expect(otelBatch, 'otelBatch length not 1').toHaveLength(1)
23+
expect(JSON.parse(otelBatch[0]!).resourceSpans?.[0].scopeSpans?.[0].spans?.[0]?.attributes).toMatchSnapshot('span')
24+
})
25+
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /