llm_memory_gmail_loader 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5488bc6c4a2535d24b1d3e8f3649ecb14aaf9f4624cfb27731e9f1a1f20330a
4
- data.tar.gz: db11e4bd9ab7f43c1d3be98ef3ac02003150befecd269bcc946da9d091fc2427
3
+ metadata.gz: c37a2b38b54c844f82c37d863d7732e530d7a1e0d0ed6e04f996bf03dc148015
4
+ data.tar.gz: c49fa2520349e85383c17be41d3b89ac2c381cfaf164b99c0392894f1def0385
5
5
  SHA512:
6
- metadata.gz: 351b811870a323dfead2744273d34af66596bb6745b407c72d311fc30efe93317c2191f12d7af6805e55485a7ad3dad71245e114b9b3104cf76f2c434545e5a7
7
- data.tar.gz: 8583d952e71f223f9823e9458922cc0d12b528e23d77e3c1f16ef9ee5ec455d448cdf3f8ca67f1842f3d903ea4518bb8986d7d5b10964857bdd8a5bd41a3df14
6
+ metadata.gz: 2468d9f5250cf3b5aa62a654bfd0a448b35eba4489594997a2c4096a2bdbaab2bce2d6bb5ec58ea8e64cd9cc05cb922e4e6ba797c4f953f48ce5de66094114fe
7
+ data.tar.gz: 07c76830cbc0623569976bd4795ec9a682ac39dd06793d23ac910761eb3b6c9ca4a3d704eeb8d3ba0867a42d1cd2b87cf73609976804d1e5fbdc3c939515c749
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- llm_memory_gmail_loader (0.1.5)
4
+ llm_memory_gmail_loader (0.1.6)
5
5
  google-apis-gmail_v1 (~> 0.27.0)
6
6
  googleauth (>= 0.17)
7
7
  nokogiri (~> 1.14.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LlmMemoryGmailLoader
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
@@ -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: 100, query: "label:sent")
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 += if limit.nil?
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.5
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-27 00:00:00.000000000 Z
11
+ date: 2023-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: googleauth