Errata

Learning LangChain

Errata for Learning LangChain

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page Page 5 - "Using LLMs in LangChain"
1st paragraph

In the Python example, doing the `model.invoke("The sky is")` using the model `gpt-3.5-turbo` throws a `404` error against OpenAI's API:

```
NotFoundError: Error code: 404 - {'error': {'message': 'This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}}
```

Changing the model to `gpt-3.5-turbo-instruct` works.

Holger Abel  Apr 27, 2025 
Other Digital Version learning-langchain/ch6/py/d-supervisor.py
code provided from OReilly web site

The code example (learning-langchain/ch6/py/d-supervisor.py) provided by your web site has serious technical issues. #1. The model gpt-4 is not supported by langchain. (fix this error /home/ubuntu/mnt/myproject/lib/python3.12/site-packages/langchain_openai/chat_models/base.py:1784: UserWarning: Cannot use method='json_schema' with model gpt-4 since it doesn't support OpenAI's Structured Output API. To fix this warning, set `method='function_calling'. Overriding to method='function_calling'.
warnings.warn(), Then if you continue along, you get this error: File ~/mnt/myproject/lib/python3.12/site-packages/langchain_core/messages/utils.py:367, in convert_to_messages(messages)
365 if isinstance(messages, PromptValue):
366 return messages.to_messages()
--> 367 return [_convert_to_message(m) for m in messages]

File ~/mnt/myproject/lib/python3.12/site-packages/langchain_core/messages/utils.py:346, in _convert_to_message(message)
344 msg = f"Unsupported message type: {type(message)}"
345 msg = create_message(message=msg, error_code=ErrorCode.MESSAGE_COERCION_FAILURE)
--> 346 raise NotImplementedError(msg)
348 return _message

NotImplementedError: Unsupported message type: <class '__main__.SupervisorDecision'>



CAL PAGE  Jul 08, 2025 
PDF Page 6
5th paragraph

The chat model’s interface makes it easier to configure and manage conversions in your AI chatbot application.

'conversions' should be 'conversations'.

A.M. Sabuncu  Feb 15, 2026 
PDF Page 76
Line before the JavaScript code

The variable "generate_queries" referenced in the runnable does not exist and is not defined or mentioned anywhere in the whole book. Based on the preceding code examples, the correct syntax should be:

retrieval_chain = query_gen | retriever.batch | reciprocal_rank_fusion

"query_gen" is declared in the page 74 and looks like the correct variable.

Rafael  Jul 31, 2025