llm_memory_gmail_loader 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/llm_memory_gmail_loader/version.rb +1 -1
- data/lib/llm_memory_gmail_loader.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c37a2b38b54c844f82c37d863d7732e530d7a1e0d0ed6e04f996bf03dc148015
|
4
|
+
data.tar.gz: c49fa2520349e85383c17be41d3b89ac2c381cfaf164b99c0392894f1def0385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2468d9f5250cf3b5aa62a654bfd0a448b35eba4489594997a2c4096a2bdbaab2bce2d6bb5ec58ea8e64cd9cc05cb922e4e6ba797c4f953f48ce5de66094114fe
|
7
|
+
data.tar.gz: 07c76830cbc0623569976bd4795ec9a682ac39dd06793d23ac910761eb3b6c9ca4a3d704eeb8d3ba0867a42d1cd2b87cf73609976804d1e5fbdc3c939515c749
|
data/Gemfile.lock
CHANGED
@@ -50,7 +50,9 @@ module LlmMemoryGmailLoader
|
|
50
50
|
# authorizer.sub = "user@example.com" # Replace with the user's email address
|
51
51
|
end
|
52
52
|
|
53
|
-
def list_emails(email:, limit:
|
53
|
+
def list_emails(email:, limit: nil, query: nil)
|
54
|
+
limit ||= 100
|
55
|
+
query ||= "label:sent"
|
54
56
|
@service.authorization.sub = email
|
55
57
|
next_page_token = nil
|
56
58
|
sent_emails = []
|
@@ -58,6 +60,7 @@ module LlmMemoryGmailLoader
|
|
58
60
|
max_results = (limit < 100) ? limit : 100
|
59
61
|
loop do
|
60
62
|
result = @service.list_user_messages("me", q: query, page_token: next_page_token, max_results: max_results)
|
63
|
+
break if result.messages.nil?
|
61
64
|
sent_emails.concat(result.messages) if result.messages
|
62
65
|
count += result.messages.length
|
63
66
|
next_page_token = result.next_page_token
|
@@ -164,6 +167,7 @@ module LlmMemoryGmailLoader
|
|
164
167
|
def load(args)
|
165
168
|
emails = args[:emails]
|
166
169
|
limit = args[:limit]
|
170
|
+
query = args[:query]
|
167
171
|
raise "emails is required" if emails.nil? || emails.length == 0
|
168
172
|
|
169
173
|
@service ||= Google::Apis::GmailV1::GmailService.new
|
@@ -171,11 +175,7 @@ module LlmMemoryGmailLoader
|
|
171
175
|
|
172
176
|
results = []
|
173
177
|
emails.each do |email|
|
174
|
-
results +=
|
175
|
-
list_emails(email: email)
|
176
|
-
else
|
177
|
-
list_emails(email: email, limit: limit)
|
178
|
-
end
|
178
|
+
results += list_emails(email: email, limit: limit, query: query)
|
179
179
|
end
|
180
180
|
|
181
181
|
create_documents(results)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: llm_memory_gmail_loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shohei Kameda
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: googleauth
|