Skip to content

Commit

Permalink
Stored openrouter url in env. removed assertion.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhiBrandon committed Nov 27, 2023
1 parent 695cec8 commit 1f2b85d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/open_source_examples/openrouter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
raise ValueError("OPENROUTER_API_KEY is not set in environment variables")

# Base URL for OpenAI
openrouter_base_url = "https://openrouter.ai/api/v1"
openrouter_base_url = os.environ.get("OPENROUTER_BASE_URL")
if not openrouter_base_url:
raise ValueError("OPENROUTER_BASE_URL is not set in environment variables")

# Pydantic model for user details

Expand Down Expand Up @@ -103,5 +105,4 @@ def create_user_message(content: str, error=False) -> dict:
raise ValueError(user.message)

if user.result:
assert isinstance(user, MaybeUser)
print(user.result)

0 comments on commit 1f2b85d

Please sign in to comment.