-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
langchain[minor]: openai tools structured_output_chain #17296
langchain[minor]: openai tools structured_output_chain #17296
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
probably. think we should first land #17302 and figure out what, if any, other extraction chains/utils we're adding, and then deprecate the various existing extraction chains |
@@ -299,33 +306,46 @@ class Dog(BaseModel): | |||
chain = create_structured_output_runnable(Dog, llm, prompt, mode="openai-json") | |||
chain.invoke({"input": "Harry was a chubby brown beagle who loved chicken"}) | |||
""" # noqa: E501 | |||
# for backwards compatibility |
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.
i don't think we want to support this outside of openai-functions?
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.
I can push inside, but I usually handle this at top scope, even better would be to fix this via a function level decorator to add a parameter renamer
def __init__(self, key_name: str, **kwargs: Any) -> None: | ||
"""Allow init with positional args.""" | ||
# Backwards compatibility for old argument name. | ||
if "return_single" in kwargs: |
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.
Adding backwards compatibility
prompt = ChatPromptTemplate.from_messages( | ||
[ | ||
("system", "You are an extraction algorithm. Please extract every possible instance"), | ||
('human', '{input}') | ||
] | ||
) |
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 be nice to have an example without prompt
…17296) Co-authored-by: Eugene Yurtsev <[email protected]>
No description provided.