-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
community: add include_labels option to ConfluenceLoader #28259
base: master
Are you sure you want to change the base?
community: add include_labels option to ConfluenceLoader #28259
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
08a12d8
to
f3dffce
Compare
metadata = { | ||
"title": page["title"], | ||
"id": page["id"], | ||
"source": self.base_url.strip("/") + page["_links"]["webui"], | ||
**({"labels": labels} if include_labels else {}), |
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.
set labels
key only when include_labels
is set to true
labels = [ | ||
label["name"] | ||
for label in page.get("metadata", {}) | ||
.get("labels", {}) | ||
.get("results", []) | ||
] |
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.
expand = ",".join( | ||
[ | ||
content_format.value, | ||
"version", | ||
*(["metadata.labels"] if include_labels else []), | ||
] | ||
) |
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.
expand
is a comma-separated query parameter. originally hardcoded as f"{content_format.value},version"
.
I made a variable so we can add more option if necessary in the future as expand
parameter supports a lot more values.
(ref)
Description:
Enable
ConfluenceLoader
to include labels withinclude_labels
option (false
by default for backward compatibility). and the labels are set tometadata
in theDocument
. e.g.{"labels": ["l1", "l2"]}
Notes
Confluence API supports to get labels by providing
metadata.labels
toexpand
query parameterAll of the following functions support
expand
in the same way:Issue:
No issue related to this PR.
Dependencies:
No changes.
Twitter handle:
@gymnstcs
Add tests and docs: If you're adding a new integration, please include
docs/docs/integrations
directory.Lint and test: Run
make format
,make lint
andmake test
from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/