diff --git a/.fern/metadata.json b/.fern/metadata.json index c0021e2b..d1ffb4fc 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,5 +1,5 @@ { - "cliVersion": "5.80.4", + "cliVersion": "5.85.0", "generatorName": "fernapi/fern-typescript-node-sdk", "generatorVersion": "3.54.0", "generatorConfig": { @@ -34,6 +34,6 @@ } } }, - "originGitCommit": "7bbc721308055a6c33033d729c847911cc6ee9a0", + "originGitCommit": "5ca3c7aecf78753599a7bdbeae9e09862209fd8f", "sdkVersion": "0.0.0-dev" } diff --git a/src/api/types/GuidedDocumentSection.ts b/src/api/types/GuidedDocumentSection.ts new file mode 100644 index 00000000..9482e526 --- /dev/null +++ b/src/api/types/GuidedDocumentSection.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * One section of a generated document. The `heading` is the section heading at generation time, after overrides. The section's order is its position in the parent `sections` array. + */ +export interface GuidedDocumentSection { + /** The section ID. Use this as the key into `stringDocument` and `structuredDocument`. */ + sectionId: string; + /** The section heading at generation time, after overrides. */ + heading: string; +} diff --git a/src/api/types/GuidedEphemeralDocument.ts b/src/api/types/GuidedEphemeralDocument.ts index f0a96122..4d07585d 100644 --- a/src/api/types/GuidedEphemeralDocument.ts +++ b/src/api/types/GuidedEphemeralDocument.ts @@ -13,8 +13,12 @@ export interface GuidedEphemeralDocument { outputLanguage: string; /** The interaction whose context was used to generate this document, if supplied. */ interactionId?: string | null; + /** The generated document as a map of section ID to rendered string output. The `sections` array lists every section ID and its heading. */ stringDocument: Record; + /** The generated document as a structured object keyed by section ID. The `sections` array lists every section ID and its heading. */ structuredDocument?: Record | null; + /** Every section in the template version, in template order, including sections the model left empty. Use `sectionId` as the key into `stringDocument` and `structuredDocument`. The `heading` lets you render the section label without a GET request per section. */ + sections?: Corti.GuidedDocumentSection[]; /** Key/value labels attached to this document. */ labels: Corti.GuidedLabel[]; } diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 7ce73b9e..0ed058bd 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -118,6 +118,7 @@ export * from "./GuidedAssemblySectionRef.js"; export * from "./GuidedBoolNode.js"; export * from "./GuidedDocumentContext.js"; export * from "./GuidedDocumentFactMinimal.js"; +export * from "./GuidedDocumentSection.js"; export * from "./GuidedDocumentsCreateEphemeralResponse.js"; export * from "./GuidedDocumentsGenerateBase.js"; export * from "./GuidedDocumentsGenerateByAssembly.js"; diff --git a/src/serialization/types/GuidedDocumentSection.ts b/src/serialization/types/GuidedDocumentSection.ts new file mode 100644 index 00000000..a38b0f6e --- /dev/null +++ b/src/serialization/types/GuidedDocumentSection.ts @@ -0,0 +1,20 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const GuidedDocumentSection: core.serialization.ObjectSchema< + serializers.GuidedDocumentSection.Raw, + Corti.GuidedDocumentSection +> = core.serialization.object({ + sectionId: core.serialization.string(), + heading: core.serialization.string(), +}); + +export declare namespace GuidedDocumentSection { + export interface Raw { + sectionId: string; + heading: string; + } +} diff --git a/src/serialization/types/GuidedEphemeralDocument.ts b/src/serialization/types/GuidedEphemeralDocument.ts index 98fe685f..2ab0ece0 100644 --- a/src/serialization/types/GuidedEphemeralDocument.ts +++ b/src/serialization/types/GuidedEphemeralDocument.ts @@ -3,6 +3,7 @@ import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; import type * as serializers from "../index.js"; +import { GuidedDocumentSection } from "./GuidedDocumentSection.js"; import { GuidedLabel } from "./GuidedLabel.js"; export const GuidedEphemeralDocument: core.serialization.ObjectSchema< @@ -18,6 +19,7 @@ export const GuidedEphemeralDocument: core.serialization.ObjectSchema< structuredDocument: core.serialization .record(core.serialization.string(), core.serialization.unknown()) .optionalNullable(), + sections: core.serialization.list(GuidedDocumentSection).optional(), labels: core.serialization.list(GuidedLabel), }); @@ -30,6 +32,7 @@ export declare namespace GuidedEphemeralDocument { interactionId?: (string | null | undefined) | null; stringDocument: Record; structuredDocument?: (Record | null | undefined) | null; + sections?: GuidedDocumentSection.Raw[] | null; labels: GuidedLabel.Raw[]; } } diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 7ce73b9e..0ed058bd 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -118,6 +118,7 @@ export * from "./GuidedAssemblySectionRef.js"; export * from "./GuidedBoolNode.js"; export * from "./GuidedDocumentContext.js"; export * from "./GuidedDocumentFactMinimal.js"; +export * from "./GuidedDocumentSection.js"; export * from "./GuidedDocumentsCreateEphemeralResponse.js"; export * from "./GuidedDocumentsGenerateBase.js"; export * from "./GuidedDocumentsGenerateByAssembly.js"; diff --git a/tests/wire/documents.test.ts b/tests/wire/documents.test.ts index 70544566..20cb9b4f 100644 --- a/tests/wire/documents.test.ts +++ b/tests/wire/documents.test.ts @@ -1034,6 +1034,10 @@ describe("DocumentsClient", () => { interactionId: "interactionId", stringDocument: { key: "value" }, structuredDocument: { key: "value" }, + sections: [ + { sectionId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", heading: "Chief Complaint" }, + { sectionId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", heading: "Assessment and Plan" }, + ], labels: [{ key: "key", value: "value" }], }, usageInfo: { creditsConsumed: 1.1 }, @@ -1067,6 +1071,16 @@ describe("DocumentsClient", () => { structuredDocument: { key: "value", }, + sections: [ + { + sectionId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + heading: "Chief Complaint", + }, + { + sectionId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", + heading: "Assessment and Plan", + }, + ], labels: [ { key: "key",