Method: Langchain::OutputParsers::StructuredOutputParser#get_format_instructions
- Defined in:
- lib/langchain/output_parsers/structured_output_parser.rb
#get_format_instructions ⇒ String
Returns a string containing instructions for how the output of a language model should be formatted according to the @schema.
according to the @schema.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/langchain/output_parsers/structured_output_parser.rb', line 38 def get_format_instructions " You must format your output as a JSON value that adheres to a given \"JSON Schema\" instance.\n\n \"JSON Schema\" is a declarative language that allows you to annotate and validate JSON documents.\n\n For example, the example \"JSON Schema\" instance {\"properties\": {\"foo\": {\"description\": \"a list of test words\", \"type\": \"array\", \"items\": {\"type\": \"string\"}}}, \"required\": [\"foo\"]}}\n would match an object with one required property, \"foo\". The \"type\" property specifies \"foo\" must be an \"array\", and the \"description\" property semantically describes it as \"a list of test words\". The items within \"foo\" must be strings.\n Thus, the object {\"foo\": [\"bar\", \"baz\"]} is a well-formatted instance of this example \"JSON Schema\". The object {\"properties\": {\"foo\": [\"bar\", \"baz\"]}}} is not well-formatted.\n\n Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas!\n\n Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:\n ```json\n \#{schema.to_json}\n ```\n INSTRUCTIONS\nend\n" |