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: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 35
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-c0b9cfd71efb976777313fb342d2e31ebeb44b1b3f9bb7ddea971e6b2bc5fd19.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-f12595f01023503858500b15936a1d0d38701e48552d34c98b00a41205d2b8da.yml
24 changes: 7 additions & 17 deletions src/resources/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export interface GenerateCreateResponse {

export interface GenerateCreateParams {
/**
* Extra parameters to be passed to Contextual's GLM
* The knowledge sources the model can use when generating a response.
*/
extra_body: GenerateCreateParams.ExtraBody;
knowledge: Array<string>;

/**
* List of messages in the conversation so far. The last message must be from the
Expand All @@ -42,25 +42,15 @@ export interface GenerateCreateParams {
* The version of the Contextual's GLM to use. Currently, we just have "v1".
*/
model: string;
}

export namespace GenerateCreateParams {
/**
* Extra parameters to be passed to Contextual's GLM
* Instructions that the model follows when generating responses. Note that we do
* not guarantee that the model follows these instructions exactly.
*/
export interface ExtraBody {
/**
* The knowledge sources the model can use when generating a response.
*/
knowledge: Array<string>;

/**
* Instructions that the model follows when generating responses. Note that we do
* not guarantee that the model follows these instructions exactly.
*/
system_prompt?: string;
}
system_prompt?: string;
}

export namespace GenerateCreateParams {
/**
* Message object for a message sent or received in a /query and /generate
* conversation
Expand Down
5 changes: 3 additions & 2 deletions tests/api-resources/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const client = new ContextualAI({
describe('resource generate', () => {
test('create: only required params', async () => {
const responsePromise = client.generate.create({
extra_body: { knowledge: ['string'] },
knowledge: ['string'],
messages: [{ content: 'content', role: 'user' }],
model: 'model',
});
Expand All @@ -26,9 +26,10 @@ describe('resource generate', () => {

test('create: required and optional params', async () => {
const response = await client.generate.create({
extra_body: { knowledge: ['string'], system_prompt: 'system_prompt' },
knowledge: ['string'],
messages: [{ content: 'content', role: 'user' }],
model: 'model',
system_prompt: 'system_prompt',
});
});
});