Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
cr
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryjliu committed Jan 25, 2024
1 parent 276b903 commit 61a324d
Show file tree
Hide file tree
Showing 2 changed files with 231 additions and 50 deletions.
11 changes: 9 additions & 2 deletions llama_hub/tools/exa/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,19 @@ class ExaToolSpec(BaseToolSpec):
"current_date",
]

def __init__(self, api_key: str, verbose: bool = True) -> None:
def __init__(
self,
api_key: str,
verbose: bool = True,
max_characters: int = 2000,
) -> None:
"""Initialize with parameters."""
from exa_py import Exa

self.client = Exa(api_key=api_key, user_agent="llama-index")
self._verbose = verbose
# max characters for the text field in the search_and_contents function
self._max_characters = max_characters

def search(
self,
Expand Down Expand Up @@ -128,7 +135,7 @@ def search_and_retrieve_documents(
start_published_date=start_published_date,
end_published_date=end_published_date,
use_autoprompt=True,
text={"max_characters": 500},
text={"max_characters": self._max_characters},
)
if self._verbose:
print(f"[Exa Tool] Autoprompt: {response.autoprompt_string}")
Expand Down
Loading

0 comments on commit 61a324d

Please sign in to comment.