posthoganalytics 6.3.4__tar.gz → 6.4.0__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.
- {posthoganalytics-6.3.4/posthoganalytics.egg-info → posthoganalytics-6.4.0}/PKG-INFO +1 -1
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/gemini/gemini.py +64 -10
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/version.py +1 -1
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0/posthoganalytics.egg-info}/PKG-INFO +1 -1
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/LICENSE +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/MANIFEST.in +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/README.md +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/__init__.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/__init__.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/anthropic/__init__.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/anthropic/anthropic.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/anthropic/anthropic_async.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/anthropic/anthropic_providers.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/gemini/__init__.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/langchain/__init__.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/langchain/callbacks.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/openai/__init__.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/openai/openai.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/openai/openai_async.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/openai/openai_providers.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/utils.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/args.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/client.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/consumer.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/contexts.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/exception_capture.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/exception_utils.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/feature_flags.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/integrations/__init__.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/integrations/django.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/poller.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/py.typed +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/request.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/__init__.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_before_send.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_client.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_consumer.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_contexts.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_exception_capture.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_feature_flag.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_feature_flag_result.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_feature_flags.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_module.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_request.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_size_limited_dict.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_types.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_utils.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/types.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/utils.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics.egg-info/SOURCES.txt +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics.egg-info/dependency_links.txt +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics.egg-info/requires.txt +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics.egg-info/top_level.txt +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/pyproject.toml +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/setup.cfg +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/setup.py +0 -0
- {posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/setup_analytics.py +0 -0
|
@@ -42,6 +42,12 @@ class Client:
|
|
|
42
42
|
def __init__(
|
|
43
43
|
self,
|
|
44
44
|
api_key: Optional[str] = None,
|
|
45
|
+
vertexai: Optional[bool] = None,
|
|
46
|
+
credentials: Optional[Any] = None,
|
|
47
|
+
project: Optional[str] = None,
|
|
48
|
+
location: Optional[str] = None,
|
|
49
|
+
debug_config: Optional[Any] = None,
|
|
50
|
+
http_options: Optional[Any] = None,
|
|
45
51
|
posthog_client: Optional[PostHogClient] = None,
|
|
46
52
|
posthog_distinct_id: Optional[str] = None,
|
|
47
53
|
posthog_properties: Optional[Dict[str, Any]] = None,
|
|
@@ -51,7 +57,13 @@ class Client:
|
|
|
51
57
|
):
|
|
52
58
|
"""
|
|
53
59
|
Args:
|
|
54
|
-
api_key: Google AI API key. If not provided, will use GOOGLE_API_KEY or API_KEY environment variable
|
|
60
|
+
api_key: Google AI API key. If not provided, will use GOOGLE_API_KEY or API_KEY environment variable (not required for Vertex AI)
|
|
61
|
+
vertexai: Whether to use Vertex AI authentication
|
|
62
|
+
credentials: Vertex AI credentials object
|
|
63
|
+
project: GCP project ID for Vertex AI
|
|
64
|
+
location: GCP location for Vertex AI
|
|
65
|
+
debug_config: Debug configuration for the client
|
|
66
|
+
http_options: HTTP options for the client
|
|
55
67
|
posthog_client: PostHog client for tracking usage
|
|
56
68
|
posthog_distinct_id: Default distinct ID for all calls (can be overridden per call)
|
|
57
69
|
posthog_properties: Default properties for all calls (can be overridden per call)
|
|
@@ -66,6 +78,12 @@ class Client:
|
|
|
66
78
|
|
|
67
79
|
self.models = Models(
|
|
68
80
|
api_key=api_key,
|
|
81
|
+
vertexai=vertexai,
|
|
82
|
+
credentials=credentials,
|
|
83
|
+
project=project,
|
|
84
|
+
location=location,
|
|
85
|
+
debug_config=debug_config,
|
|
86
|
+
http_options=http_options,
|
|
69
87
|
posthog_client=self._ph_client,
|
|
70
88
|
posthog_distinct_id=posthog_distinct_id,
|
|
71
89
|
posthog_properties=posthog_properties,
|
|
@@ -85,6 +103,12 @@ class Models:
|
|
|
85
103
|
def __init__(
|
|
86
104
|
self,
|
|
87
105
|
api_key: Optional[str] = None,
|
|
106
|
+
vertexai: Optional[bool] = None,
|
|
107
|
+
credentials: Optional[Any] = None,
|
|
108
|
+
project: Optional[str] = None,
|
|
109
|
+
location: Optional[str] = None,
|
|
110
|
+
debug_config: Optional[Any] = None,
|
|
111
|
+
http_options: Optional[Any] = None,
|
|
88
112
|
posthog_client: Optional[PostHogClient] = None,
|
|
89
113
|
posthog_distinct_id: Optional[str] = None,
|
|
90
114
|
posthog_properties: Optional[Dict[str, Any]] = None,
|
|
@@ -94,7 +118,13 @@ class Models:
|
|
|
94
118
|
):
|
|
95
119
|
"""
|
|
96
120
|
Args:
|
|
97
|
-
api_key: Google AI API key. If not provided, will use GOOGLE_API_KEY or API_KEY environment variable
|
|
121
|
+
api_key: Google AI API key. If not provided, will use GOOGLE_API_KEY or API_KEY environment variable (not required for Vertex AI)
|
|
122
|
+
vertexai: Whether to use Vertex AI authentication
|
|
123
|
+
credentials: Vertex AI credentials object
|
|
124
|
+
project: GCP project ID for Vertex AI
|
|
125
|
+
location: GCP location for Vertex AI
|
|
126
|
+
debug_config: Debug configuration for the client
|
|
127
|
+
http_options: HTTP options for the client
|
|
98
128
|
posthog_client: PostHog client for tracking usage
|
|
99
129
|
posthog_distinct_id: Default distinct ID for all calls
|
|
100
130
|
posthog_properties: Default properties for all calls
|
|
@@ -113,16 +143,40 @@ class Models:
|
|
|
113
143
|
self._default_privacy_mode = posthog_privacy_mode
|
|
114
144
|
self._default_groups = posthog_groups
|
|
115
145
|
|
|
116
|
-
#
|
|
117
|
-
|
|
118
|
-
|
|
146
|
+
# Build genai.Client arguments
|
|
147
|
+
client_args: Dict[str, Any] = {}
|
|
148
|
+
|
|
149
|
+
# Add Vertex AI parameters if provided
|
|
150
|
+
if vertexai is not None:
|
|
151
|
+
client_args["vertexai"] = vertexai
|
|
152
|
+
if credentials is not None:
|
|
153
|
+
client_args["credentials"] = credentials
|
|
154
|
+
if project is not None:
|
|
155
|
+
client_args["project"] = project
|
|
156
|
+
if location is not None:
|
|
157
|
+
client_args["location"] = location
|
|
158
|
+
if debug_config is not None:
|
|
159
|
+
client_args["debug_config"] = debug_config
|
|
160
|
+
if http_options is not None:
|
|
161
|
+
client_args["http_options"] = http_options
|
|
162
|
+
|
|
163
|
+
# Handle API key authentication
|
|
164
|
+
if vertexai:
|
|
165
|
+
# For Vertex AI, api_key is optional
|
|
166
|
+
if api_key is not None:
|
|
167
|
+
client_args["api_key"] = api_key
|
|
168
|
+
else:
|
|
169
|
+
# For non-Vertex AI mode, api_key is required (backwards compatibility)
|
|
170
|
+
if api_key is None:
|
|
171
|
+
api_key = os.environ.get("GOOGLE_API_KEY") or os.environ.get("API_KEY")
|
|
119
172
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
173
|
+
if api_key is None:
|
|
174
|
+
raise ValueError(
|
|
175
|
+
"API key must be provided either as parameter or via GOOGLE_API_KEY/API_KEY environment variable"
|
|
176
|
+
)
|
|
177
|
+
client_args["api_key"] = api_key
|
|
124
178
|
|
|
125
|
-
self._client = genai.Client(
|
|
179
|
+
self._client = genai.Client(**client_args)
|
|
126
180
|
self._base_url = "https://generativelanguage.googleapis.com"
|
|
127
181
|
|
|
128
182
|
def _merge_posthog_params(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/anthropic/anthropic.py
RENAMED
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/anthropic/anthropic_async.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/langchain/callbacks.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/openai/openai_async.py
RENAMED
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/ai/openai/openai_providers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_exception_capture.py
RENAMED
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_feature_flag.py
RENAMED
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_feature_flag_result.py
RENAMED
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_feature_flags.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics/test/test_size_limited_dict.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{posthoganalytics-6.3.4 → posthoganalytics-6.4.0}/posthoganalytics.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|