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 all commits
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tonic-textual"
version = "3.0.0"
version = "3.0.1"
description = "Wrappers around the Tonic Textual API"
authors = ["Adam Kamor <[email protected]>", "Joe Ferrara <[email protected]>", "Ander Steele <[email protected]>", "Ethan Philpott <[email protected]>", "Lyon Van Voorhis <[email protected]>", "Kirill Medvedev <[email protected]>", "Travis Matthews <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion tonic_textual/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.0.0"
__version__ = "3.0.1"
9 changes: 5 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: str = "https://textual.tonic.ai", api_key: Optional[str] = None, verify: bool = True
):
if api_key is None:
api_key = os.environ.get("TONIC_TEXTUAL_API_KEY")
Expand All @@ -58,6 +58,7 @@ def __init__(
"key as the value of the TEXTUAL_API_KEY environment "
"variable."
)

self.api_key = api_key
self.client = HttpClient(base_url, self.api_key, verify)
self.verify = verify
Expand Down
6 changes: 4 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: str = "https://textual.tonic.ai", api_key: Optional[str] = None, verify: bool = True
):
if api_key is None:
api_key = os.environ.get("TONIC_TEXTUAL_API_KEY")
Expand All @@ -61,6 +61,8 @@ def __init__(
"key as the value of the TONIC_TEXTUAL_API_KEY environment "
"variable."
)


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