jekyll_ai_related_posts 0.1.2 → 0.1.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd10032e0e9758acac7f0dc26d79aaa2a8de36e8872be41ecd62f915b4422847
|
4
|
+
data.tar.gz: f999747d95b4b9dce7c1fd6fcad198959a1734c13dfc50cbdd57bdb267f0fcdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea9b61e8f8e3b9148146eece6a453abc57e720c295db1b99d11d6ef6786c206a4efdca194c6c0d8287133699517775b242aa9b4cae5af1cc10ee40903be3c0ab
|
7
|
+
data.tar.gz: 9d43069c05704e7c032840e4fc6409da6fd2ca437b5b2cf282021a84b0c64fa9b1761c03ab3694759261cf10b26cd087a49ace883f1d4c85e5f365d90d0b8bb2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -16,6 +16,13 @@ embeddings API that allows us to easily get the embedding vector (in one of
|
|
16
16
|
OpenAI's models) of some text. We can use these vectors to compute related
|
17
17
|
posts with the accuracy of OpenAI's models (or any other LLM, for that matter).
|
18
18
|
|
19
|
+
### Used in Production at
|
20
|
+
|
21
|
+
- [MikeKasberg.com](https://www.mikekasberg.com)
|
22
|
+
|
23
|
+
(Feel free to open a PR to add your website if you're using this gem in
|
24
|
+
production!)
|
25
|
+
|
19
26
|
## Installation
|
20
27
|
|
21
28
|
Jekyll AI Related Posts is a [Jekyll
|
@@ -9,6 +9,8 @@ require "json"
|
|
9
9
|
module JekyllAiRelatedPosts
|
10
10
|
class Generator < Jekyll::Generator
|
11
11
|
def generate(site)
|
12
|
+
Jekyll.logger.info "AI Related Posts:", "Generating related posts..."
|
13
|
+
|
12
14
|
@site = site
|
13
15
|
setup_database
|
14
16
|
|
@@ -18,7 +20,6 @@ module JekyllAiRelatedPosts
|
|
18
20
|
end
|
19
21
|
|
20
22
|
if fetch_enabled?
|
21
|
-
Jekyll.logger.info "[ai_related_posts] Generating related posts..."
|
22
23
|
@embeddings_fetcher = new_fetcher
|
23
24
|
|
24
25
|
@site.posts.docs.each do |p|
|
@@ -29,7 +30,7 @@ module JekyllAiRelatedPosts
|
|
29
30
|
find_related(p)
|
30
31
|
end
|
31
32
|
else
|
32
|
-
Jekyll.logger.info "
|
33
|
+
Jekyll.logger.info "AI Related Posts:", "Fetch disabled. Using cached related posts data."
|
33
34
|
|
34
35
|
@site.posts.docs.each do |p|
|
35
36
|
fallback_generate_related(p)
|
@@ -139,7 +140,7 @@ module JekyllAiRelatedPosts
|
|
139
140
|
end
|
140
141
|
|
141
142
|
def embedding_for(post)
|
142
|
-
Jekyll.logger.info "
|
143
|
+
Jekyll.logger.info "AI Related Posts:", "Fetching embedding for #{post.relative_path}"
|
143
144
|
input = embedding_text(post)
|
144
145
|
|
145
146
|
@embeddings_fetcher.embedding_for(input)
|
@@ -175,7 +176,7 @@ module JekyllAiRelatedPosts
|
|
175
176
|
SQL
|
176
177
|
ActiveRecord::Base.connection.execute(create_vss_posts)
|
177
178
|
|
178
|
-
Jekyll.logger.debug
|
179
|
+
Jekyll.logger.debug "AI Related Posts:", "DB setup complete"
|
179
180
|
end
|
180
181
|
end
|
181
182
|
end
|
@@ -29,8 +29,8 @@ module JekyllAiRelatedPosts
|
|
29
29
|
|
30
30
|
res.body["data"].first["embedding"]
|
31
31
|
rescue Faraday::Error => e
|
32
|
-
Jekyll.logger.error "Error response from
|
33
|
-
Jekyll.logger.error e.inspect
|
32
|
+
Jekyll.logger.error "AI Related Posts:", "Error response from OpenAI API!"
|
33
|
+
Jekyll.logger.error "AI Related Posts:", e.inspect
|
34
34
|
|
35
35
|
raise
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_ai_related_posts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kasberg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|