Ken Powers commited on
Commit
41115c3
·
unverified ·
1 Parent(s): 6c048f9

Add voyage-3 and fix NV-Embed-V2 size

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. README.md +10 -7
  2. embed-openai.py +5 -2
  3. embed-voyageai.py +51 -0
  4. embeddings/1 Chronicles/001/bsb-voyage-3.json +3 -0
  5. embeddings/1 Chronicles/002/bsb-voyage-3.json +3 -0
  6. embeddings/1 Chronicles/003/bsb-voyage-3.json +3 -0
  7. embeddings/1 Chronicles/004/bsb-voyage-3.json +3 -0
  8. embeddings/1 Chronicles/005/bsb-voyage-3.json +3 -0
  9. embeddings/1 Chronicles/006/bsb-voyage-3.json +3 -0
  10. embeddings/1 Chronicles/007/bsb-voyage-3.json +3 -0
  11. embeddings/1 Chronicles/008/bsb-voyage-3.json +3 -0
  12. embeddings/1 Chronicles/009/bsb-voyage-3.json +3 -0
  13. embeddings/1 Chronicles/010/bsb-voyage-3.json +3 -0
  14. embeddings/1 Chronicles/011/bsb-voyage-3.json +3 -0
  15. embeddings/1 Chronicles/012/bsb-voyage-3.json +3 -0
  16. embeddings/1 Chronicles/013/bsb-voyage-3.json +3 -0
  17. embeddings/1 Chronicles/014/bsb-voyage-3.json +3 -0
  18. embeddings/1 Chronicles/015/bsb-voyage-3.json +3 -0
  19. embeddings/1 Chronicles/016/bsb-voyage-3.json +3 -0
  20. embeddings/1 Chronicles/017/bsb-voyage-3.json +3 -0
  21. embeddings/1 Chronicles/018/bsb-voyage-3.json +3 -0
  22. embeddings/1 Chronicles/019/bsb-voyage-3.json +3 -0
  23. embeddings/1 Chronicles/020/bsb-voyage-3.json +3 -0
  24. embeddings/1 Chronicles/021/bsb-voyage-3.json +3 -0
  25. embeddings/1 Chronicles/022/bsb-voyage-3.json +3 -0
  26. embeddings/1 Chronicles/023/bsb-voyage-3.json +3 -0
  27. embeddings/1 Chronicles/024/bsb-voyage-3.json +3 -0
  28. embeddings/1 Chronicles/025/bsb-voyage-3.json +3 -0
  29. embeddings/1 Chronicles/026/bsb-voyage-3.json +3 -0
  30. embeddings/1 Chronicles/027/bsb-voyage-3.json +3 -0
  31. embeddings/1 Chronicles/028/bsb-voyage-3.json +3 -0
  32. embeddings/1 Chronicles/029/bsb-voyage-3.json +3 -0
  33. embeddings/1 Corinthians/001/bsb-voyage-3.json +3 -0
  34. embeddings/1 Corinthians/002/bsb-voyage-3.json +3 -0
  35. embeddings/1 Corinthians/003/bsb-voyage-3.json +3 -0
  36. embeddings/1 Corinthians/004/bsb-voyage-3.json +3 -0
  37. embeddings/1 Corinthians/005/bsb-voyage-3.json +3 -0
  38. embeddings/1 Corinthians/006/bsb-voyage-3.json +3 -0
  39. embeddings/1 Corinthians/007/bsb-voyage-3.json +3 -0
  40. embeddings/1 Corinthians/008/bsb-voyage-3.json +3 -0
  41. embeddings/1 Corinthians/009/bsb-voyage-3.json +3 -0
  42. embeddings/1 Corinthians/010/bsb-voyage-3.json +3 -0
  43. embeddings/1 Corinthians/011/bsb-voyage-3.json +3 -0
  44. embeddings/1 Corinthians/012/bsb-voyage-3.json +3 -0
  45. embeddings/1 Corinthians/013/bsb-voyage-3.json +3 -0
  46. embeddings/1 Corinthians/014/bsb-voyage-3.json +3 -0
  47. embeddings/1 Corinthians/015/bsb-voyage-3.json +3 -0
  48. embeddings/1 Corinthians/016/bsb-voyage-3.json +3 -0
  49. embeddings/1 John/001/bsb-voyage-3.json +3 -0
  50. embeddings/1 John/002/bsb-voyage-3.json +3 -0
README.md CHANGED
@@ -67,7 +67,7 @@ For high-level information about these models, see the [MTEB Leaderboard](https:
67
  - BSB: 336.522 MB
68
  - [nvidia/NV-Embed-V2](https://huggingface.co/nvidia/NV-Embed-V2)
69
  - 1024 dimensions
70
- - BSB: 898.283 MB
71
  - [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
72
  - 384 dimensions
73
  - BSB: 336.741 MB
@@ -92,14 +92,17 @@ For high-level information about these models, see the [MTEB Leaderboard](https:
92
  - [thenlper/gte-small](https://huggingface.co/thenlper/gte-small)
93
  - 384 dimensions
94
  - BSB: 338.211 MB
 
 
 
95
 
96
  ## Query Examples
97
 
98
  ✅ denotes accurate result.
99
 
100
- | Translation | Query | BAAI/bge-large-en | BAAI/bge-base-en | BAAI/bge-small-en | intfloat/e5-large-v2 | intfloat/e5-base-v2 | intfloat/e5-small-v2 | nvidia/NV-Embed-V2 | sentence-transformers/all-MiniLM-L6-v2 | Salesforce/SFR-Embedding-Mistral | text-embedding-3-large | text-embedding-3-small | text-embedding-ada-002 | thenlper/gte-large | thenlper/gte-base | thenlper/gte-small |
101
- | ----------- | --------------------------------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------- |
102
- | BSB | God is love | 1 John 4:8 (0.9084) ✅, 1 John 4:16 (0.9073) ✅, 1 John 4:7 (0.8963) | 1 John 4:16 (0.9078) ✅, 1 John 4:8 (0.8906) ✅, 1 John 4:7 (0.8882) | 1 John 4:16 (0.9193) ✅, Psalm 73:1 (0.9131), 1 John 4:8 (0.9069) ✅ | 1 John 4:8 (0.8575) ✅, 1 John 4:16 (0.8354) ✅, Psalm 115:3 (0.8270) | 1 John 4:8 (0.8625) ✅, 1 John 4:12 (0.8353), 1 John 4:7 (0.8301) | 1 John 4:16 (0.8750) ✅, 1 John 4:8 (0.8741) ✅, 1 John 4:12 (0.8573) | 1 John 4:19 (0.5823), 1 Corinthians 16:14 (0.5245), 1 Corinthians 13:4 (0.5150) | 1 John 4:16 (0.6814) ✅, 1 John 4:8 (0.6255) ✅, 1 John 4:12 (0.6056) | 1 Corinthians 16:14 (0.7896), 1 John 4:8 (0.7784) ✅, 1 Corinthians 8:3 (0.7673) | 1 Jonn 4:8 (0.6260) ✅, 1 John 4:16 (0.6083) ✅, 1 John 4:9 (0.5519) | 1 John 4:16 (0.6159) ✅, 1 John 4:8 (0.6058) ✅, 1 John 4:12 (0.5713) | 1 John 4:16 (0.8935) ✅, 1 John 4:8 (0.8930) ✅, 1 John 4:7 (0.8854) | 1 John 4:8 (0.9222) ✅, 1 John 4:16 (0.8993) ✅, 1 John 4:10 (0.8941) | 1 John 4:8 (0.9417), 1 John 4:16 (0.9147), 1 John 4:7 (0.8977) | 1 John 4:8 (0.9231) ✅, 1 John 4:16 (0.9065) ✅, 1 Corinthians 8:3 (0.8928) |
103
- | BSB | They meant bad but God meant good | Amos 5:14 (0.8809), Proverbs 12:2 (0.8797), 3 John 1:11 (0.8793) | 3 John 11 (0.8639), Acts 13:32 (0.8625), Titus 3:8 (0.8618) | 3 John 11 (0.8871), Psalm 73:1 (0.8860), Psalm 76:9 (0.8857) | Psalm 106:21 (0.8293), Romans 12:21 (0.8288), Romans 1:25 (0.8284) | Genesis 50:20 (0.8596) ✅, 1 Peter 3:17 (0.8507), Hebrews 11:16 (0.8484) | 1 Peter 3:17 (0.8570), Isaiah 5:20 (0.8536), Ecclesiastes 7:18 (0.8510) | Genesis 50:20 (0.5474) ✅, Romans 8:28 (0.4734), Psalms 21:11 (0.4454) | Luke 18:19 (0.5357), Mark 10:18 (0.5457), 3 John 11 (0.5030) | Genesis 50:20 (0.7706) ✅, Jeremiah 18:20 (0.7561), 2 Corinthians 4:9 (0.7538) | Genesis 50:20 (0.5814) ✅, Hebrews 11:40 (0.4597), Psalm 21:11 (0.4228) | Genesis 50:20 (0.5368) ✅, Jonah 3:10 (0.5243), Hebrews 11:40 (0.4992) | Genesis 50:20 (0.8718) ✅, Jonah 3:10 (0.8536), Hebrews 11:40 (0.8433) | Jonah 3:10 (0.8847), Luke 18:19 (0.8835), Mark 10:18 (0.8835) | Jonah 3:10 (0.8689), Jeremiah 18:20 (0.8668), Romans 14:16 (0.8657) | Psalm 99:8 (0.8747), 3 John 1:11 (0.8747), Galatians 1:24 (0.8744) |
104
- | BSB | God loves the world | Psalm 33:5 (0.8973), Isaiah 12:5 (0.8839), Psalm 115:3 (0.8817) | Psalm 33:5 (0.8953), 1 Chronicles 16:31 (0.8755), 1 Corinthians 8:3 (0.8755) | Psalm 47:7 (0.9070), Psalm 24:1 (0.9059), Psalm 76:9 (0.8996) | Psalm 33:5 (0.8530), John 3:16 (0.8503) ✅, Psalm 146:8 (0.8409) | Psalm 33:5 (0.8802), John 3:16 (0.8565) ✅, Psalm 146:8 (0.8501) | Psalm 33:5 (0.8835), Psalm 47:7 (0.8734), Genesis 1:17 (0.8585) | 1 John 4:19 (0.5741), John 3:16 (0.5361) ✅, John 3:17 (0.5048) | Psalm 33:5 (0.6514), John 3:16 (0.6381) ✅, Psalm 47:7 (0.5882) | 1 Corinthians 16:14 (0.7331), 1 Corinthians 8:3 (0.7192), John 15:17 (0.7147) | John 3:16 (0.5520) ✅, John 3:17 (0.5506), 1 John 2:15 (0.4799) | John 3:16 (0.5981) ✅, 1 John 2:15 (0.5623), John 3:17 (0.5454) | John 3:16 (0.8704) ✅, 1 John 4:19 (0.8662), Psalm 67:7 (0.8643) | John 3:16 (0.8905), Psalm 33:5 (0.8889), 1 John 2:15 (0.8839) | Psalm 33:5 (0.9002), 1 Corinthians 8:3 (0.8939), John 3:16 (0.8747) | John 3:16 (0.8953) ✅, Psalm 47:7 (0.8923), Psalm 33:5 (0.8921) |
105
- | BSB | God loved the world | Psalm 33:5 (0.8850), John 3:16 (0.8824) ✅, Genesis 1:1 (0.8824) | John 3:16 (0.8864) ✅, Psalm 33:5 (0.8853), Acts 2:47 (0.8765) | Psalm 76:9 (0.9071), Genesis 1:1 (0.9053), John 3:16 (0.8979) ✅ | John 3:16 (0.8627) ✅, Psalm 33:5 (0.8456), Psalm 47:7 (0.8388) | John 3:16 (0.8685) ✅, Psalm 33:5 (0.8631), Psalm 136:6 (0.8472) | Psalm 33:5 (0.8738), John 3:16 (0.8725) ✅, Psalm 47:7 (0.8676) | 1 John 4:19 (0.6003), John 3:16 (0.5758) ✅, John 3:17 (0.5357) | John 3:16 (0.6464) ✅, John 3:17 (0.5846), Genesis 1:10 (0.5638) | John 3:17 (0.7436), John 3:16 (0.7385) ✅, 1 John 4:19 (0.7385) | John 3:16 (0.5929) ✅, John 3:17 (0.5541), 1 John 4:9 (0.5106) | John 3:16 (0.6034) ✅, John 3:17 (0.5585), John 1:10 (0.5342) | John 3:16 (0.8751) ✅, John 1:2 (0.8720), 1 John 4:19 (0.8671) | John 3:16 (0.8965), 1 John 4:9 (0.8838), Jeremiah 10:12 (0.8798) | John 3:16 (0.8950) ✅, Psalm 33:5 (0.8871), Psalm 136:6 (0.8722) | John 3:16 (0.9107) ✅, John 3:17 (0.8872), Genesis 1:10 (0.8866) |
 
67
  - BSB: 336.522 MB
68
  - [nvidia/NV-Embed-V2](https://huggingface.co/nvidia/NV-Embed-V2)
69
  - 1024 dimensions
70
+ - 3631.32 MB
71
  - [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
72
  - 384 dimensions
73
  - BSB: 336.741 MB
 
92
  - [thenlper/gte-small](https://huggingface.co/thenlper/gte-small)
93
  - 384 dimensions
94
  - BSB: 338.211 MB
95
+ - [voyage-3](https://docs.voyageai.com/docs/embeddings)
96
+ - 1024 dimensions
97
+ - BSB: 899.583 MB
98
 
99
  ## Query Examples
100
 
101
  ✅ denotes accurate result.
102
 
103
+ | Translation | Query | BAAI/bge-large-en | BAAI/bge-base-en | BAAI/bge-small-en | intfloat/e5-large-v2 | intfloat/e5-base-v2 | intfloat/e5-small-v2 | nvidia/NV-Embed-V2 | sentence-transformers/all-MiniLM-L6-v2 | Salesforce/SFR-Embedding-Mistral | text-embedding-3-large | text-embedding-3-small | text-embedding-ada-002 | thenlper/gte-large | thenlper/gte-base | thenlper/gte-small | voyage-3 |
104
+ | ----------- | --------------------------------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------- |
105
+ | BSB | God is love | 1 John 4:8 (0.9084) ✅, 1 John 4:16 (0.9073) ✅, 1 John 4:7 (0.8963) | 1 John 4:16 (0.9078) ✅, 1 John 4:8 (0.8906) ✅, 1 John 4:7 (0.8882) | 1 John 4:16 (0.9193) ✅, Psalm 73:1 (0.9131), 1 John 4:8 (0.9069) ✅ | 1 John 4:8 (0.8575) ✅, 1 John 4:16 (0.8354) ✅, Psalm 115:3 (0.8270) | 1 John 4:8 (0.8625) ✅, 1 John 4:12 (0.8353), 1 John 4:7 (0.8301) | 1 John 4:16 (0.8750) ✅, 1 John 4:8 (0.8741) ✅, 1 John 4:12 (0.8573) | 1 John 4:19 (0.5823), 1 Corinthians 16:14 (0.5245), 1 Corinthians 13:4 (0.5150) | 1 John 4:16 (0.6814) ✅, 1 John 4:8 (0.6255) ✅, 1 John 4:12 (0.6056) | 1 Corinthians 16:14 (0.7896), 1 John 4:8 (0.7784) ✅, 1 Corinthians 8:3 (0.7673) | 1 Jonn 4:8 (0.6260) ✅, 1 John 4:16 (0.6083) ✅, 1 John 4:9 (0.5519) | 1 John 4:16 (0.6159) ✅, 1 John 4:8 (0.6058) ✅, 1 John 4:12 (0.5713) | 1 John 4:16 (0.8935) ✅, 1 John 4:8 (0.8930) ✅, 1 John 4:7 (0.8854) | 1 John 4:8 (0.9222) ✅, 1 John 4:16 (0.8993) ✅, 1 John 4:10 (0.8941) | 1 John 4:8 (0.9417), 1 John 4:16 (0.9147), 1 John 4:7 (0.8977) | 1 John 4:8 (0.9231) ✅, 1 John 4:16 (0.9065) ✅, 1 Corinthians 8:3 (0.8928) | 1 John 4:8 (0.6027) ✅, 1 John 4:16 (0.5488) ✅, 1 John 4:7 (0.5397) |
106
+ | BSB | They meant bad but God meant good | Amos 5:14 (0.8809), Proverbs 12:2 (0.8797), 3 John 1:11 (0.8793) | 3 John 11 (0.8639), Acts 13:32 (0.8625), Titus 3:8 (0.8618) | 3 John 11 (0.8871), Psalm 73:1 (0.8860), Psalm 76:9 (0.8857) | Psalm 106:21 (0.8293), Romans 12:21 (0.8288), Romans 1:25 (0.8284) | Genesis 50:20 (0.8596) ✅, 1 Peter 3:17 (0.8507), Hebrews 11:16 (0.8484) | 1 Peter 3:17 (0.8570), Isaiah 5:20 (0.8536), Ecclesiastes 7:18 (0.8510) | Genesis 50:20 (0.5474) ✅, Romans 8:28 (0.4734), Psalms 21:11 (0.4454) | Luke 18:19 (0.5357), Mark 10:18 (0.5457), 3 John 11 (0.5030) | Genesis 50:20 (0.7706) ✅, Jeremiah 18:20 (0.7561), 2 Corinthians 4:9 (0.7538) | Genesis 50:20 (0.5814) ✅, Hebrews 11:40 (0.4597), Psalm 21:11 (0.4228) | Genesis 50:20 (0.5368) ✅, Jonah 3:10 (0.5243), Hebrews 11:40 (0.4992) | Genesis 50:20 (0.8718) ✅, Jonah 3:10 (0.8536), Hebrews 11:40 (0.8433) | Jonah 3:10 (0.8847), Luke 18:19 (0.8835), Mark 10:18 (0.8835) | Jonah 3:10 (0.8689), Jeremiah 18:20 (0.8668), Romans 14:16 (0.8657) | Psalm 99:8 (0.8747), 3 John 1:11 (0.8747), Galatians 1:24 (0.8744) | Luke 18:19 (0.5457), Mark 10:19 (0.5457), Genesis 50:20 (0.5159) ✅ |
107
+ | BSB | God loves the world | Psalm 33:5 (0.8973), Isaiah 12:5 (0.8839), Psalm 115:3 (0.8817) | Psalm 33:5 (0.8953), 1 Chronicles 16:31 (0.8755), 1 Corinthians 8:3 (0.8755) | Psalm 47:7 (0.9070), Psalm 24:1 (0.9059), Psalm 76:9 (0.8996) | Psalm 33:5 (0.8530), John 3:16 (0.8503) ✅, Psalm 146:8 (0.8409) | Psalm 33:5 (0.8802), John 3:16 (0.8565) ✅, Psalm 146:8 (0.8501) | Psalm 33:5 (0.8835), Psalm 47:7 (0.8734), Genesis 1:17 (0.8585) | 1 John 4:19 (0.5741), John 3:16 (0.5361) ✅, John 3:17 (0.5048) | Psalm 33:5 (0.6514), John 3:16 (0.6381) ✅, Psalm 47:7 (0.5882) | 1 Corinthians 16:14 (0.7331), 1 Corinthians 8:3 (0.7192), John 15:17 (0.7147) | John 3:16 (0.5520) ✅, John 3:17 (0.5506), 1 John 2:15 (0.4799) | John 3:16 (0.5981) ✅, 1 John 2:15 (0.5623), John 3:17 (0.5454) | John 3:16 (0.8704) ✅, 1 John 4:19 (0.8662), Psalm 67:7 (0.8643) | John 3:16 (0.8905), Psalm 33:5 (0.8889), 1 John 2:15 (0.8839) | Psalm 33:5 (0.9002), 1 Corinthians 8:3 (0.8939), John 3:16 (0.8747) | John 3:16 (0.8953) ✅, Psalm 47:7 (0.8923), Psalm 33:5 (0.8921) | 1 John 4:8 (0.5592), Psalm 67:7 (0.5323), John 3:16 (0.5280) ✅ |
108
+ | BSB | God loved the world | Psalm 33:5 (0.8850), John 3:16 (0.8824) ✅, Genesis 1:1 (0.8824) | John 3:16 (0.8864) ✅, Psalm 33:5 (0.8853), Acts 2:47 (0.8765) | Psalm 76:9 (0.9071), Genesis 1:1 (0.9053), John 3:16 (0.8979) ✅ | John 3:16 (0.8627) ✅, Psalm 33:5 (0.8456), Psalm 47:7 (0.8388) | John 3:16 (0.8685) ✅, Psalm 33:5 (0.8631), Psalm 136:6 (0.8472) | Psalm 33:5 (0.8738), John 3:16 (0.8725) ✅, Psalm 47:7 (0.8676) | 1 John 4:19 (0.6003), John 3:16 (0.5758) ✅, John 3:17 (0.5357) | John 3:16 (0.6464) ✅, John 3:17 (0.5846), Genesis 1:10 (0.5638) | John 3:17 (0.7436), John 3:16 (0.7385) ✅, 1 John 4:19 (0.7385) | John 3:16 (0.5929) ✅, John 3:17 (0.5541), 1 John 4:9 (0.5106) | John 3:16 (0.6034) ✅, John 3:17 (0.5585), John 1:10 (0.5342) | John 3:16 (0.8751) ✅, John 1:2 (0.8720), 1 John 4:19 (0.8671) | John 3:16 (0.8965), 1 John 4:9 (0.8838), Jeremiah 10:12 (0.8798) | John 3:16 (0.8950) ✅, Psalm 33:5 (0.8871), Psalm 136:6 (0.8722) | John 3:16 (0.9107) ✅, John 3:17 (0.8872), Genesis 1:10 (0.8866) | John 3:16 (0.5469) ✅, 1 John 4:8 (0.5360), John 3:17 (0.5321) |
embed-openai.py CHANGED
@@ -3,7 +3,10 @@ import json
3
  import os
4
  import openai
5
  from itertools import groupby
6
- from tenacity import retry, wait_exponential
 
 
 
7
 
8
  arg_parser = argparse.ArgumentParser(prog="embed-openai", description="Creates embeddings of Bible verses using OpenAI API")
9
  arg_parser.add_argument("translation", help="Located at text/<translation>.json")
@@ -18,7 +21,7 @@ grouped_bible_data = groupby(bible_data, lambda item: (item["book"], item["chapt
18
 
19
  model_name = args.model
20
 
21
- @retry(wait=wait_exponential(multiplier=2, min=2, max=30))
22
  def get_embeddings(sentences):
23
  return openai.Embedding.create(input=sentences, model=model_name)["data"]
24
 
 
3
  import os
4
  import openai
5
  from itertools import groupby
6
+ from tenacity import retry, wait_exponential, before_sleep_log
7
+
8
+ logging.basicConfig(level=logging.INFO)
9
+ logger = logging.getLogger(__name__)
10
 
11
  arg_parser = argparse.ArgumentParser(prog="embed-openai", description="Creates embeddings of Bible verses using OpenAI API")
12
  arg_parser.add_argument("translation", help="Located at text/<translation>.json")
 
21
 
22
  model_name = args.model
23
 
24
+ @retry(wait=wait_exponential(multiplier=2, min=2, max=30), before_sleep=before_sleep_log(logger, logging.WARNING))
25
  def get_embeddings(sentences):
26
  return openai.Embedding.create(input=sentences, model=model_name)["data"]
27
 
embed-voyageai.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import json
3
+ import os
4
+ import voyageai
5
+ from itertools import groupby
6
+ import logging
7
+ from tenacity import retry, wait_exponential, before_sleep_log
8
+
9
+ logging.basicConfig(level=logging.INFO)
10
+ logger = logging.getLogger(__name__)
11
+
12
+ arg_parser = argparse.ArgumentParser(prog="embed-voyageai", description="Creates embeddings of Bible verses using VoyageAI API")
13
+ arg_parser.add_argument("translation", help="Located at text/<translation>.json")
14
+ arg_parser.add_argument("model", help="VoyageAI model")
15
+
16
+ args = arg_parser.parse_args()
17
+
18
+ vo = voyageai.Client()
19
+
20
+ with open(f"text/{args.translation}.json") as f:
21
+ bible_data = [verse for verse in json.load(f) if len(verse["text"]) > 0]
22
+
23
+ grouped_bible_data = groupby(bible_data, lambda item: (item["book"], item["chapter"]))
24
+
25
+ model_name = args.model
26
+
27
+ def chunk_sentences(sentences, chunk_size=128):
28
+ """Split sentences into chunks of specified size."""
29
+ for i in range(0, len(sentences), chunk_size):
30
+ yield sentences[i:i + chunk_size]
31
+
32
+ @retry(wait=wait_exponential(multiplier=2, min=2, max=30), before_sleep=before_sleep_log(logger, logging.WARNING))
33
+ def get_embeddings(sentences):
34
+ all_embeddings = []
35
+ for chunk in chunk_sentences(sentences):
36
+ embeddings = vo.embed(texts=chunk, model=model_name).embeddings
37
+ all_embeddings.extend(embeddings)
38
+ return all_embeddings
39
+
40
+ for (book, chapter), grouped in grouped_bible_data:
41
+ print(f"Embedding {book} {chapter}")
42
+ verses = list(grouped)
43
+ data = []
44
+ base_path = os.path.join("embeddings", book, str(chapter).zfill(3))
45
+ os.makedirs(base_path, exist_ok=True)
46
+ sentences = [verse["text"] for verse in verses]
47
+ embeddings = get_embeddings(sentences)
48
+ for i, verse in enumerate(verses):
49
+ data.append({ "book": verse["book"], "chapter": verse["chapter"], "verse": verse["verse"], "embedding": embeddings[i] })
50
+ with open(os.path.join(base_path, f"{args.translation}-{model_name}.json"), "w", encoding='utf-8') as f:
51
+ json.dump(data, f, indent=2)
embeddings/1 Chronicles/001/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b31dd65966e9d0e3bbf6b8f296903ffe5aa53492b2951f7d28d66efa35266f7
3
+ size 1562038
embeddings/1 Chronicles/002/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8788c39cee55ca182ae080b5c6c28cdd55a8d8c2e70de03f508fd26b1a1b2d2d
3
+ size 1591514
embeddings/1 Chronicles/003/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3841ca84c1ec771f1e4620b7e51af469f8fb8c862bb1f7985a6884e5e458bdf9
3
+ size 693986
embeddings/1 Chronicles/004/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16052bfced8acfc2f6468ae35abb386f25e661eb08578f0c51222936d9643293
3
+ size 1243873
embeddings/1 Chronicles/005/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9c4fd67dab6e910ab2fcef471af3a83eb209a3040669434fceb454a9c75008f
3
+ size 752297
embeddings/1 Chronicles/006/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b29d4181849ba9eec68da845f21a977325756b4c48f90e3e67e552a2ad35e82b
3
+ size 2343130
embeddings/1 Chronicles/007/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ea8f4ac7909e8d0140b6772642e720a0951655b0a37d436dd3dcc6aac21c476
3
+ size 1157315
embeddings/1 Chronicles/008/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a241ce1c210ae8c5186d4e9760216353353740f0bce00e6c019d154a2684e2f
3
+ size 1157341
embeddings/1 Chronicles/009/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1abe93303e070f9801ec8fc090edd0f9601d7382c6b90506295e0c79cfa6c907
3
+ size 1272973
embeddings/1 Chronicles/010/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a71769c014c8d58c3f6d35a0c3e39012b168ac776d4d4ac792d0a5872b7c5aaa
3
+ size 405236
embeddings/1 Chronicles/011/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c97b99a1251ccbe22861c8391ae20ecbfa709e948e479a2f56d9cfadfa07df70
3
+ size 1360008
embeddings/1 Chronicles/012/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:229635f9b12da1dbf3bfe4dc3087ca75fd77b92e4bcb135a9c29399426c410be
3
+ size 1157289
embeddings/1 Chronicles/013/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f61417cb81954d0b91f64e3d3889524bbcc780ba8957386d7fdce47360c99eb
3
+ size 405067
embeddings/1 Chronicles/014/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c31a9dbd58a6abc91dec8764d51497fec6fed9b77fce1616fddbab3ac59b9d5
3
+ size 492149
embeddings/1 Chronicles/015/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2681c7da380cbfe60ddf8fe140d23cca3b26e3860cf20faa8c7393cec1ad8f3
3
+ size 839063
embeddings/1 Chronicles/016/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae506439ede17c0f1ede771e1924e54f05df5fe8d3c14953596a9f25186d76aa
3
+ size 1244565
embeddings/1 Chronicles/017/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6bc62368b8d620b998577b01c689a3caf5b92568b5467f93bbe795d738ab6829
3
+ size 781094
embeddings/1 Chronicles/018/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc49ba74a003e9d39c55f8fb75bc29e82219353008ef4742ab6d8e6412ce52c6
3
+ size 491933
embeddings/1 Chronicles/019/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ee9b5470d6a0b85ce857cc5ee42716f6258126976d5d89ab5450a6cb63f4d58
3
+ size 549986
embeddings/1 Chronicles/020/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2d8dea352f421da20dbc282b571f7a0ad08e9b48b9e85628c3ed0342d651b9e7
3
+ size 231529
embeddings/1 Chronicles/021/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0bbfb1241f6fdacf7b87ae782c9ba845a6ef8a8003a7bce9b18110ee02af273
3
+ size 868117
embeddings/1 Chronicles/022/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37e07eb432df8895078429a43adf94b34de86005aad9a36d6716635afe9684c4
3
+ size 549672
embeddings/1 Chronicles/023/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9383d04a0d0d0600a44bd980a1e53d056abe8eab70a778b5e5eaf900359057ad
3
+ size 925885
embeddings/1 Chronicles/024/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6265233765c0d54ca421f5d6b02255bb641085089a9ab902a34fcb2b292c7986
3
+ size 897018
embeddings/1 Chronicles/025/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16555d615414fc42ced88da3bb8f9627da534a74df826ef9d2949277b18c6fb3
3
+ size 896802
embeddings/1 Chronicles/026/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b8cb7ba4587cfac4ce1dcfb7462b2e9be7e139dbda4bd9234b61bf529d35e9f
3
+ size 925732
embeddings/1 Chronicles/027/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e050292e444a53e1dd5779efeddbe0c93dc16a7744ac999aa3f68c3804a116c1
3
+ size 984077
embeddings/1 Chronicles/028/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8d6938605c9d7bcc9ea6b5520287a3d8c32a81dd39ec942844c340eb67f34c5
3
+ size 607632
embeddings/1 Chronicles/029/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5c8c52729a233f673024b71ec647f8bcc0639a9604cdc295e297eaad8b4a4db
3
+ size 867915
embeddings/1 Corinthians/001/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:257f9673653bea32e52b3c4402036298bc403448e060379cae5b0eb8ebd2ee5f
3
+ size 897111
embeddings/1 Corinthians/002/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:181fd96da7684c97bb30d7ed8329cf94d8b6936cf877c4978f5c77fb6454bdaa
3
+ size 463053
embeddings/1 Corinthians/003/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8314e0c60532bd144497db4c5a9c9e644eb9c2c5465c71f253a4f3cda8981267
3
+ size 665723
embeddings/1 Corinthians/004/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:425ff054d769ce17fbf9586b737a46344782ab0b8b8d6cc2326b7f0146a92aeb
3
+ size 607750
embeddings/1 Corinthians/005/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92c8befe31cc60245670caac0b15f811ff8a039052b45520e8da65ce75273799
3
+ size 376258
embeddings/1 Corinthians/006/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9fa09bc97250c388216b7474f14021edd1ea13cd78c864349c32e7f22fdbc14
3
+ size 578745
embeddings/1 Corinthians/007/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cd0f9172c5d5abfdb6d2fd23bfbee23dec9dd5438292b2034bbe9cc0a774e612
3
+ size 1157398
embeddings/1 Corinthians/008/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0d74468e5ae353702413cd90990d2c920ecbe22b49a37f56040d06b54b29a701
3
+ size 376207
embeddings/1 Corinthians/009/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:632dcb92afc5dfa6398f67159417a548c035f0d3b41c1a156ab046424db67897
3
+ size 781500
embeddings/1 Corinthians/010/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06f4d177823e53705d4deddc1c4eae5ee0f72c140d3fe89cfb2f715044672bb9
3
+ size 954888
embeddings/1 Corinthians/011/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7d82a89990cdfd64f31fd1382f31924ac0014206fc7cbb290671272b1f02930
3
+ size 984145
embeddings/1 Corinthians/012/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:298da38ff7631e538d0b51403077f9262db1dc9bf20d1e5d661ce12131277fa9
3
+ size 897374
embeddings/1 Corinthians/013/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc54e5af6c908d67f317859e294ade9de8683dfad7fe10c8f13e872433c020aa
3
+ size 376180
embeddings/1 Corinthians/014/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bfbe0ab0ef8bf83dbba3022c875e95b90bb819e44f0f023d066684963397f3c3
3
+ size 1157478
embeddings/1 Corinthians/015/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a22e72357dd678e5b19189161592bb2a55311fbef85dcead12a5477e3ff566c3
3
+ size 1678389
embeddings/1 Corinthians/016/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53b08c895c6a03a7cd63a01d2ab350777422d1601eb13fa0d0ef79ed7a522ac0
3
+ size 694391
embeddings/1 John/001/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:736791716bc143260ec414e2caeeadcf702b16008541f368cdd14948c6b5b526
3
+ size 289347
embeddings/1 John/002/bsb-voyage-3.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2093fe0083100b2d7dc022d325c5c2deefd0b109209ab536316179a5d5cb4566
3
+ size 838691