-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
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)
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.
thanks for the docs screenshot!
…s loaded via CQL (#29089) ## Description This PR enables label inclusion for documents loaded via CQL in the confluence-loader. - Updated _lazy_load to pass the include_labels parameter instead of False in process_pages calls for documents loaded via CQL. - Ensured that labels can now be fetched and added to the metadata for documents queried with cql. ## Related Modification History This PR builds on the previous functionality introduced in [#28259](#28259), which added support for including labels with the include_labels option. However, this functionality did not work as expected for CQL queries, and this PR fixes that issue. If the False handling was intentional due to another issue, please let me know. I have verified with our Confluence instance that this change allows labels to be correctly fetched for documents loaded via CQL. ## Issue Fixes #29088 ## Dependencies No changes. ## Twitter Handle [@zenoengine](https://x.com/zenoengine)
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/