Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 20 additions & 0 deletions packages/gateway/src/gateway-language-model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,26 @@ describe('GatewayLanguageModel', () => {
});
});

it('should allow caching in provider options', async () => {
prepareJsonResponse({
content: { type: 'text', text: 'Test response' },
});

await createTestModel().doGenerate({
prompt: TEST_PROMPT,
providerOptions: {
gateway: {
caching: 'auto',
},
},
});

const requestBody = await server.calls[0].requestBodyJson;
expect(requestBody.providerOptions).toEqual({
gateway: { caching: 'auto' },
});
});

it('should pass providerTimeouts for doGenerate', async () => {
prepareJsonResponse({
content: { type: 'text', text: 'Test response' },
Expand Down
6 changes: 6 additions & 0 deletions packages/gateway/src/gateway-provider-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import { z } from 'zod/v4';
const gatewayProviderOptions = lazySchema(() =>
zodSchema(
z.object({
/**
* Controls prompt caching behavior for the selected provider/model.
*
* Example: `'auto'` enables provider-managed automatic caching when supported.
*/
caching: z.enum(['auto']).optional(),
/**
* Array of provider slugs that are the only ones allowed to be used.
*
Expand Down