variably-sdk 2.9.0__tar.gz → 2.9.1__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 (21) hide show
  1. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/PKG-INFO +1 -1
  2. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/pyproject.toml +1 -1
  3. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably/client.py +21 -0
  4. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably/observe.py +10 -0
  5. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably/version.py +1 -1
  6. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably_sdk.egg-info/PKG-INFO +1 -1
  7. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/README.md +0 -0
  8. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/setup.cfg +0 -0
  9. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/setup.py +0 -0
  10. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably/__init__.py +0 -0
  11. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably/cache.py +0 -0
  12. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably/config.py +0 -0
  13. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably/errors.py +0 -0
  14. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably/http_client.py +0 -0
  15. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably/logger.py +0 -0
  16. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably/types.py +0 -0
  17. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably_sdk.egg-info/SOURCES.txt +0 -0
  18. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably_sdk.egg-info/dependency_links.txt +0 -0
  19. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably_sdk.egg-info/requires.txt +0 -0
  20. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/src/variably_sdk.egg-info/top_level.txt +0 -0
  21. {variably_sdk-2.9.0 → variably_sdk-2.9.1}/tests/test_streaming.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: variably-sdk
3
- Version: 2.9.0
3
+ Version: 2.9.1
4
4
  Summary: Official Python SDK for Variably feature flags, LLM experimentation, and prompt optimization platform
5
5
  Author: Variably
6
6
  Author-email: Variably <support@variably.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "variably-sdk"
7
- version = "2.9.0"
7
+ version = "2.9.1"
8
8
  description = "Official Python SDK for Variably feature flags, LLM experimentation, and prompt optimization platform"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
@@ -689,6 +689,8 @@ class VariablyClient:
689
689
  prompt_tokens: Optional[int] = None, # Input token count
690
690
  completion_tokens: Optional[int] = None, # Output token count
691
691
  cost: Optional[float] = None, # Cost in USD
692
+ # Turn-type marker — see _SUBMIT_RESPONSE_KINDS for allowed values.
693
+ kind: Optional[str] = None,
692
694
  ) -> LogResult:
693
695
  """Log a prompt/response pair for multi-dimensional evaluation (Observe Mode).
694
696
 
@@ -722,6 +724,23 @@ class VariablyClient:
722
724
  # Normalize prompt to string
723
725
  prompt_str = prompt if isinstance(prompt, str) else str(prompt)
724
726
 
727
+ # Validate kind and inject the marker into tags + metadata so the
728
+ # dashboard can suppress grounding/hallucination/attribution
729
+ # scores on non-generative turns. See submit_response for the
730
+ # full rationale; the same logic applies in Observe Mode.
731
+ if kind is not None and kind not in self._SUBMIT_RESPONSE_KINDS:
732
+ raise ConfigurationError(
733
+ f"kind must be one of {self._SUBMIT_RESPONSE_KINDS}, got {kind!r}",
734
+ "kind",
735
+ )
736
+ if kind and kind != "generative":
737
+ kind_tag = f"kind:{kind}"
738
+ tags = list(tags) if tags else []
739
+ if kind_tag not in tags:
740
+ tags.append(kind_tag)
741
+ metadata = dict(metadata) if metadata else {}
742
+ metadata.setdefault("kind", kind)
743
+
725
744
  data: Dict[str, Any] = {
726
745
  "prompt": prompt_str,
727
746
  "response": response,
@@ -758,6 +777,8 @@ class VariablyClient:
758
777
  data["cost"] = cost
759
778
  if metadata:
760
779
  data["metadata"] = metadata
780
+ if kind:
781
+ data["kind"] = kind
761
782
 
762
783
  try:
763
784
  result = self.http_client.log_observation(data)
@@ -177,6 +177,15 @@ def observe(
177
177
  tags: Optional[List[str]] = None, # Grouping labels, e.g. ["production", "rag", "v2"]
178
178
  metadata: Optional[Dict[str, Any]] = None, # Any arbitrary key-value data for filtering
179
179
 
180
+ # --- Turn type ---
181
+ # Marks what kind of LLM turn this is. Use "classifier" / "router" /
182
+ # "tool_use" / "transformer" for non-generative turns so the dashboard
183
+ # suppresses grounding/hallucination/attribution scores (which don't
184
+ # apply to JSON control structures or function calls). Default
185
+ # "generative" preserves existing behavior.
186
+ # Allowed: "generative" (default), "classifier", "router", "tool_use", "transformer".
187
+ kind: Optional[str] = None,
188
+
180
189
  # --- Backward compatibility ---
181
190
  conversation_history: Optional[List[Dict[str, str]]] = None, # Deprecated: use prior_turns instead
182
191
  ) -> Optional[Dict[str, Any]]:
@@ -263,6 +272,7 @@ def observe(
263
272
  user_id=user_id,
264
273
  session_id=session_id,
265
274
  metadata=metadata,
275
+ kind=kind,
266
276
  )
267
277
 
268
278
  return {
@@ -1,3 +1,3 @@
1
1
  """Version information for Variably SDK."""
2
2
 
3
- __version__ = "2.9.0"
3
+ __version__ = "2.9.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: variably-sdk
3
- Version: 2.9.0
3
+ Version: 2.9.1
4
4
  Summary: Official Python SDK for Variably feature flags, LLM experimentation, and prompt optimization platform
5
5
  Author: Variably
6
6
  Author-email: Variably <support@variably.com>
File without changes
File without changes
File without changes