Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save theoknock/4d3d7bb2c2eb95abb8d3a8b708ef1da8 to your computer and use it in GitHub Desktop.
Save theoknock/4d3d7bb2c2eb95abb8d3a8b708ef1da8 to your computer and use it in GitHub Desktop.
Gemini _Pro_1.5-Bible-Verse-Topical-Search.py
"""
Install the Google AI Python SDK
$ pip install google-generativeai
See the getting started guide for more information:
https://ai.google.dev/gemini-api/docs/get-started/python
"""
import os
import google.generativeai as genai
genai.configure(api_key=os.environ["GEMINI_API_KEY"])
# Create the model
# See https://ai.google.dev/api/python/google/generativeai/GenerativeModel
generation_config = {
"temperature": 0.85,
"top_p": 0.95,
"top_k": 64,
"max_output_tokens": 8192,
"response_mime_type": "text/plain",
}
model = genai.GenerativeModel(
model_name="gemini-1.5-pro",
generation_config=generation_config,
# safety_settings = Adjust safety settings
# See https://ai.google.dev/gemini-api/docs/safety-settings
)
chat_session = model.start_chat(
history=[
{
"role": "user",
"parts": [
"Your role is to find a positive match between a given criteria and a specified Bible verse.\n\nWhen provided by the criteria and a list of verses, your task will be to conduct a verse-by-verse analysis in the order they are listed in the Bible and then verify whether the result is a true comparison.\n\nYour response will be an exhaustive list of verses that match, each cited in the standard way, starting with the verse text, followed by the book name, chapter number, verse number, and Bible version (for example, “James 5:12 KJV”).\n\nApply this format to each matching verse in your response:\n\n<!-- new line -->\n[verse text]\n<!-- next line --> [book] [chapter] [verse number(s)] [version abbreviation]\n\nDo not improvise or deviate from this response format. No bullets, no markdown, no styling; omit chatter. List the verses in order. List each match once. Do not list verses that don’t match.\n\nAlthough this is a verse-by-verse analysis, the list of verses provided may be referenced in groups according to books in the King James biblical anthology instead of individually. When a book of verses is provided, create the list of its verses before conducting the match operation.",
],
},
{
"role": "model",
"parts": [
"Okay, I understand. Please provide me with:\n\n1. **The criteria** you want to match against. Be as specific as possible. \n2. **The list of verses** you want me to analyze. You can list them individually or by book.\n\nI will then provide you with an exhaustive list of matching verses, formatted as instructed. \n",
],
},
{
"role": "user",
"parts": [
"Money in Proverbs",
],
},
{
"role": "model",
"parts": [
"I need more specific criteria. For example, are you looking for verses about:\n\n* **The dangers of wealth?**\n* **The right use of money?**\n* **Seeking wealth vs. seeking wisdom?**\n\nPlease clarify your criteria so I can provide you with an accurate list of matching verses. \n",
],
},
{
"role": "user",
"parts": [
"Every verse that even remotely references money or wealth or riches or abundance or poverty or charity or finances or material possessions.",
],
},
{
"role": "model",
"parts": [
"The fear of the LORD tendeth to life: and he that hath it shall abide satisfied; he shall not be visited with evil.\nProverbs 19:23 KJV\n\nWealth gotten by vanity shall be diminished: but he that gathereth by labour shall increase.\nProverbs 13:11 KJV\n\nHe that by usury and unjust gain increaseth his substance, he shall gather it for him that will pity the poor.\nProverbs 28:8 KJV\n\nHe that is greedy of gain troubleth his own house; but he that hateth gifts shall live.\nProverbs 15:27 KJV\n\nBetter is little with the fear of the LORD than great treasure and trouble therewith.\nProverbs 15:16 KJV\n\nLabour not to be rich: cease from thine own wisdom.\nProverbs 23:4 KJV\n\nThere is that maketh himself rich, yet hath nothing: there is that maketh himself poor, yet hath great riches.\nProverbs 13:7 KJV\n\nThe rich man's wealth is his strong city: the destruction of the poor is their poverty.\nProverbs 10:15 KJV\n\nRemove not the old landmark; and enter not into the fields of the fatherless:\nProverbs 23:10 KJV\n\nHe that oppresseth the poor to increase his riches, and he that giveth to the rich, shall surely come to want.\nProverbs 22:16 KJV\n\nHe that tilleth his land shall have plenty of bread: but he that followeth after vain persons shall have poverty enough.\nProverbs 28:19 KJV\n\nA good name is rather to be chosen than great riches, and loving favour rather than silver and gold.\nProverbs 22:1 KJV\n\nThe rich ruleth over the poor, and the borrower is servant to the lender.\nProverbs 22:7 KJV\n\nBe not thou one of them that strike hands, or of them that are sureties for debts.\nProverbs 22:26 KJV\n\nWhoso stoppeth his ears at the cry of the poor, he also shall cry himself, but shall not be heard.\nProverbs 21:13 KJV\n\nHe that hath a bountiful eye shall be blessed; for he giveth of his bread to the poor.\nProverbs 22:9 KJV\n\nThe thoughts of the diligent tend only to plenteousness; but of every one that is hasty only to want.\nProverbs 21:5 KJV\n\nGive me neither poverty nor riches; feed me with food convenient for me:\nProverbs 30:8 KJV\n\nWealth maketh many friends; but the poor is separated from his neighbour.\nProverbs 19:4 KJV\n\nHe that trusteth in his riches shall fall: but the righteous shall flourish as a branch.\nProverbs 11:28 KJV\n\nThe blessing of the LORD, it maketh rich, and he addeth no sorrow with it.\nProverbs 10:22 KJV\n\nIn the house of the righteous is much treasure: but in the revenues of the wicked is trouble.\nProverbs 15:6 KJV\n\nThe desire of the slothful killeth him; for his hands refuse to labour.\nProverbs 21:25 KJV\n\nHe that is slothful in his work is brother to him that is a great waster.\nProverbs 18:9 KJV\n\nThe LORD will not suffer the soul of the righteous to famish: but he casteth away the substance of the wicked.\nProverbs 10:3 KJV\n\nHe that loveth pleasure shall be a poor man: he that loveth wine and oil shall not be rich.\nProverbs 21:17 KJV\n\nThe wicked borroweth, and payeth not again: but the righteous sheweth mercy, and giveth.\nPsalm 37:21 KJV\n\nHonour the LORD with thy substance, and with the firstfruits of all thine increase:\nProverbs 3:9 KJV\n\nA little that a righteous man hath is better than the riches of many wicked.\nPsalm 37:16 KJV\n\nHe that giveth unto the poor shall not lack: but he that hideth his eyes shall have many a curse.\nProverbs 28:27 KJV\n",
],
},
]
)
response = chat_session.send_message("INSERT_INPUT_HERE")
print(response.text)
@theoknock
Copy link
Author

Sample prompt:

Money in Proverbs.

Expected response:

The fear of the LORD tendeth to life: and he that hath it shall abide satisfied; he shall not be visited with evil.
Proverbs 19:23 KJV

Wealth gotten by vanity shall be diminished: but he that gathereth by labour shall increase.
Proverbs 13:11 KJV

He that by usury and unjust gain increaseth his substance, he shall gather it for him that will pity the poor.
Proverbs 28:8 KJV

He that is greedy of gain troubleth his own house; but he that hateth gifts shall live.
Proverbs 15:27 KJV

Better is little with the fear of the LORD than great treasure and trouble therewith.
Proverbs 15:16 KJV

Labour not to be rich: cease from thine own wisdom.
Proverbs 23:4 KJV

There is that maketh himself rich, yet hath nothing: there is that maketh himself poor, yet hath great riches.
Proverbs 13:7 KJV

The rich man's wealth is his strong city: the destruction of the poor is their poverty.
Proverbs 10:15 KJV

Remove not the old landmark; and enter not into the fields of the fatherless:
Proverbs 23:10 KJV

He that oppresseth the poor to increase his riches, and he that giveth to the rich, shall surely come to want.
Proverbs 22:16 KJV

He that tilleth his land shall have plenty of bread: but he that followeth after vain persons shall have poverty enough.
Proverbs 28:19 KJV

A good name is rather to be chosen than great riches, and loving favour rather than silver and gold.
Proverbs 22:1 KJV

The rich ruleth over the poor, and the borrower is servant to the lender.
Proverbs 22:7 KJV

Be not thou one of them that strike hands, or of them that are sureties for debts.
Proverbs 22:26 KJV

Whoso stoppeth his ears at the cry of the poor, he also shall cry himself, but shall not be heard.
Proverbs 21:13 KJV

He that hath a bountiful eye shall be blessed; for he giveth of his bread to the poor.
Proverbs 22:9 KJV

The thoughts of the diligent tend only to plenteousness; but of every one that is hasty only to want.
Proverbs 21:5 KJV

Give me neither poverty nor riches; feed me with food convenient for me:
Proverbs 30:8 KJV

Wealth maketh many friends; but the poor is separated from his neighbour.
Proverbs 19:4 KJV

He that trusteth in his riches shall fall: but the righteous shall flourish as a branch.
Proverbs 11:28 KJV

The blessing of the LORD, it maketh rich, and he addeth no sorrow with it.
Proverbs 10:22 KJV

In the house of the righteous is much treasure: but in the revenues of the wicked is trouble.
Proverbs 15:6 KJV

The desire of the slothful killeth him; for his hands refuse to labour.
Proverbs 21:25 KJV

He that is slothful in his work is brother to him that is a great waster.
Proverbs 18:9 KJV

The LORD will not suffer the soul of the righteous to famish: but he casteth away the substance of the wicked.
Proverbs 10:3 KJV

He that loveth pleasure shall be a poor man: he that loveth wine and oil shall not be rich.
Proverbs 21:17 KJV

The wicked borroweth, and payeth not again: but the righteous sheweth mercy, and giveth.
Psalm 37:21 KJV

Honour the LORD with thy substance, and with the firstfruits of all thine increase:
Proverbs 3:9 KJV

A little that a righteous man hath is better than the riches of many wicked.
Psalm 37:16 KJV

He that giveth unto the poor shall not lack: but he that hideth his eyes shall have many a curse.
Proverbs 28:27 KJV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment