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
[Feat] Accept non-dict if only 1 prompt input variable #19156
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
|
||
def test_messages_prompt_accepts_list() -> None: | ||
prompt = ChatPromptTemplate.from_messages([MessagesPlaceholder("history")]) | ||
value = prompt.invoke([("user", "Hi there")]) # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
his is confusing -- are we sure we want to support?, why is it a list of 2-tuples rather than only a 2-tuple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already support prompt.invoke({"history": [("user", "hi there"]})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you be able to document this feature via an example in a relevant place?
c357868
to
1b9de31
Compare
and you invoke the template with a non-dict object, the prompt template will | ||
inject the provided argument into that variable location. | ||
|
||
Single-variable template: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@baskaryan do you think this formatting would work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be indented at same level as Examples: (L564)
…19156) For prompt templates with only 1 variable (common in e.g., MessageGraph), it's convenient to wrap the incoming object in the variable before formatting. The downside of this, of course, would be that some number of invocations will successfully format when the user may have intended to format it properly before
…19156) For prompt templates with only 1 variable (common in e.g., MessageGraph), it's convenient to wrap the incoming object in the variable before formatting. The downside of this, of course, would be that some number of invocations will successfully format when the user may have intended to format it properly before
…19156) For prompt templates with only 1 variable (common in e.g., MessageGraph), it's convenient to wrap the incoming object in the variable before formatting. The downside of this, of course, would be that some number of invocations will successfully format when the user may have intended to format it properly before
…19156) For prompt templates with only 1 variable (common in e.g., MessageGraph), it's convenient to wrap the incoming object in the variable before formatting. The downside of this, of course, would be that some number of invocations will successfully format when the user may have intended to format it properly before
…19156) For prompt templates with only 1 variable (common in e.g., MessageGraph), it's convenient to wrap the incoming object in the variable before formatting. The downside of this, of course, would be that some number of invocations will successfully format when the user may have intended to format it properly before
For prompt templates with only 1 variable (common in e.g., MessageGraph), it's convenient to wrap the incoming object in the variable before formatting. The downside of this, of course, would be that some number of invocations will successfully format when the user may have intended to format it properly before
For prompt templates with only 1 variable (common in e.g., MessageGraph), it's convenient to wrap the incoming object in the variable before formatting.
The downside of this, of course, would be that some number of invocations will successfully format when the user may have intended to format it properly before