langchain.js
    Preparing search index...
    • Type guard to check if a given value is a SerializableSchema, i.e. both a Standard Schema and a Standard JSON Schema object.

      Type Parameters

      • Input = unknown

        The type of input described by the schema.

      • Output = Input

        The type of output described by the schema.

      Parameters

      • schema: SerializableSchema<Input, Output>

        The value to test.

      Returns schema is SerializableSchema<Input, Output>

      True if the schema is a valid SerializableSchema.

      This checks for both the presence of a Standard Schema V1 interface and the ability to generate a JSON schema.

      if (isSerializableSchema(schema)) {
      schema["~standard"].validate(data);
      const json = schema["~standard"].jsonSchema();
      }
    • Type guard to check if a given value is a SerializableSchema, i.e. both a Standard Schema and a Standard JSON Schema object.

      Type Parameters

      • Input = unknown

        The type of input described by the schema.

      • Output = Input

        The type of output described by the schema.

      Parameters

      • schema: unknown

        The value to test.

      Returns schema is SerializableSchema<Input, Output>

      True if the schema is a valid SerializableSchema.

      This checks for both the presence of a Standard Schema V1 interface and the ability to generate a JSON schema.

      if (isSerializableSchema(schema)) {
      schema["~standard"].validate(data);
      const json = schema["~standard"].jsonSchema();
      }