Skip to content

Conversation

@serengil
Copy link
Contributor

@serengil serengil commented Oct 30, 2025

Description

The additional arguments we previously introduced to the invoke function in LLMInterface broke compatibility with LangChain. This change introduces a new LLMInterfaceV2 contract that is fully compatible with LangChain while maintaining backward compatibility. If any users have implemented the old LLMInterface manually, their implementations will continue to work without modification.

Resolves #383

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Documentation update
  • Project configuration change

Complexity

Moderate. Even though a new contract provided, the old contact is still valid to offer backward compability.

Complexity:

How Has This Been Tested?

  • Unit tests
  • E2E tests
  • Manual tests

Checklist

The following requirements should have been met (depending on the changes in the branch):

  • Documentation has been updated
  • Unit tests have been updated
  • E2E tests have been updated
  • Examples have been updated
  • New files have copyright header
  • CLA (https://neo4j.com/developer/cla/) has been signed
  • CHANGELOG.md updated if appropriate

@serengil serengil requested a review from a team as a code owner October 30, 2025 10:16
Copy link
Contributor

@stellasia stellasia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, I haven't read everything yet, but left a few comments/questions.

return_context = False
if isinstance(self.llm, LLMInterface):
warnings.warn(
"The default value of 'return_context' will change from 'False'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes seem to be related to line length only, are there made on purpose? (asking because I know Nathalie had some issues about this in the past)

Copy link
Contributor Author

@serengil serengil Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, pylint was warning about that line is too long. Autolinter in my ide splitted this line to many lines. I can revert them back if you think it may cause any issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just that the next person pushing to the repo will have to make the opposite change, so we should agree on a convention. Is this something we should add to a config file in the repo?

input: List[LLMMessage],
) -> LLMResponse: ...

@overload # type: ignore[no-overload-impl]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why we need these two type ignore comments: # type: ignore[no-overload-impl] and later # type: ignore[no-redef]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a mypy bug. alternatively we can move overload definitions to same file with pyi extension but it may make repo complexer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

langchain is not available

2 participants