diff --git a/langchain/chains/query_constructor/base.py b/langchain/chains/query_constructor/base.py index dd5062a9..834084a1 100644 --- a/langchain/chains/query_constructor/base.py +++ b/langchain/chains/query_constructor/base.py @@ -61,7 +61,7 @@ def _format_attribute_info(info: Sequence[AttributeInfo]) -> str: for i in info: i_dict = dict(i) info_dicts[i_dict.pop("name")] = i_dict - return json.dumps(info_dicts, indent=2).replace("{", "{{").replace("}", "}}") + return json.dumps(info_dicts, indent=4).replace("{", "{{").replace("}", "}}") def _get_prompt( diff --git a/langchain/chains/query_constructor/prompt.py b/langchain/chains/query_constructor/prompt.py index 6282cc4d..f8cec9e5 100644 --- a/langchain/chains/query_constructor/prompt.py +++ b/langchain/chains/query_constructor/prompt.py @@ -4,8 +4,8 @@ from langchain import PromptTemplate SONG_DATA_SOURCE = """\ ```json { - content: "Lyrics of a song", - attributes: { + "content": "Lyrics of a song", + "attributes": { "artist": { "type": "string", "description": "Name of the song artist" @@ -33,7 +33,9 @@ FULL_ANSWER = """\ "query": "teenager love", "filter": "and(or(eq(\\"artist\\", \\"Taylor Swift\\"), eq(\\"artist\\", \\"Katy Perry\\")), \ lt(\\"length\\", 180), eq(\\"genre\\", \\"pop\\"))" -}}""" +}} +```\ +""" NO_FILTER_ANSWER = """\ ```json @@ -103,7 +105,7 @@ A comparison statement takes the form: `comp(attr, val)`: A logical operation statement takes the form `op(statement1, statement2, ...)`: - `op` ({allowed_operators}): logical operator - `statement1`, `statement2`, ... (comparison statements or logical operation \ -statements): one or more statements to appy the operation to +statements): one or more statements to apply the operation to Make sure that you only use the comparators and logical operators listed above and \ no others. @@ -125,8 +127,8 @@ DEFAULT_SUFFIX = """\ Data Source: ```json {{{{ - content: {content}, - attributes: {attributes} + "content": "{content}", + "attributes": {attributes} }}}} ```