Skip to content
Open
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 src/api/resources/agents/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ export class Agents {
}

/**
* This endpoint retrieves the experts registry, which contains information about all available experts that can be referenced when creating agents through the AgentsExpertReference schema.
* This endpoint retrieves the experts registry, which contains information about all available experts that can be referenced when creating agents through the AgentsCreateExpertReference schema.
*
* @param {Corti.AgentsGetRegistryExpertsRequest} request
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
Expand Down
2 changes: 2 additions & 0 deletions src/api/resources/agents/client/requests/AgentsCreateAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export interface AgentsCreateAgent {
ephemeral?: boolean | null;
/** The name of the agent. */
name: string;
/** Optional type of agent. */
agentType?: Corti.AgentsCreateAgentAgentType;
/** The system prompt that defines the overall agents behavior and expectations. This field is optional as there is a default system orchestrator. */
systemPrompt?: string;
/** A brief description of the agent's capabilities. */
Expand Down
13 changes: 13 additions & 0 deletions src/api/resources/agents/types/AgentsCreateAgentAgentType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

/**
* Optional type of agent.
*/
export type AgentsCreateAgentAgentType = "expert" | "orchestrator" | "interviewing-expert";
export const AgentsCreateAgentAgentType = {
Expert: "expert",
Orchestrator: "orchestrator",
InterviewingExpert: "interviewing-expert",
} as const;
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

import * as Corti from "../../../index.js";

export type AgentsCreateAgentExpertsItem = Corti.AgentsCreateExpert | Corti.AgentsExpertReference;
export type AgentsCreateAgentExpertsItem = Corti.AgentsCreateExpert | Corti.AgentsCreateExpertReference;
1 change: 1 addition & 0 deletions src/api/resources/agents/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./AgentsCreateAgentAgentType.js";
export * from "./AgentsCreateAgentExpertsItem.js";
export * from "./AgentsMessageSendResponse.js";
2 changes: 1 addition & 1 deletion src/api/resources/documents/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class Documents {
}

/**
* Generate Document.
* This endpoint offers different ways to generate a document. Find guides to document generation [here](/textgen/documents-standard).
*
* @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
* @param {Corti.DocumentsCreateRequest} request
Expand Down
91 changes: 90 additions & 1 deletion src/api/resources/transcripts/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class Transcripts {
}

/**
* Create a transcript from an audio file attached, via `/recordings` endpoint, to the interaction.<br/><Note>Each interaction may have more than one audio file and transcript associated with it. While audio files up to 60min in total duration, or 150MB in total size, may be attached to an interaction, synchronous processing is only supported for audio files less than ~2min in duration.<br/><br/>If an audio file takes longer to transcribe than the 25sec synchronous processing timeout, then it will continue to process asynchronously. In this scenario, an empty transcript will be returned with a location header that can be used to retrieve the final transcript.<br/><br/>The client can poll the Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/status`) for transcript status changes:<br/>- `200 OK` with status `processing`, `completed`, or `failed`<br/>- `404 Not Found` if the `interactionId` or `transcriptId` are invalid<br/><br/>The completed transcript can be retrieved via the Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/`).</Note>
* Create a transcript from an audio file attached, via `/recordings` endpoint, to the interaction.<br/><Note>Each interaction may have more than one audio file and transcript associated with it. While audio files up to 60min in total duration, or 150MB in total size, may be attached to an interaction, synchronous processing is only supported for audio files less than ~2min in duration.<br/><br/>If an audio file takes longer to transcribe than the 25sec synchronous processing timeout, then it will continue to process asynchronously. In this scenario, an incomplete or empty transcript with `status=processing` will be returned with a location header that can be used to retrieve the final transcript.<br/><br/>The client can poll the Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/status`) for transcript status changes:<br/>- `200 OK` with status `processing`, `completed`, or `failed`<br/>- `404 Not Found` if the `interactionId` or `transcriptId` are invalid<br/><br/>The completed transcript can be retrieved via the Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/`).</Note>
*
* @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
* @param {Corti.TranscriptsCreateRequest} request
Expand Down Expand Up @@ -561,6 +561,95 @@ export class Transcripts {
}
}

/**
* Poll for transcript creation status.<br/><Note>Status of `completed` indicates the transcript is finalized.<br/>If the transcript is retrieved while status is `processing`, then it will be incomplete.<br/>Status of `failed` indicate the transcript was not created successfully; please retry.</Note>
*
* @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID.
* @param {Corti.Uuid} transcriptId - The unique identifier of the transcript. Must be a valid UUID.
* @param {Transcripts.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Corti.NotFoundError}
*
* @example
* await client.transcripts.getStatus("f47ac10b-58cc-4372-a567-0e02b2c3d479", "f47ac10b-58cc-4372-a567-0e02b2c3d479")
*/
public getStatus(
id: Corti.Uuid,
transcriptId: Corti.Uuid,
requestOptions?: Transcripts.RequestOptions,
): core.HttpResponsePromise<Corti.TranscriptsStatusResponse> {
return core.HttpResponsePromise.fromPromise(this.__getStatus(id, transcriptId, requestOptions));
}

private async __getStatus(
id: Corti.Uuid,
transcriptId: Corti.Uuid,
requestOptions?: Transcripts.RequestOptions,
): Promise<core.WithRawResponse<Corti.TranscriptsStatusResponse>> {
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
(await core.Supplier.get(this._options.environment)).base,
`interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/transcripts/${encodeURIComponent(serializers.Uuid.jsonOrThrow(transcriptId, { omitUndefined: true }))}/status`,
),
method: "GET",
headers: mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({
Authorization: await this._getAuthorizationHeader(),
"Tenant-Name": requestOptions?.tenantName,
}),
requestOptions?.headers,
),
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
if (_response.ok) {
return {
data: serializers.TranscriptsStatusResponse.parseOrThrow(_response.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
}),
rawResponse: _response.rawResponse,
};
}

if (_response.error.reason === "status-code") {
switch (_response.error.statusCode) {
case 404:
throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
default:
throw new errors.CortiError({
statusCode: _response.error.statusCode,
body: _response.error.body,
rawResponse: _response.rawResponse,
});
}
}

switch (_response.error.reason) {
case "non-json":
throw new errors.CortiError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
rawResponse: _response.rawResponse,
});
case "timeout":
throw new errors.CortiTimeoutError(
"Timeout exceeded when calling GET /interactions/{id}/transcripts/{transcriptId}/status.",
);
case "unknown":
throw new errors.CortiError({
message: _response.error.errorMessage,
rawResponse: _response.rawResponse,
});
}
}

protected async _getAuthorizationHeader(): Promise<string | undefined> {
const bearer = await core.Supplier.get(this._options.token);
if (bearer != null) {
Expand Down
16 changes: 16 additions & 0 deletions src/api/types/AgentsCreateExpertReference.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

/**
* A reference to a registry expert when creating an agent, either id or name must be provided. If both are passed, the id will be used.
*/
export interface AgentsCreateExpertReference {
type: "reference";
/** The unique identifier of the expert. */
id?: string;
/** The name of the expert. */
name?: string;
/** Optional. Additional system instructions appended to the default system prompt when creating an expert from the registry, extending the expert's behavior. */
systemPrompt?: string;
}
2 changes: 2 additions & 0 deletions src/api/types/AgentsCreateMcpServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export interface AgentsCreateMcpServer {
transportType: Corti.AgentsCreateMcpServerTransportType;
/** Type of authorization used by the MCP server. */
authorizationType: Corti.AgentsCreateMcpServerAuthorizationType;
/** OAuth2.0 authorization scope to request. */
authorizationScope?: string;
/** URL of the MCP server. */
url: string;
/** Redirect URI for OAuth2.0 authorization. */
Expand Down
8 changes: 5 additions & 3 deletions src/api/types/AgentsExpertReference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
*/

/**
* A reference to an expert, either id or name must be provided. If both are passed, the id will be used.
* A reference to an expert returned by the API. The expert's id and name are always provided. systemPrompt is included only when a registry expert was created with a custom system prompt.
*/
export interface AgentsExpertReference {
type: "reference";
/** The unique identifier of the expert. */
id?: string;
id: string;
/** The name of the expert. */
name?: string;
name: string;
/** Optional. Additional system instructions appended to the default system prompt when creating an expert from the registry, extending the expert's behavior. */
systemPrompt?: string;
}
2 changes: 2 additions & 0 deletions src/api/types/AgentsMcpServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export interface AgentsMcpServer {
transportType: Corti.AgentsMcpServerTransportType;
/** Type of authorization used by the MCP server. */
authorizationType: Corti.AgentsMcpServerAuthorizationType;
/** OAuth2.0 authorization scope to request. */
authorizationScope?: string;
/** URL of the MCP server. */
url: string;
/** Redirect URI for OAuth2.0 authorization. */
Expand Down
2 changes: 1 addition & 1 deletion src/api/types/DocumentsContextWithFacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import * as Corti from "../index.js";
export interface DocumentsContextWithFacts {
/** The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`. */
type: "facts";
/** An array of facts. */
/** An array of facts. See [guide](/textgen/documents-standard##generate-document-from-facts-as-input). */
data: Corti.FactsContext[];
}
2 changes: 1 addition & 1 deletion src/api/types/DocumentsContextWithTranscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import * as Corti from "../index.js";
export interface DocumentsContextWithTranscript {
/** The type of context data that will be used in the request: `Facts`, `Transcript`, or `String`. */
type: "transcript";
/** Transcript object can accept the full transcript in one string, or individual transcript segments. */
/** The transcript `data.text` object can accept the full transcript in one string, alternatively pass each transcript segment into a `context` object - [see guide](/textgen/documents-standard#generate-document-from-transcript-as-input). */
data: Corti.CommonTranscriptRequest;
}
2 changes: 1 addition & 1 deletion src/api/types/DocumentsCreateRequestWithTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import * as Corti from "../index.js";

export interface DocumentsCreateRequestWithTemplate {
/** An array of context objects. Currently accepts exactly one context object to be used as input for document generation. */
/** An array of context objects. Currently only accepts multiple objects when of type `transcript`. See [guide](/textgen/documents-standard#generate-document-from-transcript-as-input). */
context: Corti.DocumentsContext[];
/** Template details if the template should be generated during the request. */
template: Corti.DocumentsTemplate;
Expand Down
4 changes: 2 additions & 2 deletions src/api/types/DocumentsCreateRequestWithTemplateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import * as Corti from "../index.js";

export interface DocumentsCreateRequestWithTemplateKey {
/** An array of context objects. Currently accepts exactly one context object to be used as input for document generation. */
/** An array of context objects. Currently only accepts multiple objects when of type `transcript`. See [guide](/textgen/documents-standard#generate-document-from-transcript-as-input). */
context: Corti.DocumentsContext[];
/** The key of the template that informs on what kind of document is to be generated. */
/** The key of the template referencing the sections for generating a document. */
templateKey: string;
/** An optional name for the document. */
name?: string;
Expand Down
9 changes: 4 additions & 5 deletions src/api/types/ErrorResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
*/

export interface ErrorResponse {
requestid?: string;
requestid: string;
status: number;
type: string;
status?: number;
title?: string;
details?: string;
instance?: string;
detail: string;
validationErrors?: Record<string, string>[];
}
4 changes: 4 additions & 0 deletions src/api/types/TranscriptsResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ export interface TranscriptsResponse {
/** An array of transcripts. */
transcripts?: Corti.CommonTranscriptResponse[] | null;
usageInfo: Corti.CommonUsageInfo;
/** The unique identifier for the associated recording. */
recordingId: Corti.Uuid;
/** The current status of the transcript processing. */
status: Corti.TranscriptsStatusEnum;
}
13 changes: 13 additions & 0 deletions src/api/types/TranscriptsStatusEnum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

/**
* Possible values for transcript processing status.
*/
export type TranscriptsStatusEnum = "completed" | "processing" | "failed";
export const TranscriptsStatusEnum = {
Completed: "completed",
Processing: "processing",
Failed: "failed",
} as const;
10 changes: 10 additions & 0 deletions src/api/types/TranscriptsStatusResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as Corti from "../index.js";

export interface TranscriptsStatusResponse {
/** The current status of the transcript processing. */
status: Corti.TranscriptsStatusEnum;
}
3 changes: 3 additions & 0 deletions src/api/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export * from "./TranscriptsResponse.js";
export * from "./TranscriptsListResponse.js";
export * from "./TranscriptsListItem.js";
export * from "./TranscriptsData.js";
export * from "./TranscriptsStatusResponse.js";
export * from "./TranscriptsStatusEnum.js";
export * from "./TemplatesSection.js";
export * from "./CommonSortingDirectionEnum.js";
export * from "./TemplatesDocumentationModeEnum.js";
Expand Down Expand Up @@ -143,6 +145,7 @@ export * from "./AgentsAgentExpertsItem.js";
export * from "./AgentsAgent.js";
export * from "./AgentsAgentReference.js";
export * from "./AgentsCreateExpert.js";
export * from "./AgentsCreateExpertReference.js";
export * from "./AgentsExpert.js";
export * from "./AgentsExpertReference.js";
export * from "./AgentsAgentResponse.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import * as serializers from "../../../../index.js";
import * as Corti from "../../../../../api/index.js";
import * as core from "../../../../../core/index.js";
import { AgentsCreateAgentAgentType } from "../../types/AgentsCreateAgentAgentType.js";
import { AgentsCreateAgentExpertsItem } from "../../types/AgentsCreateAgentExpertsItem.js";

export const AgentsCreateAgent: core.serialization.Schema<
serializers.AgentsCreateAgent.Raw,
Omit<Corti.AgentsCreateAgent, "ephemeral">
> = core.serialization.object({
name: core.serialization.string(),
agentType: AgentsCreateAgentAgentType.optional(),
systemPrompt: core.serialization.string().optional(),
description: core.serialization.string(),
experts: core.serialization.list(AgentsCreateAgentExpertsItem).optional(),
Expand All @@ -20,6 +22,7 @@ export const AgentsCreateAgent: core.serialization.Schema<
export declare namespace AgentsCreateAgent {
export interface Raw {
name: string;
agentType?: AgentsCreateAgentAgentType.Raw | null;
systemPrompt?: string | null;
description: string;
experts?: AgentsCreateAgentExpertsItem.Raw[] | null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as serializers from "../../../index.js";
import * as Corti from "../../../../api/index.js";
import * as core from "../../../../core/index.js";

export const AgentsCreateAgentAgentType: core.serialization.Schema<
serializers.AgentsCreateAgentAgentType.Raw,
Corti.AgentsCreateAgentAgentType
> = core.serialization.enum_(["expert", "orchestrator", "interviewing-expert"]);

export declare namespace AgentsCreateAgentAgentType {
export type Raw = "expert" | "orchestrator" | "interviewing-expert";
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import * as serializers from "../../../index.js";
import * as Corti from "../../../../api/index.js";
import * as core from "../../../../core/index.js";
import { AgentsCreateExpert } from "../../../types/AgentsCreateExpert.js";
import { AgentsExpertReference } from "../../../types/AgentsExpertReference.js";
import { AgentsCreateExpertReference } from "../../../types/AgentsCreateExpertReference.js";

export const AgentsCreateAgentExpertsItem: core.serialization.Schema<
serializers.AgentsCreateAgentExpertsItem.Raw,
Corti.AgentsCreateAgentExpertsItem
> = core.serialization.undiscriminatedUnion([AgentsCreateExpert, AgentsExpertReference]);
> = core.serialization.undiscriminatedUnion([AgentsCreateExpert, AgentsCreateExpertReference]);

export declare namespace AgentsCreateAgentExpertsItem {
export type Raw = AgentsCreateExpert.Raw | AgentsExpertReference.Raw;
export type Raw = AgentsCreateExpert.Raw | AgentsCreateExpertReference.Raw;
}
1 change: 1 addition & 0 deletions src/serialization/resources/agents/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./AgentsCreateAgentAgentType.js";
export * from "./AgentsCreateAgentExpertsItem.js";
export * from "./AgentsMessageSendResponse.js";
Loading
Loading