athena-intelligence 0.1.72__tar.gz → 0.1.74__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/PKG-INFO +1 -1
  2. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/pyproject.toml +1 -1
  3. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/__init__.py +10 -0
  4. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/core/client_wrapper.py +1 -1
  5. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/tools/client.py +168 -0
  6. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/__init__.py +10 -0
  7. athena_intelligence-0.1.74/src/athena/types/filter_model.py +28 -0
  8. athena_intelligence-0.1.74/src/athena/types/filter_operator.py +73 -0
  9. athena_intelligence-0.1.74/src/athena/types/query_model.py +34 -0
  10. athena_intelligence-0.1.74/src/athena/types/semantic_query_out.py +25 -0
  11. athena_intelligence-0.1.74/src/athena/types/time_dimension_model.py +29 -0
  12. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/README.md +0 -0
  13. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/base_client.py +0 -0
  14. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/chain/__init__.py +0 -0
  15. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/chain/client.py +0 -0
  16. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/client.py +0 -0
  17. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/core/__init__.py +0 -0
  18. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/core/api_error.py +0 -0
  19. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/core/datetime_utils.py +0 -0
  20. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/core/file.py +0 -0
  21. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/core/http_client.py +0 -0
  22. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/core/jsonable_encoder.py +0 -0
  23. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/core/pydantic_utilities.py +0 -0
  24. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/core/remove_none_from_dict.py +0 -0
  25. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/core/request_options.py +0 -0
  26. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/dataset/__init__.py +0 -0
  27. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/dataset/client.py +0 -0
  28. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/environment.py +0 -0
  29. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/errors/__init__.py +0 -0
  30. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/errors/unprocessable_entity_error.py +0 -0
  31. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/message/__init__.py +0 -0
  32. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/message/client.py +0 -0
  33. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/polling_message_client.py +0 -0
  34. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/py.typed +0 -0
  35. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/query/__init__.py +0 -0
  36. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/query/client.py +0 -0
  37. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/report/__init__.py +0 -0
  38. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/report/client.py +0 -0
  39. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/search/__init__.py +0 -0
  40. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/search/client.py +0 -0
  41. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/snippet/__init__.py +0 -0
  42. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/snippet/client.py +0 -0
  43. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/tools/__init__.py +0 -0
  44. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/convert_pdf_to_sheet_out.py +0 -0
  45. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/dataset.py +0 -0
  46. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/document.py +0 -0
  47. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/excecute_tool_first_workflow_out.py +0 -0
  48. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/file_data_response.py +0 -0
  49. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/firecrawl_scrape_url_data_reponse_dto.py +0 -0
  50. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/firecrawl_scrape_url_metadata.py +0 -0
  51. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/get_datasets_response.py +0 -0
  52. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/get_snippet_out.py +0 -0
  53. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/get_snippets_response.py +0 -0
  54. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/http_validation_error.py +0 -0
  55. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/langchain_documents_request_out.py +0 -0
  56. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/llm_model.py +0 -0
  57. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/map_reduce_chain_out.py +0 -0
  58. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/message_out.py +0 -0
  59. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/message_out_dto.py +0 -0
  60. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/model.py +0 -0
  61. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/publish_formats.py +0 -0
  62. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/report.py +0 -0
  63. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/researcher_out.py +0 -0
  64. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/snippet.py +0 -0
  65. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/sql_results.py +0 -0
  66. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/status_enum.py +0 -0
  67. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/structured_parse_result.py +0 -0
  68. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/tools.py +0 -0
  69. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/upload_documents_out.py +0 -0
  70. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/url_result.py +0 -0
  71. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/validation_error.py +0 -0
  72. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/validation_error_loc_item.py +0 -0
  73. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/types/workflow_status_out.py +0 -0
  74. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/upload/__init__.py +0 -0
  75. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/upload/client.py +0 -0
  76. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/version.py +0 -0
  77. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/workflow/__init__.py +0 -0
  78. {athena_intelligence-0.1.72 → athena_intelligence-0.1.74}/src/athena/workflow/client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: athena-intelligence
3
- Version: 0.1.72
3
+ Version: 0.1.74
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "athena-intelligence"
3
- version = "0.1.72"
3
+ version = "0.1.74"
4
4
  description = ""
5
5
  readme = "README.md"
6
6
  authors = []
@@ -6,6 +6,8 @@ from .types import (
6
6
  Document,
7
7
  ExcecuteToolFirstWorkflowOut,
8
8
  FileDataResponse,
9
+ FilterModel,
10
+ FilterOperator,
9
11
  FirecrawlScrapeUrlDataReponseDto,
10
12
  FirecrawlScrapeUrlMetadata,
11
13
  GetDatasetsResponse,
@@ -19,12 +21,15 @@ from .types import (
19
21
  MessageOutDto,
20
22
  Model,
21
23
  PublishFormats,
24
+ QueryModel,
22
25
  Report,
23
26
  ResearcherOut,
27
+ SemanticQueryOut,
24
28
  Snippet,
25
29
  SqlResults,
26
30
  StatusEnum,
27
31
  StructuredParseResult,
32
+ TimeDimensionModel,
28
33
  Tools,
29
34
  UploadDocumentsOut,
30
35
  UrlResult,
@@ -44,6 +49,8 @@ __all__ = [
44
49
  "Document",
45
50
  "ExcecuteToolFirstWorkflowOut",
46
51
  "FileDataResponse",
52
+ "FilterModel",
53
+ "FilterOperator",
47
54
  "FirecrawlScrapeUrlDataReponseDto",
48
55
  "FirecrawlScrapeUrlMetadata",
49
56
  "GetDatasetsResponse",
@@ -57,12 +64,15 @@ __all__ = [
57
64
  "MessageOutDto",
58
65
  "Model",
59
66
  "PublishFormats",
67
+ "QueryModel",
60
68
  "Report",
61
69
  "ResearcherOut",
70
+ "SemanticQueryOut",
62
71
  "Snippet",
63
72
  "SqlResults",
64
73
  "StatusEnum",
65
74
  "StructuredParseResult",
75
+ "TimeDimensionModel",
66
76
  "Tools",
67
77
  "UnprocessableEntityError",
68
78
  "UploadDocumentsOut",
@@ -17,7 +17,7 @@ class BaseClientWrapper:
17
17
  headers: typing.Dict[str, str] = {
18
18
  "X-Fern-Language": "Python",
19
19
  "X-Fern-SDK-Name": "athena-intelligence",
20
- "X-Fern-SDK-Version": "0.1.72",
20
+ "X-Fern-SDK-Version": "0.1.74",
21
21
  }
22
22
  headers["X-API-KEY"] = self.api_key
23
23
  return headers
@@ -18,7 +18,9 @@ from ..types.http_validation_error import HttpValidationError
18
18
  from ..types.langchain_documents_request_out import LangchainDocumentsRequestOut
19
19
  from ..types.llm_model import LlmModel
20
20
  from ..types.publish_formats import PublishFormats
21
+ from ..types.query_model import QueryModel
21
22
  from ..types.researcher_out import ResearcherOut
23
+ from ..types.semantic_query_out import SemanticQueryOut
22
24
 
23
25
  # this is used as the default value for optional parameters
24
26
  OMIT = typing.cast(typing.Any, ...)
@@ -399,6 +401,89 @@ class ToolsClient:
399
401
  raise ApiError(status_code=_response.status_code, body=_response.text)
400
402
  raise ApiError(status_code=_response.status_code, body=_response_json)
401
403
 
404
+ def semantic_query(
405
+ self,
406
+ *,
407
+ query: QueryModel,
408
+ table_name: typing.Optional[str] = OMIT,
409
+ request_options: typing.Optional[RequestOptions] = None,
410
+ ) -> SemanticQueryOut:
411
+ """
412
+ Parameters:
413
+ - query: QueryModel.
414
+
415
+ - table_name: typing.Optional[str].
416
+
417
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
418
+ ---
419
+ from athena import FilterModel, FilterOperator, QueryModel, TimeDimensionModel
420
+ from athena.client import Athena
421
+
422
+ client = Athena(
423
+ api_key="YOUR_API_KEY",
424
+ )
425
+ client.tools.semantic_query(
426
+ query=QueryModel(
427
+ measures=["count"],
428
+ time_dimensions=[
429
+ TimeDimensionModel(
430
+ dimension="dimension",
431
+ granularity="granularity",
432
+ date_range=["dateRange"],
433
+ )
434
+ ],
435
+ dimensions=["manufacturer"],
436
+ filters=[
437
+ FilterModel(
438
+ dimension="manufacturer",
439
+ operator=FilterOperator.EQUALS,
440
+ values=["Athena"],
441
+ )
442
+ ],
443
+ ),
444
+ )
445
+ """
446
+ _request: typing.Dict[str, typing.Any] = {"query": query}
447
+ if table_name is not OMIT:
448
+ _request["table_name"] = table_name
449
+ _response = self._client_wrapper.httpx_client.request(
450
+ method="POST",
451
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/strict-semantic-query"),
452
+ params=jsonable_encoder(
453
+ request_options.get("additional_query_parameters") if request_options is not None else None
454
+ ),
455
+ json=jsonable_encoder(_request)
456
+ if request_options is None or request_options.get("additional_body_parameters") is None
457
+ else {
458
+ **jsonable_encoder(_request),
459
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
460
+ },
461
+ headers=jsonable_encoder(
462
+ remove_none_from_dict(
463
+ {
464
+ **self._client_wrapper.get_headers(),
465
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
466
+ }
467
+ )
468
+ ),
469
+ timeout=request_options.get("timeout_in_seconds")
470
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
471
+ else self._client_wrapper.get_timeout(),
472
+ retries=0,
473
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
474
+ )
475
+ if 200 <= _response.status_code < 300:
476
+ return pydantic_v1.parse_obj_as(SemanticQueryOut, _response.json()) # type: ignore
477
+ if _response.status_code == 422:
478
+ raise UnprocessableEntityError(
479
+ pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
480
+ )
481
+ try:
482
+ _response_json = _response.json()
483
+ except JSONDecodeError:
484
+ raise ApiError(status_code=_response.status_code, body=_response.text)
485
+ raise ApiError(status_code=_response.status_code, body=_response_json)
486
+
402
487
 
403
488
  class AsyncToolsClient:
404
489
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -774,3 +859,86 @@ class AsyncToolsClient:
774
859
  except JSONDecodeError:
775
860
  raise ApiError(status_code=_response.status_code, body=_response.text)
776
861
  raise ApiError(status_code=_response.status_code, body=_response_json)
862
+
863
+ async def semantic_query(
864
+ self,
865
+ *,
866
+ query: QueryModel,
867
+ table_name: typing.Optional[str] = OMIT,
868
+ request_options: typing.Optional[RequestOptions] = None,
869
+ ) -> SemanticQueryOut:
870
+ """
871
+ Parameters:
872
+ - query: QueryModel.
873
+
874
+ - table_name: typing.Optional[str].
875
+
876
+ - request_options: typing.Optional[RequestOptions]. Request-specific configuration.
877
+ ---
878
+ from athena import FilterModel, FilterOperator, QueryModel, TimeDimensionModel
879
+ from athena.client import AsyncAthena
880
+
881
+ client = AsyncAthena(
882
+ api_key="YOUR_API_KEY",
883
+ )
884
+ await client.tools.semantic_query(
885
+ query=QueryModel(
886
+ measures=["count"],
887
+ time_dimensions=[
888
+ TimeDimensionModel(
889
+ dimension="dimension",
890
+ granularity="granularity",
891
+ date_range=["dateRange"],
892
+ )
893
+ ],
894
+ dimensions=["manufacturer"],
895
+ filters=[
896
+ FilterModel(
897
+ dimension="manufacturer",
898
+ operator=FilterOperator.EQUALS,
899
+ values=["Athena"],
900
+ )
901
+ ],
902
+ ),
903
+ )
904
+ """
905
+ _request: typing.Dict[str, typing.Any] = {"query": query}
906
+ if table_name is not OMIT:
907
+ _request["table_name"] = table_name
908
+ _response = await self._client_wrapper.httpx_client.request(
909
+ method="POST",
910
+ url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v0/tools/strict-semantic-query"),
911
+ params=jsonable_encoder(
912
+ request_options.get("additional_query_parameters") if request_options is not None else None
913
+ ),
914
+ json=jsonable_encoder(_request)
915
+ if request_options is None or request_options.get("additional_body_parameters") is None
916
+ else {
917
+ **jsonable_encoder(_request),
918
+ **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
919
+ },
920
+ headers=jsonable_encoder(
921
+ remove_none_from_dict(
922
+ {
923
+ **self._client_wrapper.get_headers(),
924
+ **(request_options.get("additional_headers", {}) if request_options is not None else {}),
925
+ }
926
+ )
927
+ ),
928
+ timeout=request_options.get("timeout_in_seconds")
929
+ if request_options is not None and request_options.get("timeout_in_seconds") is not None
930
+ else self._client_wrapper.get_timeout(),
931
+ retries=0,
932
+ max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
933
+ )
934
+ if 200 <= _response.status_code < 300:
935
+ return pydantic_v1.parse_obj_as(SemanticQueryOut, _response.json()) # type: ignore
936
+ if _response.status_code == 422:
937
+ raise UnprocessableEntityError(
938
+ pydantic_v1.parse_obj_as(HttpValidationError, _response.json()) # type: ignore
939
+ )
940
+ try:
941
+ _response_json = _response.json()
942
+ except JSONDecodeError:
943
+ raise ApiError(status_code=_response.status_code, body=_response.text)
944
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -5,6 +5,8 @@ from .dataset import Dataset
5
5
  from .document import Document
6
6
  from .excecute_tool_first_workflow_out import ExcecuteToolFirstWorkflowOut
7
7
  from .file_data_response import FileDataResponse
8
+ from .filter_model import FilterModel
9
+ from .filter_operator import FilterOperator
8
10
  from .firecrawl_scrape_url_data_reponse_dto import FirecrawlScrapeUrlDataReponseDto
9
11
  from .firecrawl_scrape_url_metadata import FirecrawlScrapeUrlMetadata
10
12
  from .get_datasets_response import GetDatasetsResponse
@@ -18,12 +20,15 @@ from .message_out import MessageOut
18
20
  from .message_out_dto import MessageOutDto
19
21
  from .model import Model
20
22
  from .publish_formats import PublishFormats
23
+ from .query_model import QueryModel
21
24
  from .report import Report
22
25
  from .researcher_out import ResearcherOut
26
+ from .semantic_query_out import SemanticQueryOut
23
27
  from .snippet import Snippet
24
28
  from .sql_results import SqlResults
25
29
  from .status_enum import StatusEnum
26
30
  from .structured_parse_result import StructuredParseResult
31
+ from .time_dimension_model import TimeDimensionModel
27
32
  from .tools import Tools
28
33
  from .upload_documents_out import UploadDocumentsOut
29
34
  from .url_result import UrlResult
@@ -37,6 +42,8 @@ __all__ = [
37
42
  "Document",
38
43
  "ExcecuteToolFirstWorkflowOut",
39
44
  "FileDataResponse",
45
+ "FilterModel",
46
+ "FilterOperator",
40
47
  "FirecrawlScrapeUrlDataReponseDto",
41
48
  "FirecrawlScrapeUrlMetadata",
42
49
  "GetDatasetsResponse",
@@ -50,12 +57,15 @@ __all__ = [
50
57
  "MessageOutDto",
51
58
  "Model",
52
59
  "PublishFormats",
60
+ "QueryModel",
53
61
  "Report",
54
62
  "ResearcherOut",
63
+ "SemanticQueryOut",
55
64
  "Snippet",
56
65
  "SqlResults",
57
66
  "StatusEnum",
58
67
  "StructuredParseResult",
68
+ "TimeDimensionModel",
59
69
  "Tools",
60
70
  "UploadDocumentsOut",
61
71
  "UrlResult",
@@ -0,0 +1,28 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ from ..core.datetime_utils import serialize_datetime
7
+ from ..core.pydantic_utilities import pydantic_v1
8
+ from .filter_operator import FilterOperator
9
+
10
+
11
+ class FilterModel(pydantic_v1.BaseModel):
12
+ dimension: str
13
+ operator: FilterOperator
14
+ values: typing.List[str]
15
+
16
+ def json(self, **kwargs: typing.Any) -> str:
17
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
18
+ return super().json(**kwargs_with_defaults)
19
+
20
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
21
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
22
+ return super().dict(**kwargs_with_defaults)
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic_v1.Extra.allow
28
+ json_encoders = {dt.datetime: serialize_datetime}
@@ -0,0 +1,73 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import enum
4
+ import typing
5
+
6
+ T_Result = typing.TypeVar("T_Result")
7
+
8
+
9
+ class FilterOperator(str, enum.Enum):
10
+ """
11
+ An enumeration.
12
+ """
13
+
14
+ EQUALS = "equals"
15
+ NOT_EQUALS = "notEquals"
16
+ CONTAINS = "contains"
17
+ NOT_CONTAINS = "notContains"
18
+ STARTS_WITH = "startsWith"
19
+ ENDS_WITH = "endsWith"
20
+ GT = "gt"
21
+ GTE = "gte"
22
+ LT = "lt"
23
+ LTE = "lte"
24
+ SET = "set"
25
+ NOT_SET = "notSet"
26
+ IN = "in"
27
+ NOT_IN = "notIn"
28
+
29
+ def visit(
30
+ self,
31
+ equals: typing.Callable[[], T_Result],
32
+ not_equals: typing.Callable[[], T_Result],
33
+ contains: typing.Callable[[], T_Result],
34
+ not_contains: typing.Callable[[], T_Result],
35
+ starts_with: typing.Callable[[], T_Result],
36
+ ends_with: typing.Callable[[], T_Result],
37
+ gt: typing.Callable[[], T_Result],
38
+ gte: typing.Callable[[], T_Result],
39
+ lt: typing.Callable[[], T_Result],
40
+ lte: typing.Callable[[], T_Result],
41
+ set_: typing.Callable[[], T_Result],
42
+ not_set: typing.Callable[[], T_Result],
43
+ in_: typing.Callable[[], T_Result],
44
+ not_in: typing.Callable[[], T_Result],
45
+ ) -> T_Result:
46
+ if self is FilterOperator.EQUALS:
47
+ return equals()
48
+ if self is FilterOperator.NOT_EQUALS:
49
+ return not_equals()
50
+ if self is FilterOperator.CONTAINS:
51
+ return contains()
52
+ if self is FilterOperator.NOT_CONTAINS:
53
+ return not_contains()
54
+ if self is FilterOperator.STARTS_WITH:
55
+ return starts_with()
56
+ if self is FilterOperator.ENDS_WITH:
57
+ return ends_with()
58
+ if self is FilterOperator.GT:
59
+ return gt()
60
+ if self is FilterOperator.GTE:
61
+ return gte()
62
+ if self is FilterOperator.LT:
63
+ return lt()
64
+ if self is FilterOperator.LTE:
65
+ return lte()
66
+ if self is FilterOperator.SET:
67
+ return set_()
68
+ if self is FilterOperator.NOT_SET:
69
+ return not_set()
70
+ if self is FilterOperator.IN:
71
+ return in_()
72
+ if self is FilterOperator.NOT_IN:
73
+ return not_in()
@@ -0,0 +1,34 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ from ..core.datetime_utils import serialize_datetime
7
+ from ..core.pydantic_utilities import pydantic_v1
8
+ from .filter_model import FilterModel
9
+ from .time_dimension_model import TimeDimensionModel
10
+
11
+
12
+ class QueryModel(pydantic_v1.BaseModel):
13
+ measures: typing.Optional[typing.List[str]] = None
14
+ time_dimensions: typing.Optional[typing.List[TimeDimensionModel]] = pydantic_v1.Field(
15
+ alias="timeDimensions", default=None
16
+ )
17
+ dimensions: typing.Optional[typing.List[str]] = None
18
+ filters: typing.Optional[typing.List[FilterModel]] = None
19
+
20
+ def json(self, **kwargs: typing.Any) -> str:
21
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
22
+ return super().json(**kwargs_with_defaults)
23
+
24
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
25
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
26
+ return super().dict(**kwargs_with_defaults)
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ allow_population_by_field_name = True
32
+ populate_by_name = True
33
+ extra = pydantic_v1.Extra.allow
34
+ json_encoders = {dt.datetime: serialize_datetime}
@@ -0,0 +1,25 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ from ..core.datetime_utils import serialize_datetime
7
+ from ..core.pydantic_utilities import pydantic_v1
8
+
9
+
10
+ class SemanticQueryOut(pydantic_v1.BaseModel):
11
+ output: typing.Dict[str, typing.Any]
12
+
13
+ def json(self, **kwargs: typing.Any) -> str:
14
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
15
+ return super().json(**kwargs_with_defaults)
16
+
17
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
18
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
19
+ return super().dict(**kwargs_with_defaults)
20
+
21
+ class Config:
22
+ frozen = True
23
+ smart_union = True
24
+ extra = pydantic_v1.Extra.allow
25
+ json_encoders = {dt.datetime: serialize_datetime}
@@ -0,0 +1,29 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ from ..core.datetime_utils import serialize_datetime
7
+ from ..core.pydantic_utilities import pydantic_v1
8
+
9
+
10
+ class TimeDimensionModel(pydantic_v1.BaseModel):
11
+ dimension: str
12
+ granularity: str
13
+ date_range: typing.List[str] = pydantic_v1.Field(alias="dateRange")
14
+
15
+ def json(self, **kwargs: typing.Any) -> str:
16
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
17
+ return super().json(**kwargs_with_defaults)
18
+
19
+ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
20
+ kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
21
+ return super().dict(**kwargs_with_defaults)
22
+
23
+ class Config:
24
+ frozen = True
25
+ smart_union = True
26
+ allow_population_by_field_name = True
27
+ populate_by_name = True
28
+ extra = pydantic_v1.Extra.allow
29
+ json_encoders = {dt.datetime: serialize_datetime}