Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples for LLM message history and system instruction features #240

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

stellasia
Copy link
Contributor

Description

Note

Please provide a description of the work completed in this PR below

Type of Change

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

Complexity

Complexity: Low

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

@stellasia stellasia requested a review from a team as a code owner January 6, 2025 14:10
@@ -119,14 +119,15 @@ def invoke(
Returns:
LLMResponse: The response from the LLM.
"""
system_message = (
system_instruction = (
Copy link
Contributor

@jonbesga jonbesga Jan 6, 2025

Choose a reason for hiding this comment

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

What about?

system_instruction = system_instruction or self.system_instruction

(Just a suggestion, not really important)

for question in questions:
res: LLMResponse = llm.invoke(
question,
message_history=history,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does message_history work with the GraphRAG class? Could be worth including an example for that if so

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, using it with GraphRAG search() was the main intention.

Copy link
Contributor

Choose a reason for hiding this comment

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

But I guess both examples are relevant.

@@ -119,14 +119,15 @@ def invoke(
Returns:
LLMResponse: The response from the LLM.
"""
system_message = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't forget to make the same changes to ainvoke() 🙂

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.

4 participants