Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont require a base url, instead default to our cloud environment #6

Merged
merged 3 commits into from
Nov 21, 2024
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
11 changes: 7 additions & 4 deletions tonic_textual/parse_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class TextualParse:

Parameters
----------
base_url : str
The URL to your Tonic Textual instance. Do not include trailing backslashes.
api_key : str
base_url : Optional[str]
The URL to your Tonic Textual instance. Do not include trailing backslashes. The default value is https://textual.tonic.ai.
api_key : Optional[str]
Your API token. This argument is optional. Instead of providing the API token
here, it is recommended that you set the API key in your environment as the
value of TEXTUAL_API_KEY.
Expand All @@ -48,7 +48,7 @@ class TextualParse:
"""

def __init__(
self, base_url: str, api_key: Optional[str] = None, verify: bool = True
self, base_url: Optional[str] = None, api_key: Optional[str] = None, verify: bool = True
akamor marked this conversation as resolved.
Show resolved Hide resolved
):
if api_key is None:
api_key = os.environ.get("TONIC_TEXTUAL_API_KEY")
Expand All @@ -58,6 +58,9 @@ def __init__(
"key as the value of the TEXTUAL_API_KEY environment "
"variable."
)
if base_url is None:
akamor marked this conversation as resolved.
Show resolved Hide resolved
base_url = 'https://textual.tonic.ai'
akamor marked this conversation as resolved.
Show resolved Hide resolved

self.api_key = api_key
self.client = HttpClient(base_url, self.api_key, verify)
self.verify = verify
Expand Down
8 changes: 6 additions & 2 deletions tonic_textual/redact_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TextualNer:
Parameters
----------
base_url : str
The URL to your Tonic Textual instance. Do not include trailing backslashes.
The URL to your Tonic Textual instance. Do not include trailing backslashes. The default value is https://textual.tonic.ai.
api_key : str
Your API token. This argument is optional. Instead of providing the API token
here, it is recommended that you set the API key in your environment as the
Expand All @@ -51,7 +51,7 @@ class TextualNer:
"""

def __init__(
self, base_url: str, api_key: Optional[str] = None, verify: bool = True
self, base_url: Optional[str] = None, api_key: Optional[str] = None, verify: bool = True
akamor marked this conversation as resolved.
Show resolved Hide resolved
):
if api_key is None:
api_key = os.environ.get("TONIC_TEXTUAL_API_KEY")
Expand All @@ -61,6 +61,10 @@ def __init__(
"key as the value of the TONIC_TEXTUAL_API_KEY environment "
"variable."
)

if base_url is None:
akamor marked this conversation as resolved.
Show resolved Hide resolved
base_url = 'https://textual.tonic.ai'
akamor marked this conversation as resolved.
Show resolved Hide resolved

self.api_key = api_key
self.client = HttpClient(base_url, self.api_key, verify)
self.dataset_service = DatasetService(self.client)
Expand Down