Skip to content
Merged
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
2 changes: 2 additions & 0 deletions js/plugins/dotprompt/src/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ export class Dotprompt<Variables = unknown> implements PromptMetadata {
jsonSchema: options.output?.jsonSchema || this.output?.jsonSchema,
},
tools: (options.tools || []).concat(this.tools || []),
streamingCallback: options.streamingCallback,
returnToolRequests: options.returnToolRequests,
};
}

Expand Down
14 changes: 14 additions & 0 deletions js/plugins/dotprompt/tests/prompt_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ describe('Prompt', () => {
await invalidSchemaPrompt.render({ input: { foo: 'baz' } });
}, ValidationError);
});

it('should render with overrided fields', async () => {
const prompt = testPrompt(`Hello {{name}}, how are you?`);

const streamingCallback = (c) => console.log(c);

const rendered = await prompt.render({
input: { name: 'Michael' },
streamingCallback,
returnToolRequests: true,
});
assert.strictEqual(rendered.streamingCallback, streamingCallback);
assert.strictEqual(rendered.returnToolRequests, true);
});
});

describe('#generate', () => {
Expand Down