langchaingo
langchaingo copied to clipboard
Minor enhancements needed to use this package in additional projects
- In my current project, there is a strict requirement to have
go v1.21while later versions like v1.22 are not allowed. The only change needed isgo 1.22.0=>go 1.21.0ingo.modfile. I tried locally and it works fine. - Also in my project, I need to load Markdown files with extension
.mdx(rather than.md) while the content format is the same. To support this extension just need to change conditionfilepath.Ext(file.Name()) != ".md"to(filepath.Ext(file.Name()) != ".md" && filepath.Ext(file.Name()) != ".mdx")indocumentloaders/notion.go
These changes will not impact existing behavior and no regressions are expected. I already prepared these changes locally, so if you are OK with them - please give me permissions to commit/merge and I will send PR for review.
Thanks.
diff --git a/documentloaders/notion.go b/documentloaders/notion.go
index 0dacbe7..c59b696 100644
--- a/documentloaders/notion.go
+++ b/documentloaders/notion.go
@@ -39,7 +39,7 @@ func (n *NotionDirectoryLoader) Load() ([]schema.Document, error) {
documents := make([]schema.Document, 0, len(files))
for _, file := range files {
- if file.IsDir() || filepath.Ext(file.Name()) != ".md" {
+ if file.IsDir() || (filepath.Ext(file.Name()) != ".md" && filepath.Ext(file.Name()) != ".mdx") {
continue
}
diff --git a/go.mod b/go.mod
index 6401ef7..214b001 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/tmc/langchaingo
-go 1.22.0
+go 1.21.0
@tmc can you please take a look here? it is a very small change that will allow me to use your package (rather than forking it). thanks.
our project moved to go 1.22 - so this issue is not relevant anymore (support of .mdx can be worked around)