-
Notifications
You must be signed in to change notification settings - Fork 18.5k
feat(langchain): add stuff and map reduce chains #32333
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
CodSpeed WallTime Performance ReportMerging #32333 will not alter performanceComparing
|
CodSpeed Instrumentation Performance ReportMerging #32333 will not alter performanceComparing Summary
|
948aec1
to
5e6c1e8
Compare
from langchain_core.documents import Document | ||
|
||
|
||
def format_document_xml(doc: Document) -> str: |
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.
expose in documents
as format_as_xml
?
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 like _
prefixed files in _internal
as well
__all__ = [ | ||
"RunnableCallable", | ||
] |
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.
Hmm. I really think we should avoid using this if possible.
) | ||
|
||
# Needs to be in global scope as the type annotation is used at runtime | ||
from langchain_core.documents import Document as Document |
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.
from langchain_core.documents import Document as Document | |
from langchain_core.documents import Document |
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.
Be more specific w/ comment here - by pydantic
I presume. Where? In schema gen?
], | ||
] = "default_reducer", | ||
context_schema: ContextT = None, | ||
response_format: Optional[type[BaseModel]] = None, |
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.
Let's use new syntax for unions bc we use from __future__ import annotations
, so we can use |
. There's a ruff rule to enforce
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.
Also we will drop 3.9 super soon anyways.
] = "default_reducer", | ||
context_schema: ContextT = None, | ||
response_format: Optional[type[BaseModel]] = None, | ||
) -> StateGraph[MapReduceState, ContextT, InputSchema, OutputSchema]: |
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.
Glad this is coming in handy :)
|
||
|
||
class _Extractor(Generic[ContextT]): | ||
"""Stuff documents chain implementation. |
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.
Remove "stuff" right?
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 need to rename for a better name.
Could be create_document_analyzer
e3de85d
to
3bc07fd
Compare
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 make these public in langgraph if it'd help you out 🫡, easy to fix later though bc internal
Uh oh!
There was an error while loading. Please reload this page.