user-simulator 0.2.5__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- config/__init__.py +0 -0
- config/__pycache__/__init__.cpython-312.pyc +0 -0
- config/asr_configuration/__init__.py +0 -0
- config/asr_configuration/default_asr_config.yml +8 -0
- config/misc/__init__.py +0 -0
- config/misc/sound/__init__.py +0 -0
- config/misc/sound/c1bccaed.wav +0 -0
- config/models/__init__.py +0 -0
- config/models/models.yml +15 -0
- config/patterns/__init__.py +0 -0
- config/patterns/end_conversation_patterns.yml +40 -0
- config/patterns/fallback_patterns.yml +9 -0
- config/personalities/__init__.py +0 -0
- config/personalities/conversational-user.yml +6 -0
- config/personalities/curious-user.yml +5 -0
- config/personalities/direct-user.yml +4 -0
- config/personalities/disorganized-user.yml +5 -0
- config/personalities/elderly-user.yml +6 -0
- config/personalities/formal-user.yml +4 -0
- config/personalities/impatient-user.yml +4 -0
- config/personalities/rude-user.yml +6 -0
- config/personalities/sarcastic-user.yml +4 -0
- config/personalities/skeptical-user.yml +5 -0
- config/types/__init__.py +0 -0
- config/types/currency.yml +10 -0
- config/types/phone_number.yml +4 -0
- data/__init__.py +0 -0
- data/__pycache__/__init__.cpython-312.pyc +0 -0
- data/audio_files/__init__.py +0 -0
- data/audio_files/output.mp3 +0 -0
- data/audio_files/output.wav +0 -0
- data/cache/__init__.py +0 -0
- data/cache/image_register.json +238 -0
- data/cache/pdf_register.json +3 -0
- data/cache/webpage_register.json +67 -0
- data/connectors/__init__.py +0 -0
- data/connectors/dialogflow.yml +16 -0
- data/connectors/julie.yml +37 -0
- data/connectors/kuki.yml +16 -0
- data/connectors/millionbot_ada.yml +25 -0
- data/connectors/rasa.yml +8 -0
- data/connectors/serviceform.yml +17 -0
- data/connectors/taskyto.yml +8 -0
- data/element_lists/__init__.py +0 -0
- data/element_lists/list_of_things.yml +7 -0
- data/list_functions/__init__.py +0 -0
- data/pdfs/Normativa_TFMs_EPS.pdf +0 -0
- data/pdfs/__init__.py +0 -0
- data/readme_data/__init__.py +0 -0
- data/readme_data/img.png +0 -0
- user_sim/cli/cli.py +116 -20
- user_sim/cli/sensei_chat.py +58 -236
- user_sim/core/role_structure.py +4 -3
- user_sim/handlers/asr_module.py +5 -2
- user_sim/handlers/pdf_parser_module.py +1 -0
- user_sim/utils/config.py +10 -2
- user_sim/utils/register_management.py +2 -3
- user_sim/utils/utilities.py +60 -46
- {user_simulator-0.2.5.dist-info → user_simulator-0.3.0.dist-info}/METADATA +5 -2
- user_simulator-0.3.0.dist-info/RECORD +99 -0
- {user_simulator-0.2.5.dist-info → user_simulator-0.3.0.dist-info}/top_level.txt +1 -0
- user_simulator-0.2.5.dist-info/RECORD +0 -49
- {user_simulator-0.2.5.dist-info → user_simulator-0.3.0.dist-info}/WHEEL +0 -0
- {user_simulator-0.2.5.dist-info → user_simulator-0.3.0.dist-info}/entry_points.txt +0 -0
- {user_simulator-0.2.5.dist-info → user_simulator-0.3.0.dist-info}/licenses/LICENSE.txt +0 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
{
|
2
|
+
"de2a62d6c6fa0f33010d8c8e6c8eacfd": "(Web page content: UAM - Escuela Politécnica Superior Acceder al contenido principal Acceder al menú principal '>Formulario de contacto '>La UAM INTRANET UAM INTRANET UAM PORTAL DEL EMPLEADO Otros Servicios online Correo Web Direcciones funcionales Envío de SMS Fotomatón (PAS y PDI) Listas de correo Tramitador Intranet Secretaría General Logo EPS Buscador Buscar Biblioteca de la EPS Directorio UAM Intranet EPS English Menú principal La Escuela Presentación Medidas COVID-19 Estructura y Organización Directorio Sistema de Garantía Interno de Calidad (SGIC) Medios Materiales e Infraestructuras Normativa y Procedimientos Museo Premios EPS Mujeres e Ingeniería Actividades pre-universitarias Noticias Agenda Avisos Servicios Localización Departamentos Ingeniería Informática Tecnología Electrónica y de las Comunicaciones Estudios Grado Máster Programas Académicos Grado+Máster Doctorado Enseñanzas propias de la UAM Docencia en Otras Titulaciones Repositorio de Guías Docentes Estudiantes Asuntos Académico-Administrativos Noticias y Actividades Plan de Acción Tutelar Representación de Estudiantes Asociaciones de Estudiantes Recursos On Line Becas y Empleo Estatuto del Estudiante Investigación Grupos de Investigación y áreas de conocimiento Seminarios de Investigación Seminarios de Divulgación Memorias de Investigación Cátedras de Patrocinio UAM-Entidad Nuevos Estudiantes Razones para estudiar en la EPS Presentación de titulaciones Bienvenidos a la EPS Acceso a los Estudios Matrícula Admitidos a 1º Curso Internacional Oficina de Relaciones Internacionales (ORI) Incoming Students ( Estudiantes Entrantes) CIVIS: A European Civic University Estudiantes de la EPS Coordinadores de Movilidad Prácticas Internacionales Oficina de Prácticas Prácticas Curriculares Prácticas Extracurriculares Prácticas en cooperación al desarrollo Escuela Politécnica Superior Formamos Ingenieros Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieros Estudios Grado en Ingeniería Biomédica Grado en Ciencia e Ingeniería de Datos Grado en Ingeniería Informática (EURO-INF®) Grado en Ingeniería de Tecnologías y Servicios de Telecomunicación (EUR-ACE®) Doble Grado en Ingeniería Informática y Matemáticas Máster Universitario en Ciencia de Datos Máster Universitario en Deep Learning for Audio and Video Signal Processing Máster Universitario en Ingeniería Informática Máster Universitario en Ingeniería de Telecomunicación (EUR-ACE®) Máster Universitario en Investigación e Innovación en Inteligencia Computacional y Sistemas Interactivos Máster Universitario en Image Processing and Computer Vision Doctorado Ing. Informática y Telecomunicación RD2011 (Escuela de Doctorado de la UAM) Máster Universitario en Sistemas Interactivos Inteligentes Máster Universitario en Bioinformática y Biología Computacional (Facultad de Medicina) Más estudios Te interesa Biblioteca de la EPS Oficina de Cooperación UAM Consulta de expedientes Plan de Acción Tutelar Becas de excelencia Noticias de la UAM Servicios Seguro escolar Avisos La UAM con Ucrania> Convocatoria SICUE> El próximo 13 de febrero se abre el plazo para la presentación de solicitudes de la Convocatoria SICUE. Podrás realizar un intercambio, de uno o dos semestres, a otra universidad española. Más avisos Noticias 11/02/2025 La Biblioteca de la EPS lanza la exposición virtual permanente “Mujeres en las TIC” 05/02/2025 Rubén Tolosana Moranchel recibe el premio \"Juan López de Peñalver (2024)\" por la Real Academia de Ingeniería 03/02/2025 Director de relaciones internacionale de TELECOM Nancy nos ha visitado Inteligencia Artificial: innovaciones que transforman el mundo 05/12/2024 Investigadores de la EPS participan en el lanzamiento del proyecto LPI para impulsar la astronomía cuántica Más noticias Eventos destacados Seminario \"Presentaciones orales eficaces: comunicar de manera exitosa\" Día: 21/02/2025 Hora de celebración: 13:00h Ponente: Pedro Pablo Sigüenza Pizarro Día de la EPS Día: 27/02/2025 Hora de celebración: 10:00 Más eventos Agenda null Accesibilidad Aviso legal Mapa web Contacto Cómo llegar Síguenos en Escuela Politécnica Superior | Universidad Autónoma de Madrid | Francisco Tomás y Valiente, 11 | 28049 Madrid | Tel.: +34 91 497 2222 | e-mail: informacion.eps@uam.es Esta web utiliza cookies analíticas de terceros para facilitar la navegación y obtener información de uso de sus visitantes. Si continúa navegando, consideraremos que acepta su uso. Puede obtener más información en nuestra política de cookies. XImage description 0: (Image description: The image features a logo for \"Escuela Politécnica Superior.\" It includes a stylized building design in blue and orange, with a green curved line and yellow elements resembling flowers or leaves. The text is in a modern font.) Image description 1: (Image description: The image features the logo of \"Universidad Autónoma de Madrid\" (UAM). It includes the acronym \"UAM\" prominently displayed, along with the full name of the university in smaller text below. The design is simple and uses a monochromatic color scheme.) Image description 2: (Image description: The image features the word \"excelencia\" prominently, accompanied by the abbreviations \"UAM\" and \"CSIC\" in a stylized font. It conveys a sense of academic or institutional branding.) Image description 3: (Image description: The image is completely blank and white with no visible features or objects.) Image description 4: (Image description: The image is completely blank and white with no visible features or details.) Image description 5: (Image description: The image shows a solid brown circle on a green background.) Image description 6: (Image description: The image is a simple, blank white circle.) Image description 7: (Image description: I can't see the image, so I'm unable to describe it. If you provide details about it, I can help you summarize or analyze them!) Image description 8: (Image description: The image is a plain white circle with no additional details or features.) Image description 9: (Image description: The image features a series of four vertical panels with a warm color tone. The first panel shows a building's exterior, the second panel displays a modern architectural structure, the third panel highlights a circuit board, and the fourth panel features a computer keyboard. The overall appearance has a reflective quality at the bottom.) Image description 10: (Image description: The image shows two individuals working at computer desks in a classroom or study environment. One person, in the foreground, is wearing glasses and focused on the screen, while the other is slightly further back, also engaged with their computer. The setting appears bright and modern.) Image description 11: (Image description: The image features four individuals standing together. Two women wear formal attire, one in a blue dress and the other in a black dress. The two men are dressed in suits. They appear to be holding documents or folders and are positioned in front of a decorative backdrop.) Image description 12: (Image description: The image shows a blue chalkboard with the word \"Hello!\" written on it. In front of the board, there is a yellow object and a dark item on a desk. The background is a classroom setting.) Image description 13: (Image description: The image shows a conference or meeting room with a few people seated in rows facing a presentation screen. There are speakers at a table in front, and a banner displayed on the wall. The setting appears formal and focused on a discussion or presentation.) Image description 14: (Image description: The image shows a group of people gathered on steps in front of a large building. They appear to be posing for a photo, with a clear blue sky in the background.) Image description 15: (Image description: The image is an announcement for \"Día de la EPS 2025.\" It features a large illustration of a traditional dish (paella) and includes details such as the location (\"Comedor de la EPS\"), time (\"A partir de 13:15\"), and a note that the event is free (\"GRATIS\"). There is also a QR code for registration and the date \"17 de Febrero 2025\" at the bottom.) Image description 16: (Image description: The image features a group of people sitting together on grass in a park setting, engaged in conversation. There are trees in the background, and the overall atmosphere is casual and relaxed. Text on the left promotes a program offering short-duration micro-credentials.) Image description 17: (Image description: The image features a logo with a stylized \"U\" in red, yellow, and blue stripes, alongside the text \"Universidades Españolas con UCRANIA\" in a bold font.) Image description 18: (Image description: The image features a text layout with the title \"Buzón de preguntas\" (Question Box) and a subtitle \"Modificación Grado Ing. Informática\" (Modification Degree in Computer Engineering). There is a prominent red question mark symbol. The text uses a combination of gray and brown colors.) Image description 19: (Image description: The image presents a diagram illustrating academic programs, specifically highlighting the combination of a \"Grado\" (Bachelor's degree) and a \"Máster\" (Master's degree). It includes details about the credit requirements for each program and mentions professional qualification (\"Habilitación profesional\") related to engineering. The overall theme emphasizes educational pathways.) Image description 20: (Image description: The image features a blue background with the text \"Gestión Universitaria\" above the word \"SIGMA,\" which is prominently displayed in a larger font.) Image description 21: (Image description: The image shows a library setting with bookshelves, people reading or studying, and a sign that says \"Biblioteca EPS.\" There is a green circular sign with the word \"Lectura.\" The environment appears organized and academic.) Image description 22: (Image description: The image shows a close-up of a person's hands working with electronic components, possibly assembling or repairing a device. There is a text on the right that reads \"Becas de la UAM,\" suggesting it relates to scholarships from UAM (Universidad Autónoma de Madrid).) Image description 23: (Image description: The image features a red mailbox with a smiley face and icons for complaints and suggestions. It includes the text \"Buzón de quejas y sugerencias,\" which translates to \"Mailbox for complaints and suggestions.\" There is also an email symbol (@) and a reference to \"Sede electrónica.\") Image description 24: (Image description: The image features the word \"ALUMNIUAM\" in large green letters, accompanied by a colorful arrangement of square shapes. Below, it includes the phrase \"¡Soy de la Autonómal!\" in a smaller font. The overall design suggests a connection to an alumni community.) Image description 25: (Image description: The image features a logo for \"CIVIS,\" which represents Europe's Civic University Alliance. The logo includes the word \"civis\" in a bold font, accompanied by colorful circles in various sizes and shades, conveying a modern and collaborative theme. Below, it states \"Europe's Civic University Alliance.\") Image description 26: (Image description: The image features the Instagram logo, which consists of a stylized camera icon in a gradient of purple, pink, and orange colors.) Image description 27: (Image description: The image features the YouTube logo, which consists of the word \"You\" in white letters on a red background, followed by the word \"Tube\" in black letters. The design is simple and recognizable.) Image description 28: (Image description: The image shows the Facebook logo, which consists of a blue square with a white lowercase \"f\" in the center.) Image description 29: (Image description: I'm unable to see the image. If you provide a description, I can help you summarize or analyze it!) Image description 30: Empty data >>)",
|
3
|
+
"3d8fceef45a47b9dc6fa9808a7efe977": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
4
|
+
"a8f5a2492895df53ddf912532e5cc7d3": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
5
|
+
"4706ca602da7ca753f496a403bd0b68a": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
6
|
+
"c39ac4c136ba661ee5bb0a5c11147037": "(Web page content: UAM - Escuela Politécnica Superior Acceder al contenido principal Acceder al menú principal '>Formulario de contacto '>La UAM INTRANET UAM INTRANET UAM PORTAL DEL EMPLEADO Otros Servicios online Correo Web Direcciones funcionales Envío de SMS Fotomatón (PAS y PDI) Listas de correo Tramitador Intranet Secretaría General Logo EPS Buscador Buscar Biblioteca de la EPS Directorio UAM Intranet EPS English Menú principal La Escuela Presentación Medidas COVID-19 Estructura y Organización Directorio Sistema de Garantía Interno de Calidad (SGIC) Medios Materiales e Infraestructuras Normativa y Procedimientos Museo Premios EPS Mujeres e Ingeniería Actividades pre-universitarias Noticias Agenda Avisos Servicios Localización Departamentos Ingeniería Informática Tecnología Electrónica y de las Comunicaciones Estudios Grado Máster Programas Académicos Grado+Máster Doctorado Enseñanzas propias de la UAM Docencia en Otras Titulaciones Repositorio de Guías Docentes Estudiantes Asuntos Académico-Administrativos Noticias y Actividades Plan de Acción Tutelar Representación de Estudiantes Asociaciones de Estudiantes Recursos On Line Becas y Empleo Estatuto del Estudiante Investigación Grupos de Investigación y áreas de conocimiento Seminarios de Investigación Seminarios de Divulgación Memorias de Investigación Cátedras de Patrocinio UAM-Entidad Nuevos Estudiantes Razones para estudiar en la EPS Presentación de titulaciones Bienvenidos a la EPS Acceso a los Estudios Matrícula Admitidos a 1º Curso Internacional Oficina de Relaciones Internacionales (ORI) Incoming Students ( Estudiantes Entrantes) CIVIS: A European Civic University Estudiantes de la EPS Coordinadores de Movilidad Prácticas Internacionales Oficina de Prácticas Prácticas Curriculares Prácticas Extracurriculares Prácticas en cooperación al desarrollo Escuela Politécnica Superior Formamos Ingenieros Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieros Estudios Grado en Ingeniería Biomédica Grado en Ciencia e Ingeniería de Datos Grado en Ingeniería Informática (EURO-INF®) Grado en Ingeniería de Tecnologías y Servicios de Telecomunicación (EUR-ACE®) Doble Grado en Ingeniería Informática y Matemáticas Máster Universitario en Ciencia de Datos Máster Universitario en Deep Learning for Audio and Video Signal Processing Máster Universitario en Ingeniería Informática Máster Universitario en Ingeniería de Telecomunicación (EUR-ACE®) Máster Universitario en Investigación e Innovación en Inteligencia Computacional y Sistemas Interactivos Máster Universitario en Image Processing and Computer Vision Doctorado Ing. Informática y Telecomunicación RD2011 (Escuela de Doctorado de la UAM) Máster Universitario en Sistemas Interactivos Inteligentes Máster Universitario en Bioinformática y Biología Computacional (Facultad de Medicina) Más estudios Te interesa Biblioteca de la EPS Oficina de Cooperación UAM Consulta de expedientes Plan de Acción Tutelar Becas de excelencia Noticias de la UAM Servicios Seguro escolar Avisos La UAM con Ucrania> Convocatoria SICUE> El próximo 13 de febrero se abre el plazo para la presentación de solicitudes de la Convocatoria SICUE. Podrás realizar un intercambio, de uno o dos semestres, a otra universidad española. Más avisos Noticias 11/02/2025 La Biblioteca de la EPS lanza la exposición virtual permanente “Mujeres en las TIC” 05/02/2025 Rubén Tolosana Moranchel recibe el premio \"Juan López de Peñalver (2024)\" por la Real Academia de Ingeniería 03/02/2025 Director de relaciones internacionale de TELECOM Nancy nos ha visitado Inteligencia Artificial: innovaciones que transforman el mundo 05/12/2024 Investigadores de la EPS participan en el lanzamiento del proyecto LPI para impulsar la astronomía cuántica Más noticias Eventos destacados Seminario \"Breaking the limits of the standard model of vision\" Día: 18/03/2025 Hora de celebración: 16:00h Ponente: Dr. Marcelo Bertalmío Seminario \"Welfare Technology in Norway\" Día: 31/03/2025 Hora de celebración: 17:00h Ponente: Dr Bong Way Kiat Más eventos Agenda null Accesibilidad Aviso legal Mapa web Contacto Cómo llegar Síguenos en Escuela Politécnica Superior | Universidad Autónoma de Madrid | Francisco Tomás y Valiente, 11 | 28049 Madrid | Tel.: +34 91 497 2222 | e-mail: informacion.eps@uam.es Esta web utiliza cookies analíticas de terceros para facilitar la navegación y obtener información de uso de sus visitantes. Si continúa navegando, consideraremos que acepta su uso. Puede obtener más información en nuestra política de cookies. XImage description 0: (Image description: The image features a logo for \"Escuela Politécnica Superior.\" It includes a stylized building graphic in blue and orange, with a green curved line and yellow elements, emphasizing an educational theme.) Image description 1: (Image description: The image features the logo of \"Universidad Autónoma de Madrid\" (UAM), presented in a simple, modern font with the initials \"UAM\" prominently displayed. The color scheme is monochromatic, using shades of gray.) Image description 2: (Image description: The image features the word \"excelencia\" prominently, along with the abbreviations \"UAM\" and \"CSIC\" in a stylized font. It has a clean, modern design with a focus on academic or institutional branding.) Image description 3: (Image description: The image is entirely white with no other visible features or details.) Image description 4: (Image description: The image is completely blank and white, with no discernible features or content.) Image description 5: (Image description: The image is a solid brown circle set against a green background.) Image description 6: (Image description: It appears to be a blank or empty image with no visible content.) Image description 7: (Image description: The image is a blank white circle with no discernible features or details.) Image description 8: (Image description: The image appears to be a blank or solid color circle, lacking any distinct features or details.) Image description 9: (Image description: The image features a collage with four vertical sections. It includes architectural elements, a modern building, a close-up of a circuit board, and a computer keyboard. The overall color tone is warm and muted.) Image description 10: (Image description: The image shows several individuals sitting at computers in a bright, modern workspace. Two people are focused on their screens, while another person is visible in the background. The setting appears to be an educational or collaborative environment.) Image description 11: (Image description: The image shows four people standing together. Two women are on the left, one in a blue dress and the other in a black outfit, while two men are on the right, both in formal attire. They appear to be holding documents and are positioned in front of a decorative background.) Image description 12: (Image description: The image shows a chalkboard with the word \"Hello!\" written on it. In front of the board, there is a desk with a yellow object and a black item. The background appears to be a classroom setting.) Image description 13: (Image description: The image shows a conference or meeting setting with a presentation on a screen. There are several people seated in rows, facing the front where speakers or panelists are positioned. The room has a simple, modern design with a light color scheme.) Image description 14: (Image description: The image shows a group of people gathered together on steps in front of a large building. They appear to be posing for a photo, with a mix of individuals in formal attire. The background features architectural elements typical of a grand structure.) Image description 15: (Image description: The image features a promotional banner for micro-credentials offered by the Universidad Autónoma de Madrid (UAM). It includes text highlighting the program's focus, encouraging exploration (\"¡Descúbrelos!\") and mentions a short-duration training program with ECTS credits. In the background, a group of people is sitting on grass in a park-like setting.) Image description 16: (Image description: The image features a logo with stylized red and yellow stripes forming a \"U\" shape. Next to it is the text \"Universidades Españolas con UCRANIA,\" indicating a connection between Spanish universities and Ukraine.) Image description 17: (Image description: The image features a title in Spanish that reads \"Buzón de preguntas\" (Question Box) and \"Modificación Grado Ing. Informática\" (Modification Bachelor's Degree in Computer Engineering). It includes a large red question mark, emphasizing inquiry or questions related to the topic.) Image description 18: (Image description: The image outlines academic programs, highlighting two main components: \"Grado\" (undergraduate degree) with 240 ECTS credits and \"Máster\" (master's degree) requiring 72-90 ECTS. It illustrates a pathway to professional qualification and includes elements for professional engineering. The design features a combination of text and arrows for clarity.) Image description 19: (Image description: The image features a logo with a light blue background. It includes the text \"Gestión Universitaria\" above the word \"SIGMA,\" which is prominently displayed in a larger font.) Image description 20: (Image description: The image shows a library setting with bookshelves and people reading. The text \"Biblioteca EPS\" is prominently displayed, indicating the library's name. There is a green circle with the word \"Lectura\" above, suggesting a reading area.) Image description 21: (Image description: The image features a close-up of a person's hands working with a device, likely related to technology or robotics. The text on the right reads \"Becas de la UAM,\" which translates to \"Scholarships from UAM.\") Image description 22: (Image description: The image features a red mailbox labeled \"Buzón de quejas y sugerencias,\" which translates to \"Mailbox for complaints and suggestions.\" It includes an email symbol (@) and a smiling face icon, suggesting a friendly approach to receiving feedback.) Image description 23: (Image description: The image features the word \"ALUMNIUAM\" in bold green letters, accompanied by a colorful design of interlocking squares in various hues. Below the main text, it states \"¡Soy de la Autónoma!\" in a smaller font. The overall design is clean and modern, promoting a sense of community or affiliation.) Image description 24: (Image description: The image features the logo of \"civis,\" which is described as Europe's Civic University Alliance. The logo includes the word \"civis\" in dark blue, accompanied by various colorful circles of different sizes and shades. Below the word is the tagline \"Europe's Civic University Alliance\" in a lighter blue.) Image description 25: (Image description: The image is the Instagram logo, featuring a stylized camera icon within a square. The background has a gradient of purple, pink, and orange colors.) Image description 26: (Image description: The image features the YouTube logo, which includes the word \"YouTube\" in a bold font, with \"You\" in black and \"Tube\" in white on a red background.) Image description 27: (Image description: The image features the Facebook logo, which consists of a lowercase \"f\" in white on a blue background. The design is simple and recognizable.) Image description 28: (Image description: I can't see the image you're referring to. Please describe it, and I'll help you with any information or questions you have!) Image description 29: (Image description: The image is an orange square icon featuring a white RSS feed symbol, which consists of a series of curved lines and a dot.) >>)",
|
7
|
+
"a7d296592458eeca06710ae946e4ba43": "(Web page content: UAM - Escuela Politécnica Superior Acceder al contenido principal Acceder al menú principal '>Formulario de contacto '>La UAM INTRANET UAM INTRANET UAM PORTAL DEL EMPLEADO Otros Servicios online Correo Web Direcciones funcionales Envío de SMS Fotomatón (PAS y PDI) Listas de correo Tramitador Intranet Secretaría General Logo EPS Buscador Buscar Biblioteca de la EPS Directorio UAM Intranet EPS English Menú principal La Escuela Presentación Medidas COVID-19 Estructura y Organización Directorio Sistema de Garantía Interno de Calidad (SGIC) Medios Materiales e Infraestructuras Normativa y Procedimientos Museo Premios EPS Mujeres e Ingeniería Actividades pre-universitarias Noticias Agenda Avisos Servicios Localización Departamentos Ingeniería Informática Tecnología Electrónica y de las Comunicaciones Estudios Grado Máster Programas Académicos Grado+Máster Doctorado Enseñanzas propias de la UAM Docencia en Otras Titulaciones Repositorio de Guías Docentes Estudiantes Asuntos Académico-Administrativos Noticias y Actividades Plan de Acción Tutelar Representación de Estudiantes Asociaciones de Estudiantes Recursos On Line Becas y Empleo Estatuto del Estudiante Investigación Grupos de Investigación y áreas de conocimiento Seminarios de Investigación Seminarios de Divulgación Memorias de Investigación Cátedras de Patrocinio UAM-Entidad Nuevos Estudiantes Razones para estudiar en la EPS Presentación de titulaciones Bienvenidos a la EPS Acceso a los Estudios Matrícula Admitidos a 1º Curso Internacional Oficina de Relaciones Internacionales (ORI) Incoming Students ( Estudiantes Entrantes) CIVIS: A European Civic University Estudiantes de la EPS Coordinadores de Movilidad Prácticas Internacionales Oficina de Prácticas Prácticas Curriculares Prácticas Extracurriculares Prácticas en cooperación al desarrollo Escuela Politécnica Superior Formamos Ingenieros Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieros Estudios Grado en Ingeniería Biomédica Grado en Ciencia e Ingeniería de Datos Grado en Ingeniería Informática (EURO-INF®) Grado en Ingeniería de Tecnologías y Servicios de Telecomunicación (EUR-ACE®) Doble Grado en Ingeniería Informática y Matemáticas Máster Universitario en Ciencia de Datos Máster Universitario en Deep Learning for Audio and Video Signal Processing Máster Universitario en Ingeniería Informática Máster Universitario en Ingeniería de Telecomunicación (EUR-ACE®) Máster Universitario en Investigación e Innovación en Inteligencia Computacional y Sistemas Interactivos Máster Universitario en Image Processing and Computer Vision Doctorado Ing. Informática y Telecomunicación RD2011 (Escuela de Doctorado de la UAM) Máster Universitario en Sistemas Interactivos Inteligentes Máster Universitario en Bioinformática y Biología Computacional (Facultad de Medicina) Más estudios Te interesa Biblioteca de la EPS Oficina de Cooperación UAM Consulta de expedientes Plan de Acción Tutelar Becas de excelencia Noticias de la UAM Servicios Seguro escolar Avisos La UAM con Ucrania> Convocatoria SICUE> El próximo 13 de febrero se abre el plazo para la presentación de solicitudes de la Convocatoria SICUE. Podrás realizar un intercambio, de uno o dos semestres, a otra universidad española. Más avisos Noticias 11/02/2025 La Biblioteca de la EPS lanza la exposición virtual permanente “Mujeres en las TIC” 05/02/2025 Rubén Tolosana Moranchel recibe el premio \"Juan López de Peñalver (2024)\" por la Real Academia de Ingeniería 03/02/2025 Director de relaciones internacionale de TELECOM Nancy nos ha visitado Inteligencia Artificial: innovaciones que transforman el mundo 05/12/2024 Investigadores de la EPS participan en el lanzamiento del proyecto LPI para impulsar la astronomía cuántica Más noticias Eventos destacados Seminario \"Breaking the limits of the standard model of vision\" Día: 18/03/2025 Hora de celebración: 16:00h Ponente: Dr. Marcelo Bertalmío Seminario \"Welfare Technology in Norway\" Día: 31/03/2025 Hora de celebración: 17:00h Ponente: Dr Bong Way Kiat Más eventos Agenda null Accesibilidad Aviso legal Mapa web Contacto Cómo llegar Síguenos en Escuela Politécnica Superior | Universidad Autónoma de Madrid | Francisco Tomás y Valiente, 11 | 28049 Madrid | Tel.: +34 91 497 2222 | e-mail: informacion.eps@uam.es Esta web utiliza cookies analíticas de terceros para facilitar la navegación y obtener información de uso de sus visitantes. Si continúa navegando, consideraremos que acepta su uso. Puede obtener más información en nuestra política de cookies. XImage description 0: (Image description: The image features a logo with a stylized building design in blue and orange, accompanied by the text \"Escuela Politécnica Superior.\" Below, there is a green curved line with yellow elements resembling flowers.) Image description 1: (Image description: The image features the logo of \"Universidad Autónoma de Madrid,\" abbreviated as \"UAM.\" The design is simple, primarily in gray, with a modern and clean font.) Image description 2: (Image description: The image features the word \"excelencia\" prominently, accompanied by \"UAM\" and \"CSIC\" in a stylized font. It appears to represent an academic or research institution. The color scheme is monochromatic, focusing on shades of gray.) Image description 3: (Image description: The image is completely blank and white.) Image description 4: (Image description: The image is entirely blank and white, with no discernible features or characteristics.) Image description 5: (Image description: The image is a simple solid brown circle on a green background.) Image description 6: (Image description: The image is blank or empty, showing no discernible features or content.) Image description 7: (Image description: The image is a plain white circular shape with no additional details or features.) Image description 8: (Image description: It appears to be a blank or empty image with no visible content.) Image description 9: (Image description: The image features a series of four vertical panels, each displaying a different scene. The first panel shows a building, the second reflects a modern architectural structure, the third highlights a circuit board, and the fourth features a computer keyboard. The overall color tone is warm and sepia-like.) Image description 10: (Image description: The image shows two young women focused on computer screens in a bright, modern workspace. One woman is wearing glasses and is sitting in profile, while the other is slightly further back, engaged with her own screen.) Image description 11: (Image description: The image features four people standing together. Two are wearing formal attire, while the others are in dresses. They are holding folders and appear to be in a formal setting, possibly during a ceremony or event. The background includes draped fabric and decorative elements.) Image description 12: (Image description: The image shows a blue chalkboard with the word \"Hello!\" written on it. In front of the chalkboard, there is a small yellow object and a black item on a wooden surface.) Image description 13: (Image description: The image shows a conference or meeting setting with a podium and a screen displaying a presentation. There are several rows of blue chairs filled with people facing the front. The background includes a banner and a few flags.) Image description 14: (Image description: The image shows a group of people posing together on steps in front of a large building. They appear to be smiling and dressed in formal or semi-formal attire. The building has classical architectural features, including columns.) Image description 15: (Image description: The image features a group of people sitting on the grass in a park, engaged in conversation. Text on the left promotes \"micro-titles\" offered by a university, highlighting a short training program. The overall tone is inviting and educational.) Image description 16: (Image description: The image features a logo with a stylized letter \"U\" in red, yellow, and blue stripes, alongside the text \"Universidades Españolas con UCRANIA.\" The design emphasizes a connection between Spanish universities and Ukraine.) Image description 17: (Image description: The image features a text layout with a question mark symbol. It includes the phrases \"Buzón de preguntas\" and \"Modificación Grado Ing. Informática,\" indicating a feedback or inquiry box related to modifications in a Computer Engineering program. The text uses a mix of colors, with the question mark in red and other text in gray and brown.) Image description 18: (Image description: The image outlines academic programs, highlighting the combination of a bachelor's degree (Grado) and a master's degree (Máster), along with a professional qualification (Ingeniería Técnica). It includes information about credit requirements (ECTS) for each program.) Image description 19: (Image description: The image features a simple logo with a light blue background. It includes the text \"Gestión Universitaria\" in a smaller font above the main word \"SIGMA,\" which is prominently displayed in larger letters.) Image description 20: (Image description: The image features a library setting with bookshelves and people reading or studying. The text \"Biblioteca EPS\" indicates it is likely a library associated with an educational institution. A circular sign above suggests a focus on reading.) Image description 21: (Image description: The image shows a close-up of a person's hands working with electronic components, possibly assembling or repairing a device. The text on the right reads \"Becas de la UAM,\" indicating scholarships from UAM (Universidad Autónoma de Madrid).) Image description 22: (Image description: The image features a red mailbox icon with a smiling face. It includes the text \"Buzón de quejas y sugerencias,\" which translates to \"Mailbox for complaints and suggestions,\" along with an email symbol and a note indicating it is for electronic submissions.) Image description 23: (Image description: The image features the word \"ALUMNIUAM\" in green, accompanied by colorful square shapes in various colors. Below, it has the phrase \"¡Soy de la Autonómal!\" in a smaller font. The overall design is modern and vibrant, suggesting a connection to alumni or a university community.) Image description 24: (Image description: The image features the logo of \"CIVIS,\" Europe's Civic University Alliance. It includes the word \"civis\" in a modern font, accompanied by colorful circles of varying sizes and shades scattered around the text. Below the logo, it states \"Europe's Civic University Alliance.\") Image description 25: (Image description: The image shows the Instagram logo, which features a simple camera icon within a square shape, with a gradient background of purple, pink, and orange colors.) Image description 26: (Image description: The image features the YouTube logo, which consists of the word \"YouTube\" in black text on a red rectangle.) Image description 27: (Image description: The image features the Facebook logo, which consists of a stylized lowercase \"f\" in white on a blue background. The design is simple and recognizable.) Image description 28: (Image description: I can't see the image. Please describe it or provide more details!) Image description 29: (Image description: The image features an orange RSS feed icon, characterized by a series of curved lines representing radio waves and a small circle, commonly used to indicate content feeds.) >>)",
|
8
|
+
"751917b1b3d9c81358299d9d7f13291e": "(Web page content: UAM - Escuela Politécnica Superior Acceder al contenido principal Acceder al menú principal '>Formulario de contacto '>La UAM INTRANET UAM INTRANET UAM PORTAL DEL EMPLEADO Otros Servicios online Correo Web Direcciones funcionales Envío de SMS Fotomatón (PAS y PDI) Listas de correo Tramitador Intranet Secretaría General Logo EPS Buscador Buscar Biblioteca de la EPS Directorio UAM Intranet EPS English Menú principal La Escuela Presentación Medidas COVID-19 Estructura y Organización Directorio Sistema de Garantía Interno de Calidad (SGIC) Medios Materiales e Infraestructuras Normativa y Procedimientos Museo Premios EPS Mujeres e Ingeniería Actividades pre-universitarias Noticias Agenda Avisos Servicios Localización Departamentos Ingeniería Informática Tecnología Electrónica y de las Comunicaciones Estudios Grado Máster Programas Académicos Grado+Máster Doctorado Enseñanzas propias de la UAM Docencia en Otras Titulaciones Repositorio de Guías Docentes Estudiantes Asuntos Académico-Administrativos Noticias y Actividades Plan de Acción Tutelar Representación de Estudiantes Asociaciones de Estudiantes Recursos On Line Becas y Empleo Estatuto del Estudiante Investigación Grupos de Investigación y áreas de conocimiento Seminarios de Investigación Seminarios de Divulgación Memorias de Investigación Cátedras de Patrocinio UAM-Entidad Nuevos Estudiantes Razones para estudiar en la EPS Presentación de titulaciones Bienvenidos a la EPS Acceso a los Estudios Matrícula Admitidos a 1º Curso Internacional Oficina de Relaciones Internacionales (ORI) Incoming Students ( Estudiantes Entrantes) CIVIS: A European Civic University Estudiantes de la EPS Coordinadores de Movilidad Prácticas Internacionales Oficina de Prácticas Prácticas Curriculares Prácticas Extracurriculares Prácticas en cooperación al desarrollo Escuela Politécnica Superior Formamos Ingenieros Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieros Estudios Grado en Ingeniería Biomédica Grado en Ciencia e Ingeniería de Datos Grado en Ingeniería Informática (EURO-INF®) Grado en Ingeniería de Tecnologías y Servicios de Telecomunicación (EUR-ACE®) Doble Grado en Ingeniería Informática y Matemáticas Máster Universitario en Ciencia de Datos Máster Universitario en Deep Learning for Audio and Video Signal Processing Máster Universitario en Ingeniería Informática Máster Universitario en Ingeniería de Telecomunicación (EUR-ACE®) Máster Universitario en Investigación e Innovación en Inteligencia Computacional y Sistemas Interactivos Máster Universitario en Image Processing and Computer Vision Doctorado Ing. Informática y Telecomunicación RD2011 (Escuela de Doctorado de la UAM) Máster Universitario en Sistemas Interactivos Inteligentes Máster Universitario en Bioinformática y Biología Computacional (Facultad de Medicina) Más estudios Te interesa Biblioteca de la EPS Oficina de Cooperación UAM Consulta de expedientes Plan de Acción Tutelar Becas de excelencia Noticias de la UAM Servicios Seguro escolar Avisos La UAM con Ucrania> Convocatoria SICUE> El próximo 13 de febrero se abre el plazo para la presentación de solicitudes de la Convocatoria SICUE. Podrás realizar un intercambio, de uno o dos semestres, a otra universidad española. Más avisos Noticias 11/02/2025 La Biblioteca de la EPS lanza la exposición virtual permanente “Mujeres en las TIC” 05/02/2025 Rubén Tolosana Moranchel recibe el premio \"Juan López de Peñalver (2024)\" por la Real Academia de Ingeniería 03/02/2025 Director de relaciones internacionale de TELECOM Nancy nos ha visitado Inteligencia Artificial: innovaciones que transforman el mundo 05/12/2024 Investigadores de la EPS participan en el lanzamiento del proyecto LPI para impulsar la astronomía cuántica Más noticias Eventos destacados Seminario \"Breaking the limits of the standard model of vision\" Día: 18/03/2025 Hora de celebración: 16:00h Ponente: Dr. Marcelo Bertalmío Seminario \"Welfare Technology in Norway\" Día: 31/03/2025 Hora de celebración: 17:00h Ponente: Dr Bong Way Kiat Más eventos Agenda null Accesibilidad Aviso legal Mapa web Contacto Cómo llegar Síguenos en Escuela Politécnica Superior | Universidad Autónoma de Madrid | Francisco Tomás y Valiente, 11 | 28049 Madrid | Tel.: +34 91 497 2222 | e-mail: informacion.eps@uam.es Esta web utiliza cookies analíticas de terceros para facilitar la navegación y obtener información de uso de sus visitantes. Si continúa navegando, consideraremos que acepta su uso. Puede obtener más información en nuestra política de cookies. XImage description 0: (Image description: The image features a logo with a stylized representation of a building in blue and orange, accompanied by a green arch with yellow elements. The text \"Escuela Politécnica Superior\" is displayed to the right in a modern font.) Image description 1: (Image description: The image features the logo of \"Universidad Autónoma de Madrid\" (UAM), displaying the initials \"UAM\" prominently, along with the full name of the university in smaller text below. The design is simple and uses a monochromatic color scheme.) Image description 2: (Image description: The image features the word \"excelencia\" prominently, alongside the abbreviations \"UAM\" and \"CSIC,\" suggesting a focus on excellence in an academic or research context. The design is simple and text-based, primarily in grayscale.) Image description 3: (Image description: The image is completely blank and white.) Image description 4: (Image description: The image is completely blank, with no visible features or characteristics.) Image description 5: (Image description: The image is a simple, solid color circle with a brown hue set against a green background.) Image description 6: (Image description: The image is a plain white circle with no distinguishing features or details.) Image description 7: (Image description: The image appears to be a simple, plain white circle with no distinct features or details.) Image description 8: (Image description: It appears to be a blank or empty image, with no identifiable features or characteristics.) Image description 9: (Image description: The image features a series of four vertical panels in a sepia tone. The leftmost panel shows a building, the next presents another architectural structure, followed by a close-up of a circuit board, and the last panel displays a computer keyboard. The overall composition has a modern and technological feel.) Image description 10: (Image description: The image shows three individuals sitting at computer desks in a bright room. Two of them are focused on their screens, while one person is partially visible in the background. The desks have computers, and the setting appears to be a study or classroom environment.) Image description 11: (Image description: The image features four individuals standing together, two women and two men. They appear to be in a formal setting, with one woman wearing a blue dress and the other in a dark outfit. The men are dressed in suits. They are holding documents or folders and are positioned in front of a decorative backdrop.) Image description 12: (Image description: The image shows a blue chalkboard with the word \"Hello!\" written on it in white chalk. A small yellow object is placed on a wooden desk in front of the board. The setting appears to be a classroom.) Image description 13: (Image description: The image shows a conference or meeting setting with a group of people seated in rows. There is a presentation screen displaying information, and a speaker at a podium in front of the audience. The room has a simple layout and appears to be well-lit.) Image description 14: (Image description: The image shows a group of people posing for a photo in front of a large building with columns. They appear to be gathered on steps, smiling and looking at the camera. The setting is outdoors, with clear blue skies.) Image description 15: (Image description: The image features a group of people sitting on grass in a park. It promotes a program for micro-credentials, highlighting flexibility and a short duration of study. The text is in Spanish, encouraging viewers to discover more about the educational offerings.) Image description 16: (Image description: The image features a logo with a stylized \"U\" made up of red, yellow, and blue stripes. Next to it is the text \"Universidades Españolas con UCRANIA,\" indicating a connection between Spanish universities and Ukraine.) Image description 17: (Image description: The image features a text design with the following elements: \"Buzón de preguntas\" (Question Box) at the top, followed by \"Modificación Grado Ing. Informática\" (Modification Degree in Computer Engineering) in a bold font. A red question mark is included, emphasizing inquiry or questions. The color scheme includes gray, brown, and red.) Image description 18: (Image description: The image illustrates academic programs, highlighting the combination of a Bachelor's degree (Grado) and a Master's degree (Máster) for professional qualification. It includes information on credit requirements for each program. The design features orange and brown elements, with a clear layout showing the relationship between degrees and professional qualifications.) Image description 19: (Image description: The image features a simple design with a light blue background. It includes the text \"Gestión Universitaria\" at the top and \"SIGMA\" prominently displayed below it. The font is modern and clean.) Image description 20: (Image description: The image shows a library interior with shelves of books and people reading or studying. There's a sign that says \"Biblioteca EPS\" and a green circular sign with the word \"Lectura.\" The atmosphere appears calm and focused.) Image description 21: (Image description: The image features a close-up of a person's hands working on a device, possibly a robot, with visible electronic components. There is also text that reads \"Becas de la UAM,\" indicating a scholarship program related to UAM.) Image description 22: (Image description: The image features a red mailbox with an at symbol (@) and icons representing complaints and suggestions. It includes text that reads \"Buzón de quejas y sugerencias,\" indicating a suggestion and complaint box.) Image description 23: (Image description: The image features the word \"ALUMNIUAM\" in green, accompanied by the phrase \"¡Soy de la Autonómal!\" in a smaller font. There are colorful square outlines in the background, adding a vibrant touch. The overall design suggests an alumni association theme.) Image description 24: (Image description: The image features a logo for \"civis,\" representing Europe's Civic University Alliance. It includes the word \"civis\" in a modern font, with varying colorful circles surrounding the text. The tagline \"Europe's Civic University Alliance\" is positioned below the main text.) Image description 25: (Image description: The image shows the Instagram logo, which features a camera icon with a gradient background of purple, pink, and orange.) Image description 26: (Image description: The image features the YouTube logo, which consists of the word \"YouTube\" in a bold font, with \"You\" in black and \"Tube\" in white against a red play button background.) Image description 27: (Image description: The image is a small logo of Facebook, featuring a white lowercase \"f\" on a blue background.) Image description 28: (Image description: I'm unable to see the image you're referring to. Please describe it, and I can help you with information or context!) Image description 29: (Image description: The image features an orange RSS feed icon. It consists of a series of curved lines radiating from a small circle, symbolizing the broadcasting of information.) >>)",
|
9
|
+
"75f2ad1c0206d75ecfe9204658fa6e4f": "(Web page content: UAM - Escuela Politécnica Superior Acceder al contenido principal Acceder al menú principal '>Formulario de contacto '>La UAM INTRANET UAM INTRANET UAM PORTAL DEL EMPLEADO Otros Servicios online Correo Web Direcciones funcionales Envío de SMS Fotomatón (PAS y PDI) Listas de correo Tramitador Intranet Secretaría General Logo EPS Buscador Buscar Biblioteca de la EPS Directorio UAM Intranet EPS English Menú principal La Escuela Presentación Medidas COVID-19 Estructura y Organización Directorio Sistema de Garantía Interno de Calidad (SGIC) Medios Materiales e Infraestructuras Normativa y Procedimientos Museo Premios EPS Mujeres e Ingeniería Actividades pre-universitarias Noticias Agenda Avisos Servicios Localización Departamentos Ingeniería Informática Tecnología Electrónica y de las Comunicaciones Estudios Grado Máster Programas Académicos Grado+Máster Doctorado Enseñanzas propias de la UAM Docencia en Otras Titulaciones Repositorio de Guías Docentes Estudiantes Asuntos Académico-Administrativos Noticias y Actividades Plan de Acción Tutelar Representación de Estudiantes Asociaciones de Estudiantes Recursos On Line Becas y Empleo Estatuto del Estudiante Investigación Grupos de Investigación y áreas de conocimiento Seminarios de Investigación Seminarios de Divulgación Memorias de Investigación Cátedras de Patrocinio UAM-Entidad Nuevos Estudiantes Razones para estudiar en la EPS Presentación de titulaciones Bienvenidos a la EPS Acceso a los Estudios Matrícula Admitidos a 1º Curso Internacional Oficina de Relaciones Internacionales (ORI) Incoming Students ( Estudiantes Entrantes) CIVIS: A European Civic University Estudiantes de la EPS Coordinadores de Movilidad Prácticas Internacionales Oficina de Prácticas Prácticas Curriculares Prácticas Extracurriculares Prácticas en cooperación al desarrollo Escuela Politécnica Superior Formamos Ingenieros Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieros Estudios Grado en Ingeniería Biomédica Grado en Ciencia e Ingeniería de Datos Grado en Ingeniería Informática (EURO-INF®) Grado en Ingeniería de Tecnologías y Servicios de Telecomunicación (EUR-ACE®) Doble Grado en Ingeniería Informática y Matemáticas Máster Universitario en Ciencia de Datos Máster Universitario en Deep Learning for Audio and Video Signal Processing Máster Universitario en Ingeniería Informática Máster Universitario en Ingeniería de Telecomunicación (EUR-ACE®) Máster Universitario en Investigación e Innovación en Inteligencia Computacional y Sistemas Interactivos Máster Universitario en Image Processing and Computer Vision Doctorado Ing. Informática y Telecomunicación RD2011 (Escuela de Doctorado de la UAM) Máster Universitario en Sistemas Interactivos Inteligentes Máster Universitario en Bioinformática y Biología Computacional (Facultad de Medicina) Más estudios Te interesa Biblioteca de la EPS Oficina de Cooperación UAM Consulta de expedientes Plan de Acción Tutelar Becas de excelencia Noticias de la UAM Servicios Seguro escolar Avisos La UAM con Ucrania> Convocatoria SICUE> El próximo 13 de febrero se abre el plazo para la presentación de solicitudes de la Convocatoria SICUE. Podrás realizar un intercambio, de uno o dos semestres, a otra universidad española. Más avisos Noticias 11/02/2025 La Biblioteca de la EPS lanza la exposición virtual permanente “Mujeres en las TIC” 05/02/2025 Rubén Tolosana Moranchel recibe el premio \"Juan López de Peñalver (2024)\" por la Real Academia de Ingeniería 03/02/2025 Director de relaciones internacionale de TELECOM Nancy nos ha visitado Inteligencia Artificial: innovaciones que transforman el mundo 05/12/2024 Investigadores de la EPS participan en el lanzamiento del proyecto LPI para impulsar la astronomía cuántica Más noticias Eventos destacados Seminario \"Breaking the limits of the standard model of vision\" Día: 18/03/2025 Hora de celebración: 16:00h Ponente: Dr. Marcelo Bertalmío Seminario \"Welfare Technology in Norway\" Día: 31/03/2025 Hora de celebración: 17:00h Ponente: Dr Bong Way Kiat Más eventos Agenda null Accesibilidad Aviso legal Mapa web Contacto Cómo llegar Síguenos en Escuela Politécnica Superior | Universidad Autónoma de Madrid | Francisco Tomás y Valiente, 11 | 28049 Madrid | Tel.: +34 91 497 2222 | e-mail: informacion.eps@uam.es Esta web utiliza cookies analíticas de terceros para facilitar la navegación y obtener información de uso de sus visitantes. Si continúa navegando, consideraremos que acepta su uso. Puede obtener más información en nuestra política de cookies. XImage description 0: (Image description: The image features a logo for \"Escuela Politécnica Superior.\" It includes a stylized building design with blue and orange elements, set above a green curve with yellow flower-like shapes. The text is presented in a clean, modern font.) Image description 1: (Image description: The image features the logo of \"Universidad Autónoma de Madrid,\" abbreviated as \"UAM.\" The design is simple and predominantly in gray tones.) Image description 2: (Image description: The image features the word \"excelencia\" prominently, along with the acronyms \"UAM\" and \"CSIC,\" suggesting a focus on academic or research excellence. The overall design is minimalistic and uses a monochromatic color scheme.) Image description 3: (Image description: The image is completely blank and white, with no discernible features or elements.) Image description 4: (Image description: The image is completely blank with a white background.) Image description 5: (Image description: The image features a solid brown circular shape set against a green background.) Image description 6: (Image description: It appears to be a blank or empty image with no visible characteristics.) Image description 7: (Image description: It appears that no image is provided for description. Please upload an image for me to describe.) Image description 8: (Image description: The image is a plain white circle with no distinct features or markings.) Image description 9: (Image description: The image features a series of four vertical panels with a warm, sepia tone. The first panel shows a building, the second depicts a modern structure with glass, the third highlights a circuit board, and the fourth displays a computer keyboard. The overall design has a reflective quality at the bottom.) Image description 10: (Image description: The image shows several individuals working at computers in a bright, modern setting. Two people are prominently visible, focused on their screens, while others are in the background. The environment appears to be a classroom or computer lab.) Image description 11: (Image description: The image features four individuals standing together, two women and two men. They are dressed in formal attire, holding documents or folders. The setting appears to be an elegant indoor space with decorative curtains in the background.) Image description 12: (Image description: The image shows a chalkboard with the word \"Hello!\" written on it. In front of the chalkboard, there is a desk with a yellow object and what appears to be a black item. The background suggests a classroom setting.) Image description 13: (Image description: The image shows a conference room setting with several rows of blue chairs. A presentation is taking place at the front, where a speaker is addressing an audience. There are screens displaying content, and a banner is visible on the wall.) Image description 14: (Image description: The image shows a large group of people posing together on steps in front of a building. They are dressed in formal or semi-formal attire and appear to be smiling or looking at the camera. The background features architectural elements, suggesting a significant or official location.) Image description 15: (Image description: The image features a group of people sitting together on grass, engaged in conversation. The background includes trees and a sunny outdoor setting. There is promotional text about micro-credentials from a university, highlighting a short-duration training program.) Image description 16: (Image description: The image features a logo with stylized red, yellow, and blue bars forming a \"U\" shape, accompanied by the text \"Universidades Españolas con UCRANIA.\" The design emphasizes a connection between Spanish universities and Ukraine.) Image description 17: (Image description: The image features a text graphic with the title \"Buzón de preguntas\" (Question Box) and \"Modificación Grado Ing. Informática\" (Modification Degree in Computer Engineering). It includes a large red question mark and uses a combination of grey and brown text colors.) Image description 18: (Image description: The image presents a diagram explaining academic programs. It highlights two main components: \"Grado\" (Bachelor's degree, 240 ECTS) and \"Máster\" (Master's degree, 72-90 ECTS). It indicates a pathway leading to professional qualification as an \"Ingeniero Técnico\" (Technical Engineer). The title reads \"Programas Académicos.\") Image description 19: (Image description: The image features a blue background with the text \"Gestión Universitaria\" above the word \"SIGMA.\" The design is simple and clean, focusing on the brand name.) Image description 20: (Image description: The image features a library interior with bookshelves and people reading or studying. The text \"Biblioteca EPS\" is prominently displayed, indicating the library's name. There's a circular sign above that says \"Lectura.\") Image description 21: (Image description: The image shows a close-up of a person's hands working on a device, likely related to technology or robotics. The text on the right reads \"Becas de la UAM,\" indicating scholarships from a university.) Image description 22: (Image description: The image features a red mailbox with a smiley face, accompanied by text that reads \"Buzón de quejas y sugerencias,\" which translates to \"Mailbox for complaints and suggestions.\" There is also an email symbol and the phrase \"Sede electrónica.\") Image description 23: (Image description: The image features the word \"ALUMNIUAM\" in bold green letters, accompanied by a colorful design of overlapping squares in various colors. Below it, there's a phrase in Spanish that translates to \"I am from the Autonomous [University]!\" The overall design is bright and modern.) Image description 24: (Image description: The image features a logo for \"CIVIS,\" which represents Europe's Civic University Alliance. The logo includes the word \"civis\" in lowercase letters with a modern font, accompanied by colorful circles of varying sizes and colors, adding a vibrant and dynamic feel. Below the logo, it states \"Europe's Civic University Alliance\" in smaller text.) Image description 25: (Image description: The image features the Instagram logo, which consists of a simplified camera icon within a square. The background transitions from purple to orange, giving it a vibrant, gradient look.) Image description 26: (Image description: The image features the YouTube logo, which consists of the word \"YouTube\" in a bold font, with \"You\" in black and \"Tube\" in white against a red play button background.) Image description 27: (Image description: The image features the Facebook logo, which consists of a stylized lowercase \"f\" in white on a blue background.) Image description 28: (Image description: I can't see the image, so I'm unable to provide a description. If you can describe it to me, I can help with analysis or information related to it!) Image description 29: (Image description: The image features an orange RSS feed icon, which typically consists of a series of curved lines above a small dot, symbolizing the dissemination of content or updates.) >>)",
|
10
|
+
"88ccceb017eec62619a492bc18c17699": "(Web page content: UAM - Escuela Politécnica Superior Acceder al contenido principal Acceder al menú principal '>Formulario de contacto '>La UAM INTRANET UAM INTRANET UAM PORTAL DEL EMPLEADO Otros Servicios online Correo Web Direcciones funcionales Envío de SMS Fotomatón (PAS y PDI) Listas de correo Tramitador Intranet Secretaría General Logo EPS Buscador Buscar Biblioteca de la EPS Directorio UAM Intranet EPS English Menú principal La Escuela Presentación Medidas COVID-19 Estructura y Organización Directorio Sistema de Garantía Interno de Calidad (SGIC) Medios Materiales e Infraestructuras Normativa y Procedimientos Museo Premios EPS Mujeres e Ingeniería Actividades pre-universitarias Noticias Agenda Avisos Servicios Localización Departamentos Ingeniería Informática Tecnología Electrónica y de las Comunicaciones Estudios Grado Máster Programas Académicos Grado+Máster Doctorado Enseñanzas propias de la UAM Docencia en Otras Titulaciones Repositorio de Guías Docentes Estudiantes Asuntos Académico-Administrativos Noticias y Actividades Plan de Acción Tutelar Representación de Estudiantes Asociaciones de Estudiantes Recursos On Line Becas y Empleo Estatuto del Estudiante Investigación Grupos de Investigación y áreas de conocimiento Seminarios de Investigación Seminarios de Divulgación Memorias de Investigación Cátedras de Patrocinio UAM-Entidad Nuevos Estudiantes Razones para estudiar en la EPS Presentación de titulaciones Bienvenidos a la EPS Acceso a los Estudios Matrícula Admitidos a 1º Curso Internacional Oficina de Relaciones Internacionales (ORI) Incoming Students ( Estudiantes Entrantes) CIVIS: A European Civic University Estudiantes de la EPS Coordinadores de Movilidad Prácticas Internacionales Oficina de Prácticas Prácticas Curriculares Prácticas Extracurriculares Prácticas en cooperación al desarrollo Escuela Politécnica Superior Formamos Ingenieros Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieras Escuela Politécnica Superior Formamos Ingenieros Estudios Grado en Ingeniería Biomédica Grado en Ciencia e Ingeniería de Datos Grado en Ingeniería Informática (EURO-INF®) Grado en Ingeniería de Tecnologías y Servicios de Telecomunicación (EUR-ACE®) Doble Grado en Ingeniería Informática y Matemáticas Máster Universitario en Ciencia de Datos Máster Universitario en Deep Learning for Audio and Video Signal Processing Máster Universitario en Ingeniería Informática Máster Universitario en Ingeniería de Telecomunicación (EUR-ACE®) Máster Universitario en Investigación e Innovación en Inteligencia Computacional y Sistemas Interactivos Máster Universitario en Image Processing and Computer Vision Doctorado Ing. Informática y Telecomunicación RD2011 (Escuela de Doctorado de la UAM) Máster Universitario en Sistemas Interactivos Inteligentes Máster Universitario en Bioinformática y Biología Computacional (Facultad de Medicina) Más estudios Te interesa Biblioteca de la EPS Oficina de Cooperación UAM Consulta de expedientes Plan de Acción Tutelar Becas de excelencia Noticias de la UAM Servicios Seguro escolar Avisos La UAM con Ucrania> Convocatoria SICUE> El próximo 13 de febrero se abre el plazo para la presentación de solicitudes de la Convocatoria SICUE. Podrás realizar un intercambio, de uno o dos semestres, a otra universidad española. Más avisos Noticias 11/02/2025 La Biblioteca de la EPS lanza la exposición virtual permanente “Mujeres en las TIC” 05/02/2025 Rubén Tolosana Moranchel recibe el premio \"Juan López de Peñalver (2024)\" por la Real Academia de Ingeniería 03/02/2025 Director de relaciones internacionale de TELECOM Nancy nos ha visitado Inteligencia Artificial: innovaciones que transforman el mundo 05/12/2024 Investigadores de la EPS participan en el lanzamiento del proyecto LPI para impulsar la astronomía cuántica Más noticias Eventos destacados Seminario \"Breaking the limits of the standard model of vision\" Día: 18/03/2025 Hora de celebración: 16:00h Ponente: Dr. Marcelo Bertalmío Seminario \"Welfare Technology in Norway\" Día: 31/03/2025 Hora de celebración: 17:00h Ponente: Dr Bong Way Kiat Más eventos Agenda null Accesibilidad Aviso legal Mapa web Contacto Cómo llegar Síguenos en Escuela Politécnica Superior | Universidad Autónoma de Madrid | Francisco Tomás y Valiente, 11 | 28049 Madrid | Tel.: +34 91 497 2222 | e-mail: informacion.eps@uam.es Esta web utiliza cookies analíticas de terceros para facilitar la navegación y obtener información de uso de sus visitantes. Si continúa navegando, consideraremos que acepta su uso. Puede obtener más información en nuestra política de cookies. XImage description 0: (Image description: The image features a logo with a stylized building design in blue and orange, accompanied by the text \"Escuela Politécnica Superior.\" There are green curved lines and yellow elements at the bottom, suggesting a vibrant and educational theme.) Image description 1: (Image description: The image features the logo of \"Universidad Autónoma de Madrid,\" abbreviated as \"UAM.\" The design is simple and includes both the acronym and the full name in a gray color scheme.) Image description 2: (Image description: The image features the text \"excelencia\" prominently, accompanied by \"UAM\" and \"CSIC\" in a smaller font. It appears to represent an initiative or program related to excellence, possibly in an academic or research context. The overall design is simple and professional.) Image description 3: (Image description: The image is completely blank and white with no visible features or details.) Image description 4: (Image description: The image is entirely blank and white.) Image description 5: (Image description: The image is a solid brown circle with a simple design.) Image description 6: (Image description: I can't see the image, so I'm unable to describe it. If you provide details, I can help summarize or discuss them!) Image description 7: (Image description: The image is a plain white circle on a neutral background.) Image description 8: (Image description: I'm unable to see images, so I can't provide a description. If you describe the image, I can help with information or context!) Image description 9: (Image description: The image features a series of five vertical panels. The first two panels show buildings, suggesting an architectural theme. The third panel displays a close-up of a surface, possibly a control board or circuit. The last panel shows a computer keyboard. The overall color tone is warm and sepia-like.) Image description 10: (Image description: The image shows two individuals sitting at computers in a classroom or study space. One person is in the foreground, wearing glasses and focused on the screen, while another person is visible in the background. The setting appears bright and modern.) Image description 11: (Image description: The image shows four people standing together. Two women are on the left, one wearing a blue dress. The two men on the right are in formal attire. They are holding documents or folders and are positioned in front of a decorative background.) Image description 12: (Image description: The image shows a chalkboard with the word \"Hello!\" written on it. In front of the board, there is a yellow object on a desk. The background is a classroom setting.) Image description 13: (Image description: The image shows a conference or meeting setting with a few speakers at a table in front and an audience seated in rows. There is a presentation screen displaying content, and the environment appears to be a formal indoor space.) Image description 14: (Image description: The image shows a group of people posing together on steps in front of a large building. They are dressed in formal or semi-formal attire and appear to be smiling or looking at the camera. The setting is bright, suggesting a clear day.) Image description 15: (Image description: The image features a promotional banner for micro-credentials offered by Universidad Autónoma de Madrid (UAM). It includes text highlighting the program's focus, encouraging discovery, and mentions a short-term course duration of 24 to 30 ECTS. In the background, a group of students is sitting on the grass in a park-like setting.) Image description 16: (Image description: The image features a logo with a stylized \"U\" in red, yellow, and blue stripes, alongside the text \"Universidades Españolas con UCRANIA.\" The design suggests a connection between Spanish universities and Ukraine.) Image description 17: (Image description: The image features text in Spanish, stating \"Buzón de preguntas\" (Question Box) and \"Modificación Grado Ing. Informática\" (Modification Degree in Computer Engineering). It includes a large red question mark. The text is presented in varying colors and sizes.) Image description 18: (Image description: The image outlines academic programs, highlighting the combination of a bachelor's degree (Grado) and a master's degree (Máster). It specifies the credits required for each program and indicates a professional qualification (Ingeniería técnica) associated with these degrees. The layout is simple, using orange and white colors.) Image description 19: (Image description: The image features a logo with a light blue background. It includes the text \"Gestión Universitaria\" at the top and \"SIGMA\" prominently displayed below in larger font.) Image description 20: (Image description: The image shows an interior of a library with shelves of books. There are people reading or studying. A sign with \"Biblioteca EPS\" is prominently displayed, indicating it is a library setting. The atmosphere appears quiet and conducive to reading.) Image description 21: (Image description: The image features a close-up of hands working with electronic components, likely assembling or repairing a device. On the right side, there is text in Spanish that reads \"Becas de la UAM,\" which translates to \"Scholarships from UAM.\") Image description 22: (Image description: The image features a red mailbox design with a smiling face icon. It includes the text \"Buzón de quejas y sugerencias\" and \"Sede electrónica,\" indicating a suggestions and complaints box, likely for electronic submissions.) Image description 23: (Image description: The image features the word \"ALUMNIUAM\" in large green letters, accompanied by the phrase \"¡Soy de la Autonómal!\" in smaller text. There are colorful, overlapping square outlines in the background.) Image description 24: (Image description: The image features the logo of \"CIVIS,\" which is described as Europe's Civic University Alliance. It includes the word \"civis\" in a modern font with varying colors and sizes of circles surrounding it, giving it a vibrant and dynamic look.) Image description 25: (Image description: The image is the Instagram logo, featuring a simplified camera icon within a square. The background has a gradient of colors from purple to orange.) Image description 26: (Image description: The image features the YouTube logo, which consists of the word \"YouTube\" in bold black letters on a red rectangle, with a white play button symbol integrated into the design.) Image description 27: (Image description: The image features the Facebook logo, which consists of a white lowercase \"f\" on a blue background. The design is simple and recognizable, often associated with social media.) Image description 28: (Image description: I'm unable to view images directly. If you describe the image, I can help with a brief explanation based on your description!) Image description 29: (Image description: The image features an orange RSS feed icon, which consists of a series of curved lines representing radio waves, along with a circular dot.) >>)",
|
11
|
+
"5471b59aa096bbd3dfb8cdd989f7f90a": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
12
|
+
"cff98d0f9cbb72a47ccfa8d98b11ffae": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
13
|
+
"e6280ee8035873c8de14732faa93d442": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
14
|
+
"87ec7f08f686f18bb7fd24d50c160455": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
15
|
+
"01fb334fd0f05c9b78a206c9e9206c5b": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
16
|
+
"b99986ad425d3768423104e514cae861": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
17
|
+
"febb7f108b0e0d96a2f3723462d3adae": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
18
|
+
"4e3fa98c3935846bde9659ac99484697": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
19
|
+
"41b3abe1fdb48750e007478ce2295503": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
20
|
+
"6a8c0b040c90f962bbc04a463242d47e": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
21
|
+
"9a0e1d103b505a81968f2b7d9c1e14f0": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
22
|
+
"d5560c525cd3d51073edfe26b12de423": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content Join us at Interrupt: The Agent AI Conference by LangChain on May 13 & 14 in San Francisco! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
23
|
+
"8ac55d0e62c5bec59080a0f1e2bf82ca": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
24
|
+
"32f050c457ffec557aa5e2ccbb89b78c": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
25
|
+
"9e0dd39592aeb68c41a0f88b558db873": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
26
|
+
"c5342297b6a7f2adc42f448e0e8ab133": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
27
|
+
"40138474d9109557d77be54d718800a1": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
28
|
+
"39bd7b0c8a83c8b0cfb5ccc528549b71": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
29
|
+
"010e37d7248f6627c51463aff5a56950": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
30
|
+
"52c26fd8f872292dcd5ebed775c4c57f": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
31
|
+
"dedc99e76d944b765bab702d09c3daaf": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
32
|
+
"cd5ea601deceef12e132315601dcdae7": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
33
|
+
"5e7779dc1bdb70e425d96360b80795b6": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
34
|
+
"fc1bf50a51ce22652c3443bf3e212a5b": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
35
|
+
"da6680fe715fc1298200ddc543660095": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
36
|
+
"ff77217116ab83b2182b62cd0449f657": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
37
|
+
"17f752df05dedc4a2cd98b441d04ea9e": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
38
|
+
"e2140f5c8907256a4a8791c18c339696": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
39
|
+
"89882ee6dbb36ed0ed42ab6a2e7f31f4": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
40
|
+
"ff7e50ee498b297141cfc9d91b71c4ba": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
41
|
+
"af241ca65c52418287572a6a13942ca3": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
42
|
+
"f0caf8a7c9b71f79bb5f1edd597cb4cd": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
43
|
+
"ea4f12366432b7c3cb6efbae27012e18": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
44
|
+
"232b3061c2a442019a26839a1a3da1c4": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
45
|
+
"55e7725ad107fae0de04dd8cba9ca6aa": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
46
|
+
"43b0b3738d801a8c9e6e4f58dfc3c213": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
47
|
+
"22751e20ecb8d8d129f6cd5a6b70b7de": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
48
|
+
"9c2e4a244de3acfc04c0a6d7d06f94ad": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
49
|
+
"1d2227882c119c2fbdc17e03fab7f29d": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
50
|
+
"0a18980a998ff5a9800e663bc19a5063": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
51
|
+
"c6aafc599c33c457d0707f860b0f83e2": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
52
|
+
"a94f133c4cf0d6b496c661cf678ee8cd": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
53
|
+
"50db09c4ebf235d5f9605cb56cf8db8c": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
54
|
+
"9cc128625f5f5f8c36be446b9c16a281": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
55
|
+
"9afa643f280d97b96c4e4dc605d5d7ea": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
56
|
+
"3c849a01a1a85fdb885babd136c3b4be": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
57
|
+
"d41bc49301f781348f75c074ba311101": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
58
|
+
"f1bf795b4068c6c57c65d374ec467ff6": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
59
|
+
"67e5d9e82718172744bf7419ae820409": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
60
|
+
"fa65c007326cc4bf4486206852ad1936": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
61
|
+
"019b8deaea11d1ddd8f344bf3128758d": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
62
|
+
"8422fd13191d56e202cc6d473c821aec": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
63
|
+
"7db6ca2bada3cbba02c58c711fedf6ab": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
64
|
+
"f458336dc7f4ee2790d006913e3eb281": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
65
|
+
"9d4841c76ffab4c30463ffc7718abd44": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)",
|
66
|
+
"6c51cd785bddb17921a1aa0b0c810032": "(Web page content: OUTPUT_PARSING_FAILURE | ü¶úÔ∏èüîó LangChain Skip to main content We are growing and hiring for multiple roles for LangChain, LangGraph and LangSmith. Join our team! An output parser was unable to handle model output as expected. To illustrate this, let's say you have an output parser that expects a chat model to output JSON surrounded by a markdown code tag (triple backticks). Here would be an example of good input: from langchain_core . messages import AIMessage from langchain_core . output_parsers import JsonOutputParser message = AIMessage ( content = '\\`\\`\\`\\n{\"foo\": \"bar\"}\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) API Reference: AIMessage | JsonOutputParser {'foo': 'bar'} Internally, our JSON parser stripped out the markdown fence and newlines and then ran json.loads . If instead the chat model generated an output with malformed JSON, we will get an error: message = AIMessage ( content = '\\`\\`\\`\\n{{\"foo\":\\n\\`\\`\\`' ) output_parser = JsonOutputParser ( ) output_parser . invoke ( message ) --------------------------------------------------------------------------- ``````output JSONDecodeError Traceback (most recent call last) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:83, in JsonOutputParser.parse_result(self, result, partial) 82 try: ---> 83 return parse_json_markdown(text) 84 except JSONDecodeError as e: ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:144, in parse_json_markdown(json_string, parser) 143 json_str = json_string if match is None else match.group(2) --> 144 return _parse_json(json_str, parser=parser) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:160, in _parse_json(json_str, parser) 159 # Parse the JSON string into a Python dictionary --> 160 return parser(json_str) ``````output File ~/langchain/oss-py/libs/core/langchain_core/utils/json.py:118, in parse_partial_json(s, strict) 115 # If we got here, we ran out of characters to remove 116 # and still couldn't parse the string as JSON, so return the parse error 117 # for the original string. --> 118 return json.loads(s, strict=strict) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 358 kw['parse_constant'] = parse_constant --> 359 return cls(**kw).decode(s) ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 \"\"\" --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ``````output File ~/.pyenv/versions/3.11.4/lib/python3.11/json/decoder.py:353, in JSONDecoder.raw_decode(self, s, idx) 352 try: --> 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: ``````output JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) ``````output The above exception was the direct cause of the following exception: ``````output OutputParserException Traceback (most recent call last) ``````output Cell In[9], line 3 1 message = AIMessage(content='```\\n{{\"foo\":\\n```') 2 output_parser = JsonOutputParser() ----> 3 output_parser.invoke(message) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:193, in BaseOutputParser.invoke(self, input, config, **kwargs) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): --> 193 return self._call_with_config( 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/base.py:1927, in Runnable._call_with_config(self, func, input, config, run_type, serialized, **kwargs) 1923 context = copy_context() 1924 context.run(_set_config_context, child_config) 1925 output = cast( 1926 Output, -> 1927 context.run( 1928 call_func_with_variable_args, # type: ignore[arg-type] 1929 func, # type: ignore[arg-type] 1930 input, # type: ignore[arg-type] 1931 config, 1932 run_manager, 1933 **kwargs, 1934 ), 1935 ) 1936 except BaseException as e: 1937 run_manager.on_chain_error(e) ``````output File ~/langchain/oss-py/libs/core/langchain_core/runnables/config.py:396, in call_func_with_variable_args(func, input, config, run_manager, **kwargs) 394 if run_manager is not None and accepts_run_manager(func): 395 kwargs[\"run_manager\"] = run_manager --> 396 return func(input, **kwargs) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/base.py:194, in BaseOutputParser.invoke.<locals>.<lambda>(inner_input) 186 def invoke( 187 self, 188 input: Union[str, BaseMessage], 189 config: Optional[RunnableConfig] = None, 190 **kwargs: Any, 191 ) -> T: 192 if isinstance(input, BaseMessage): 193 return self._call_with_config( --> 194 lambda inner_input: self.parse_result( 195 [ChatGeneration(message=inner_input)] 196 ), 197 input, 198 config, 199 run_type=\"parser\", 200 ) 201 else: 202 return self._call_with_config( 203 lambda inner_input: self.parse_result([Generation(text=inner_input)]), 204 input, 205 config, 206 run_type=\"parser\", 207 ) ``````output File ~/langchain/oss-py/libs/core/langchain_core/output_parsers/json.py:86, in JsonOutputParser.parse_result(self, result, partial) 84 except JSONDecodeError as e: 85 msg = f\"Invalid json output: {text}\" ---> 86 raise OutputParserException(msg, llm_output=text) from e ``````output OutputParserException: Invalid json output: ``` {{\"foo\": Note that some prebuilt constructs like [legacy LangChain agents](/docs/how_to/agent_executor) and chains may use output parsers internally, so you may see this error even if you're not visibly instantiating and using an output parser. ## Troubleshooting The following may help resolve this error: - Consider using [tool calling or other structured output techniques](/docs/how_to/structured_output/) if possible without an output parser to reliably output parseable values. - If you are using a prebuilt chain or agent, use [LangGraph](https://langchain-ai.github.io/langgraph/) to compose your logic explicitly instead. - Add more precise formatting instructions to your prompt. In the above example, adding `\"You must always return valid JSON fenced by a markdown code block. Do not return any additional text.\"` to your input may help steer the model to returning the expected format. - If you are using a smaller or less capable model, try using a more capable one. - Add [LLM-powered retries](/docs/how_to/output_parser_fixing/). Was this page helpful?Image description 0: Empty data Image description 1: Empty data >>)"
|
67
|
+
}
|