Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ As its underlying LLM, you can choose to run it either with:
* Gemini (it will use 2.0 Flash) [preferred and default option]
* Claude (it will use Haiku 3.5) [experimental]
* Claude via AWS Bedrock (it will use Haiku 3.5) [experimental]
* Nova Pro via AWS Bedrock [experimental]

Gemini is preferred because:
* it has a free tier - we privilege cost-effectiveness over speed, which means for short conversations you should be within the quotas of the free tier
Expand Down
3 changes: 2 additions & 1 deletion evals/evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ async def main():

load_dotenv()

for model_family in ["gemini", "claude", "claude-aws-bedrock"]:
# for model_family in ["gemini", "claude", "claude-aws-bedrock", "nova-pro-aws-bedrock"]:
Comment thread
bernomone marked this conversation as resolved.
Outdated
for model_family in ["nova-pro-aws-bedrock"]:

if model_family == "gemini" and os.getenv("GEMINI_API_KEY") is None:
console.print(
Expand Down
1 change: 1 addition & 0 deletions src/askademic/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
GEMINI_2_FLASH_MODEL_ID = "gemini-2.0-flash"
CLAUDE_HAIKU_3_5_MODEL_ID = "anthropic:claude-3-5-haiku-latest"
CLAUDE_HAIKU_3_5_BEDROCK_MODEL_ID = "{region}.anthropic.claude-3-5-haiku-20241022-v1:0"
NOVA_PRO_BEDORCK_MODEL_ID = "{region}.amazon.nova-pro-v1:0"
MISTRAL_LARGE_MODEL_ID = "mistral:mistral-large-latest"

# ARXIV URLS
Expand Down
5 changes: 3 additions & 2 deletions src/askademic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def check_environment_variables(user_model: str):
"[bold red]The ANTHROPIC_API_KEY environment variable is not set.[/bold red]"
)
sys.exit()
elif user_model == "claude-aws-bedrock":
elif user_model in ("claude-aws-bedrock", "nova-pro-aws-bedrock"):
try:
_ = boto3.client("sts").get_caller_identity()
except boto3.exceptions.ClientError:
Expand All @@ -74,7 +74,8 @@ async def check_environment_variables(user_model: str):
else:
console.print(
"[bold red]Invalid model family selected. "
+ "Please choose 'gemini', 'claude', or 'claude-aws-bedrock'.[/bold red]"
+ "Please choose 'gemini', 'claude', 'claude-aws-bedrock'"
+ " or 'nova-pro-aws-bedrock'.[/bold red]"
)
sys.exit()

Expand Down
21 changes: 17 additions & 4 deletions src/askademic/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
CLAUDE_HAIKU_3_5_BEDROCK_MODEL_ID,
CLAUDE_HAIKU_3_5_MODEL_ID,
GEMINI_2_FLASH_MODEL_ID,
NOVA_PRO_BEDORCK_MODEL_ID,
Comment thread
bernomone marked this conversation as resolved.
Outdated
)

today = datetime.now().strftime("%Y-%m-%d")
Expand All @@ -26,7 +27,12 @@ def choose_model(model_family: str = "gemini") -> Tuple[Model, ModelSettings]:
"""
Choose the model ID based on the given model family.
"""
if model_family not in ["gemini", "claude", "claude-aws-bedrock"]:
if model_family not in [
"gemini",
"claude",
"claude-aws-bedrock",
"nova-pro-aws-bedrock",
]:
raise ValueError(f"Invalid model family '{model_family}'.")

if model_family == "gemini":
Expand All @@ -39,13 +45,20 @@ def choose_model(model_family: str = "gemini") -> Tuple[Model, ModelSettings]:
model = AnthropicModel(model_name=model_name)
model_settings = ModelSettings(max_tokens=1000, temperature=0)
return model, model_settings
elif model_family == "claude-aws-bedrock":
elif model_family in ("claude-aws-bedrock", "nova-pro-aws-bedrock"):

model_id = (
CLAUDE_HAIKU_3_5_BEDROCK_MODEL_ID
if model_family == "claude-aws-bedrock"
else NOVA_PRO_BEDORCK_MODEL_ID
)

region = boto3.session.Session().region_name
if not region:
model_name = CLAUDE_HAIKU_3_5_BEDROCK_MODEL_ID.format(region="us")
model_name = model_id.format(region="us")
else:
region = region.split("-")[0]
model_name = CLAUDE_HAIKU_3_5_BEDROCK_MODEL_ID.format(region=region)
model_name = model_id.format(region=region)

model_settings = BedrockModelSettings(
temperature=0,
Expand Down