Circle V2 API Docs
    Preparing search index...

    Function createChartReviewChatModel

    • Constructs the ChatOpenAI instance that powers a chart-review run.

      Defaults mirror v1 verbatim (gpt-4.1, temperature 0.1, no streaming, 3 retries). maxTokens is sourced from the resolved ChartReviewSettings so LD overrides flow through. model / temperature exist for experiment harnesses (evals, the superadmin compare bench) that need to swap the model for one run; production leaves them unset. Gateway routing and ls_* stamping are shared with V3 via @repo/ai/gateway.

      Lives here (rather than in the trpc handler) so the @langchain/openai dependency stays confined to @repo/legacy.

      promptCacheKey routes same-prefix traffic to one machine so the automatic prompt cache is realized at volume. Pass it only from single-purpose call sites: the shared run-wide instance serves several prompts, and one key across different prefixes just dilutes the routing.

      Parameters

      • settings: {
            enableAgenticDocSelection?: boolean;
            enableCoverageFacts?: boolean;
            enableDeadlineResolution?: boolean;
            enableDocumentCatalogue?: boolean;
            enableEpisodePatientBlock?: boolean;
            enableExpandedStatuses?: boolean;
            enableIntentAwarePlanning?: boolean;
            enableLatestPriorInstances?: boolean;
            enableMetadataAwareGate?: boolean;
            enablePassFailRecheck?: boolean;
            enablePerQuestionInstructions?: boolean;
            enableQueryHydration?: boolean;
            enableReviewCriteriaInDocumentSelection?: boolean;
            enableRunConstantPrefix?: boolean;
            enableSegmentInlining?: boolean;
            enableSelectionRetry?: boolean;
            enableStatusReconciliation?: boolean;
            enableSubClaimFanOut?: boolean;
            enableSubdocumentCatalogue?: boolean;
            enableSummaryTableShortcut?: boolean;
            enableThinRetrievalBailout?: boolean;
            enableTimeFilteringInChartReview?: boolean;
            enableUnitCitationVerification?: boolean;
            enableUnlockedRetrieval?: boolean;
            enableV3PassFailRunner?: boolean;
            enableV3SummaryRunner?: boolean;
            maxTokens: number;
        }
        • OptionalenableAgenticDocSelection?: boolean

          Only read when enableV3PassFailRunner is on — it configures the v3 runner, not v2.

        • OptionalenableCoverageFacts?: boolean
        • OptionalenableDeadlineResolution?: boolean

          Only read when enableV3PassFailRunner is on — it configures the v3 runner, not v2.

        • OptionalenableDocumentCatalogue?: boolean

          Only read when enableV3PassFailRunner is on — it configures the v3 runner, not v2.

        • OptionalenableEpisodePatientBlock?: boolean
        • OptionalenableExpandedStatuses?: boolean
        • OptionalenableIntentAwarePlanning?: boolean
        • OptionalenableLatestPriorInstances?: boolean

          Only read when enableV3PassFailRunner AND enableAgenticDocSelection are on.

        • OptionalenableMetadataAwareGate?: boolean
        • OptionalenablePassFailRecheck?: boolean
        • OptionalenablePerQuestionInstructions?: boolean
        • OptionalenableQueryHydration?: boolean
        • OptionalenableReviewCriteriaInDocumentSelection?: boolean
        • OptionalenableRunConstantPrefix?: boolean

          Only read when enableV3PassFailRunner is on — it configures the v3 runner, not v2.

        • OptionalenableSegmentInlining?: boolean

          Only read when enableSubdocumentCatalogue is on — there are no selected forms without it.

        • OptionalenableSelectionRetry?: boolean
        • OptionalenableStatusReconciliation?: boolean
        • OptionalenableSubClaimFanOut?: boolean

          Only read when enableV3PassFailRunner is on — it configures the v3 runner, not v2.

        • OptionalenableSubdocumentCatalogue?: boolean

          Only read when enableV3PassFailRunner AND enableAgenticDocSelection are on.

        • OptionalenableSummaryTableShortcut?: boolean
        • OptionalenableThinRetrievalBailout?: boolean
        • OptionalenableTimeFilteringInChartReview?: boolean
        • OptionalenableUnitCitationVerification?: boolean

          Only read when enableCitationVerification is on — it narrows that check, it does not add one.

        • OptionalenableUnlockedRetrieval?: boolean
        • OptionalenableV3PassFailRunner?: boolean
        • OptionalenableV3SummaryRunner?: boolean
        • maxTokens: number
      • Optionalopts: { model?: string; promptCacheKey?: string; temperature?: number }

      Returns ChatOpenAI