snowglobe 0.4.10__tar.gz → 0.4.11__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 (26) hide show
  1. {snowglobe-0.4.10/src/snowglobe.egg-info → snowglobe-0.4.11}/PKG-INFO +1 -1
  2. {snowglobe-0.4.10 → snowglobe-0.4.11}/pyproject.toml +1 -1
  3. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe/client/src/app.py +13 -2
  4. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe/client/src/utils.py +12 -3
  5. {snowglobe-0.4.10 → snowglobe-0.4.11/src/snowglobe.egg-info}/PKG-INFO +1 -1
  6. {snowglobe-0.4.10 → snowglobe-0.4.11}/LICENSE +0 -0
  7. {snowglobe-0.4.10 → snowglobe-0.4.11}/README.md +0 -0
  8. {snowglobe-0.4.10 → snowglobe-0.4.11}/setup.cfg +0 -0
  9. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe/client/__init__.py +0 -0
  10. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe/client/src/cli.py +0 -0
  11. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe/client/src/cli_utils.py +0 -0
  12. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe/client/src/config.py +0 -0
  13. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe/client/src/models.py +0 -0
  14. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe/client/src/project_manager.py +0 -0
  15. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe/client/src/stats.py +0 -0
  16. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe/client/src/telemetry.py +0 -0
  17. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe.egg-info/SOURCES.txt +0 -0
  18. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe.egg-info/dependency_links.txt +0 -0
  19. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe.egg-info/entry_points.txt +0 -0
  20. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe.egg-info/requires.txt +0 -0
  21. {snowglobe-0.4.10 → snowglobe-0.4.11}/src/snowglobe.egg-info/top_level.txt +0 -0
  22. {snowglobe-0.4.10 → snowglobe-0.4.11}/tests/test_app.py +0 -0
  23. {snowglobe-0.4.10 → snowglobe-0.4.11}/tests/test_cli.py +0 -0
  24. {snowglobe-0.4.10 → snowglobe-0.4.11}/tests/test_config.py +0 -0
  25. {snowglobe-0.4.10 → snowglobe-0.4.11}/tests/test_heartbeat.py +0 -0
  26. {snowglobe-0.4.10 → snowglobe-0.4.11}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: snowglobe
3
- Version: 0.4.10
3
+ Version: 0.4.11
4
4
  Summary: client server for usage with snowglobe experiments
5
5
  Author-email: Guardrails AI <contact@guardrailsai.com>
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "snowglobe"
3
- version = "0.4.10"
3
+ version = "0.4.11"
4
4
  authors = [
5
5
  {name = "Guardrails AI", email = "contact@guardrailsai.com"}
6
6
  ]
@@ -26,7 +26,7 @@ from snowglobe.client.src.telemetry import trace_completion_fn, trace_risk_evalu
26
26
 
27
27
  from .cli_utils import info, shutdown_manager
28
28
  from .config import config, get_api_key_or_raise
29
- from .models import CompletionFunctionOutputs, CompletionRequest, RiskEvaluationRequest
29
+ from .models import CompletionFunctionOutputs, CompletionRequest, RiskEvaluationRequest, SnowglobeData, SnowglobeMessage
30
30
  from .stats import initialize_stats, track_batch_completion
31
31
  from .utils import fetch_experiments, fetch_messages
32
32
 
@@ -129,7 +129,14 @@ async def process_application_heartbeat(app_id):
129
129
  }
130
130
  try:
131
131
  prompt = "Hello from Snowglobe!"
132
- test_request = CompletionRequest(messages=[{"role": "user", "content": prompt}])
132
+ test_request = CompletionRequest(
133
+ messages=[SnowglobeMessage(
134
+ role="user",
135
+ content=prompt,
136
+ snowglobe_data=SnowglobeData(
137
+ conversation_id="test", test_id="test"
138
+ ),
139
+ )])
133
140
  heartbeat_id = uuid.uuid4().hex
134
141
  agent = apps.get(app_id, {})
135
142
  agent_name = agent.get("name", "")
@@ -193,6 +200,10 @@ async def process_application_heartbeat(app_id):
193
200
  connection_test_payload["error"] = f"{str(e)}\n{traceback.format_exc()}"
194
201
  connection_test_payload["app_id"] = app_id
195
202
  connection_test_payload["applicationId"] = app_id
203
+ LOGGER.error(
204
+ f"Error processing heartbeat for application {app_id}: {connection_test_payload['error']}"
205
+ )
206
+ LOGGER.error(traceback.format_exc())
196
207
 
197
208
  connection_test_url = (
198
209
  f"{config.CONTROL_PLANE_URL}/api/successful-code-connection-tests"
@@ -16,13 +16,22 @@ async def fetch_experiments(app_id: str = None) -> list[dict]:
16
16
  list[dict]: A list of experiments.
17
17
  """
18
18
  async with httpx.AsyncClient() as client:
19
- experiments_url = f"{config.CONTROL_PLANE_URL}/api/experiments?&evaluated=false"
19
+ experiments_url = f"{config.CONTROL_PLANE_URL}/api/experiments?evaluated=false"
20
+
20
21
  if app_id:
21
22
  experiments_url += f"&appId={config.APPLICATION_ID}"
22
- experiments_response = await client.get(
23
+ try:
24
+ # get elapsed time for this request
25
+ import time
26
+ start_time = time.monotonic()
27
+ experiments_response = await client.get(
23
28
  experiments_url,
24
29
  headers={"x-api-key": get_api_key_or_raise()},
25
- )
30
+ timeout=60.0, # Set timeout to 60 seconds
31
+ )
32
+ except httpx.ConnectTimeout:
33
+ elapsed_time = time.monotonic() - start_time
34
+ raise Exception(f"Warning: Connection timed out while fetching experiments. Elapsed time: {elapsed_time:.2f} seconds. Polling will continue. If this persists please contact Snowglobe support.")
26
35
 
27
36
  if not experiments_response.status_code == 200:
28
37
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: snowglobe
3
- Version: 0.4.10
3
+ Version: 0.4.11
4
4
  Summary: client server for usage with snowglobe experiments
5
5
  Author-email: Guardrails AI <contact@guardrailsai.com>
6
6
  License: MIT License
File without changes
File without changes
File without changes
File without changes
File without changes