structured.d.ts 1.6 KB

123456789101112131415161718192021
  1. import { ChatPromptValueInterface } from "../prompt_values.js";
  2. import { RunnableLike, Runnable } from "../runnables/base.js";
  3. import { RunnableConfig } from "../runnables/config.js";
  4. import { InputValues } from "../utils/types/index.js";
  5. import { BaseMessagePromptTemplateLike, ChatPromptTemplate, ChatPromptTemplateInput } from "./chat.js";
  6. /**
  7. * Interface for the input of a ChatPromptTemplate.
  8. */
  9. export interface StructuredPromptInput<RunInput extends InputValues = any, PartialVariableName extends string = any> extends ChatPromptTemplateInput<RunInput, PartialVariableName> {
  10. schema: Record<string, any>;
  11. method?: "jsonMode" | "jsonSchema" | "functionMode";
  12. }
  13. export declare class StructuredPrompt<RunInput extends InputValues = any, PartialVariableName extends string = any> extends ChatPromptTemplate<RunInput, PartialVariableName> implements StructuredPromptInput<RunInput, PartialVariableName> {
  14. schema: Record<string, any>;
  15. method?: "jsonMode" | "jsonSchema" | "functionMode";
  16. lc_namespace: string[];
  17. get lc_aliases(): Record<string, string>;
  18. constructor(input: StructuredPromptInput<RunInput, PartialVariableName>);
  19. pipe<NewRunOutput>(coerceable: RunnableLike<ChatPromptValueInterface, NewRunOutput>): Runnable<RunInput, Exclude<NewRunOutput, Error>, RunnableConfig>;
  20. static fromMessagesAndSchema<RunInput extends InputValues = any>(promptMessages: (ChatPromptTemplate<InputValues, string> | BaseMessagePromptTemplateLike)[], schema: StructuredPromptInput["schema"], method?: "jsonMode" | "jsonSchema" | "functionMode"): ChatPromptTemplate<RunInput, any>;
  21. }