readme, bugfixes, dedup

Kaveen Kumarasinghe 1 year ago
parent 49ea116914
commit a2c5f9c3da

@ -140,6 +140,9 @@ class SearchService(discord.Cog, name="SearchService"):
)
urls = "\n".join(f"<{url}>" for url in urls)
# Deduplicate the urls
urls = "\n".join(dict.fromkeys(urls.split("\n")))
if from_followup:
original_link, followup_question = (
from_followup.original_link,

@ -7,4 +7,6 @@ GOOGLE_SEARCH_ENGINE_ID="...."
You first need to create a programmable search engine and get the search engine ID: https://developers.google.com/custom-search/docs/tutorial/creatingcse
Then you can get the API key, click the "Get a key" button on this page: https://developers.google.com/custom-search/v1/introduction
Then you can get the API key, click the "Get a key" button on this page: https://developers.google.com/custom-search/v1/introduction
You can limit the max price that is charged for a single search request by setting `MAX_SEARCH_PRICE` in your `.env` file.

@ -16,4 +16,4 @@ You can also compose a singular index with itself with "Deep Compose", this will
Doing a deep composition will also allow you to use the `child_branch_factor` parameter for `/index query`, increasing this past 1 will take a much longer time to query and will be much more expensive for large documents, so be wary.
**When doing Deep Compositions, it's highly reccomended to keep the document size small, or only do deep compositions on single documents.** This is because a deep composition reorganizes the simple index into a tree structure and uses GPT3 to summarize different nodes of the tree, which will lead to high costs. For example, a deep composition of a 300 page lab manual and the contents of my personal website at https://kaveenk.com cost me $2 USD roughly.
**When doing Deep Compositions, it's highly recommended to keep the document size small, or only do deep compositions on single documents.** This is because a deep composition reorganizes the simple index into a tree structure and uses GPT3 to summarize different nodes of the tree, which will lead to high costs. For example, a deep composition of a 300 page lab manual and the contents of my personal website at https://kaveenk.com cost me $2 USD roughly. To save on costs, you can limit the max price a deep composition can charge you by setting `MAX_DEEP_COMPOSE_PRICE` in your `.env` file.

@ -596,7 +596,7 @@ class Index_handler:
)
# Save the composed index
tree_index.save_to_disk(f"indexes/{user_id}/{name}.json")
tree_index.save_to_disk(f"indexes/{user_id}/{name}")
self.index_storage[user_id].queryable_index = tree_index
else:
@ -624,7 +624,7 @@ class Index_handler:
name = f"composed_index_{date.today().month}_{date.today().day}.json"
# Save the composed index
simple_index.save_to_disk(f"indexes/{user_id}/{name}.json")
simple_index.save_to_disk(f"indexes/{user_id}/{name}")
self.index_storage[user_id].queryable_index = simple_index
async def backup_discord(

@ -45,3 +45,9 @@ FORCE_ENGLISH = "False"
# The welcome message to send it the welcome setting is set to true
WELCOME_MESSAGE = "Hi There! Welcome to our Discord server. We hope you'll enjoy our server and we look forward to engaging with you!" # This is a fallback message if gpt3 fails to generate a welcome message.
# Max price to pay for a single search request
MAX_SEARCH_PRICE = 1.00
# Max price to pay for a deep composition
MAX_DEEP_COMPOSE_PRICE = 3.00
Loading…
Cancel
Save