Skip to content

feat: add relevant chunks prompts - #745

Merged
drazvan merged 2 commits into
developfrom
fix/relevant-chunks-colang-2
Sep 15, 2024
Merged

feat: add relevant chunks prompts #745
drazvan merged 2 commits into
developfrom
fix/relevant-chunks-colang-2

Conversation

@Pouyanpi

Copy link
Copy Markdown
Collaborator

Add relevant chunks for generate_flow_continuation and generate_user_intent_and_bot_action_from_user_action tasks

tested with abc_v2 config (also for meta/llama3-70b-instruct) without kb folder.

from nemoguardrails import LLMRails, RailsConfig

config = RailsConfig.from_path("./examples/bots/abc_v2")
rails = LLMRails(config)

response = rails.generate(messages=[{
    "role": "context",
    "content": {
        "relevant_chunks": """
            Employees are eligible for the following time off:
              * Vacation: 15 days per year, accrued monthly.
              * Sick leave: 25 days per year, accrued monthly.
              * Personal days: 5 days per year, accrued monthly.
              * Paid holidays: New Year's Day, Memorial Day, Independence Day, Thanksgiving Day, Christmas Day.
              * Bereavement leave: 3 days paid leave for immediate family members, 1 day for non-immediate family members. """
    }
},{
    "role": "user",
   
    "content": "How many sick leaves do employees have?"
}])

response["content"] must contain 25 days.

…d 'generate_user_intent_and_bot_action_from_user_action' tasks
@Pouyanpi
Pouyanpi requested a review from drazvan September 11, 2024 19:10

@drazvan drazvan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Pouyanpi: moved the relevent chunks up a bit in a couple of templates. The idea is to not break the pattern from the current conversation, so that in-context learning will kick in to keep the right format.

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.

2 participants