Skip to content

Commit 3121917

Browse files
Geo API depricated.
1 parent 0baa138 commit 3121917

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

jigsawstack/__init__.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from .sentiment import Sentiment, AsyncSentiment
1212
from .validate import Validate, AsyncValidate
1313
from .summary import Summary, AsyncSummary
14-
from .geo import Geo, AsyncGeo
1514
from .prompt_engine import PromptEngine, AsyncPromptEngine
1615
from .embedding import Embedding, AsyncEmbedding
1716
from .exceptions import JigsawStackError
@@ -25,7 +24,6 @@ class JigsawStack:
2524
file: Store
2625
web: Web
2726
search: Search
28-
geo: Geo
2927
prompt_engine: PromptEngine
3028
api_key: str
3129
api_url: str
@@ -103,11 +101,7 @@ def __init__(
103101
api_url=api_url,
104102
disable_request_logging=disable_request_logging,
105103
).translate
106-
self.geo = Geo(
107-
api_key=api_key,
108-
api_url=api_url,
109-
disable_request_logging=disable_request_logging,
110-
)
104+
111105
self.prompt_engine = PromptEngine(
112106
api_key=api_key,
113107
api_url=api_url,
@@ -126,7 +120,6 @@ def __init__(
126120

127121

128122
class AsyncJigsawStack:
129-
geo: AsyncGeo
130123
validate: AsyncValidate
131124
web: AsyncWeb
132125
audio: AsyncAudio
@@ -166,12 +159,6 @@ def __init__(
166159
disable_request_logging=disable_request_logging,
167160
)
168161

169-
self.geo = AsyncGeo(
170-
api_key=api_key,
171-
api_url=api_url,
172-
disable_request_logging=disable_request_logging,
173-
)
174-
175162
self.validate = AsyncValidate(
176163
api_key=api_key,
177164
api_url=api_url,

jigsawstack/helpers.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Helper method that:
2+
# Accepts a dictionary ro typed dictionary or None
3+
# Also accepts a path for url endpont,
4+
# Builds the url endpoint with non None values where the key is the parameter name & the value is the parameter value
5+
# Returns the url endpoint with the parameters
6+
from typing import Dict, Optional, Union
7+
from urllib.parse import urlencode
8+
9+
def build_path(base_path: str, params: Optional[Dict[str, Union[str, int, bool]]] = None) -> str:
10+
"""
11+
Build an API endpoint path with query parameters.
12+
13+
Args:
14+
base_path (str): The base path endpoint (e.g. '/store/file')
15+
params (Optional[Dict[str, Union[str, int, bool]]]): A dictionary of query parameters
16+
17+
Returns:
18+
str: The constructed path with query parameters
19+
"""
20+
if params is None:
21+
return base_path
22+
23+
#remove None values from the parameters
24+
filtered_params = {k: v for k, v in params.items() if v is not None}
25+
26+
#encode the parameters
27+
return f"{base_path}?{urlencode(filtered_params)}" if filtered_params else base_path
28+
29+

0 commit comments

Comments
 (0)