confamnode 0.2.5__tar.gz → 0.2.6__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 (27) hide show
  1. {confamnode-0.2.5 → confamnode-0.2.6}/PKG-INFO +5 -5
  2. {confamnode-0.2.5 → confamnode-0.2.6}/README.md +4 -4
  3. {confamnode-0.2.5 → confamnode-0.2.6}/confamnode/__init__.py +1 -1
  4. {confamnode-0.2.5 → confamnode-0.2.6}/confamnode/client.py +9 -12
  5. {confamnode-0.2.5 → confamnode-0.2.6}/pyproject.toml +1 -1
  6. {confamnode-0.2.5 → confamnode-0.2.6}/tests/test_cache_flag.py +5 -13
  7. {confamnode-0.2.5 → confamnode-0.2.6}/uv.lock +1 -1
  8. {confamnode-0.2.5 → confamnode-0.2.6}/.gitignore +0 -0
  9. {confamnode-0.2.5 → confamnode-0.2.6}/.python-version +0 -0
  10. {confamnode-0.2.5 → confamnode-0.2.6}/LICENSE +0 -0
  11. {confamnode-0.2.5 → confamnode-0.2.6}/confamnode/ansa.py +0 -0
  12. {confamnode-0.2.5 → confamnode-0.2.6}/confamnode/builders.py +0 -0
  13. {confamnode-0.2.5 → confamnode-0.2.6}/confamnode/config.py +0 -0
  14. {confamnode-0.2.5 → confamnode-0.2.6}/confamnode/exceptions.py +0 -0
  15. {confamnode-0.2.5 → confamnode-0.2.6}/confamnode/models.py +0 -0
  16. {confamnode-0.2.5 → confamnode-0.2.6}/confamnode/registry.py +0 -0
  17. {confamnode-0.2.5 → confamnode-0.2.6}/confamnode/utils.py +0 -0
  18. {confamnode-0.2.5 → confamnode-0.2.6}/tests/__init__.py +0 -0
  19. {confamnode-0.2.5 → confamnode-0.2.6}/tests/test_ansa.py +0 -0
  20. {confamnode-0.2.5 → confamnode-0.2.6}/tests/test_client.py +0 -0
  21. {confamnode-0.2.5 → confamnode-0.2.6}/tests/test_client_errors.py +0 -0
  22. {confamnode-0.2.5 → confamnode-0.2.6}/tests/test_exceptions.py +0 -0
  23. {confamnode-0.2.5 → confamnode-0.2.6}/tests/test_gist.py +0 -0
  24. {confamnode-0.2.5 → confamnode-0.2.6}/tests/test_init.py +0 -0
  25. {confamnode-0.2.5 → confamnode-0.2.6}/tests/test_models.py +0 -0
  26. {confamnode-0.2.5 → confamnode-0.2.6}/tests/test_stream.py +0 -0
  27. {confamnode-0.2.5 → confamnode-0.2.6}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: confamnode
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: The Nigerian AI inference gateway
5
5
  Project-URL: Repository, https://github.com/confamnodeai/confamnode
6
6
  Project-URL: Bug Tracker, https://github.com/confamnodeai/confamnode/issues
@@ -258,7 +258,7 @@ ansa = client.gist(
258
258
 
259
259
  Caching is controlled **per request** and is **off by default** — every call returns a fresh response, even when the request is identical. This keeps data-generation loops and any workflow that resends the same prompt from getting the same cached answer back each time.
260
260
 
261
- Pass `cache=True` to read from and write to the cache — useful for idempotent lookups or to save cost on repeated queries:
261
+ Pass `cache=True` to let the gateway serve and store a cached response — useful for idempotent lookups:
262
262
 
263
263
  ```python
264
264
  # Default — caching off, fresh response every call
@@ -267,8 +267,8 @@ ansa = client.gist(
267
267
  messages="How you dey?"
268
268
  )
269
269
 
270
- # Enable caching — use a stored response when the request matches,
271
- # and store this response for next time
270
+ # Enable caching — the gateway may return a stored response for a
271
+ # matching request, and store this one for next time
272
272
  ansa = client.gist(
273
273
  model="confam-speed",
274
274
  messages="How you dey?",
@@ -276,7 +276,7 @@ ansa = client.gist(
276
276
  )
277
277
  ```
278
278
 
279
- A cache hit is typically returned near-instantly and at little or no token cost a quick way to confirm caching is active.
279
+ Caching must be enabled for your account for `cache=True` to take effect. A cache hit returns near-instantly the quickest way to see it is to send the **same** request twice with `cache=True`: the first call populates the cache, the second is served from it.
280
280
 
281
281
  ---
282
282
 
@@ -234,7 +234,7 @@ ansa = client.gist(
234
234
 
235
235
  Caching is controlled **per request** and is **off by default** — every call returns a fresh response, even when the request is identical. This keeps data-generation loops and any workflow that resends the same prompt from getting the same cached answer back each time.
236
236
 
237
- Pass `cache=True` to read from and write to the cache — useful for idempotent lookups or to save cost on repeated queries:
237
+ Pass `cache=True` to let the gateway serve and store a cached response — useful for idempotent lookups:
238
238
 
239
239
  ```python
240
240
  # Default — caching off, fresh response every call
@@ -243,8 +243,8 @@ ansa = client.gist(
243
243
  messages="How you dey?"
244
244
  )
245
245
 
246
- # Enable caching — use a stored response when the request matches,
247
- # and store this response for next time
246
+ # Enable caching — the gateway may return a stored response for a
247
+ # matching request, and store this one for next time
248
248
  ansa = client.gist(
249
249
  model="confam-speed",
250
250
  messages="How you dey?",
@@ -252,7 +252,7 @@ ansa = client.gist(
252
252
  )
253
253
  ```
254
254
 
255
- A cache hit is typically returned near-instantly and at little or no token cost a quick way to confirm caching is active.
255
+ Caching must be enabled for your account for `cache=True` to take effect. A cache hit returns near-instantly the quickest way to see it is to send the **same** request twice with `cache=True`: the first call populates the cache, the second is served from it.
256
256
 
257
257
  ---
258
258
 
@@ -8,7 +8,7 @@ from confamnode.exceptions import (
8
8
  from confamnode.ansa import Ansa, Usage, Cost
9
9
  from confamnode import models
10
10
 
11
- __version__ = "0.2.5"
11
+ __version__ = "0.2.6"
12
12
 
13
13
  __all__ = [
14
14
  "ConfamNode",
@@ -61,20 +61,17 @@ class ConfamNode:
61
61
  else:
62
62
  body["system"] = system # None or custom string
63
63
 
64
- # Caching is controlled per request. By default the SDK opts OUT, so
65
- # identical requests (same model + messages + system) each return a
64
+ # Caching is opt-in. By default the SDK sends an explicit cache-bypass,
65
+ # so identical requests (same model + messages + system) each return a
66
66
  # FRESH response -- important for data-generation loops that resend the
67
- # same prompt expecting varied output. Pass cache=True to read from and
68
- # write to the cache (idempotent lookups, cost savings on repeats).
67
+ # same prompt expecting varied output.
69
68
  #
70
- # These flags only tell the gateway whether to use a cache for THIS
71
- # request; whether one exists at all is a gateway-side capability.
72
- if cache:
73
- body["cache"] = {
74
- "no-cache": False, # Cache the response
75
- "no-store": False # Store the response
76
- }
77
- else:
69
+ # With cache=True we send NO cache field at all, letting the gateway
70
+ # apply its normal caching. That absent-field shape is exactly what
71
+ # produced cached responses before this flag existed, so it's the
72
+ # request form known to engage the cache -- more reliable than sending
73
+ # explicit "false" flags the gateway may not interpret identically.
74
+ if not cache:
78
75
  body["cache"] = {
79
76
  "no-cache": True, # Skip cache check, get fresh response
80
77
  "no-store": True # Don't cache this response
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "confamnode"
3
- version = "0.2.5"
3
+ version = "0.2.6"
4
4
  description = "The Nigerian AI inference gateway"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -18,7 +18,6 @@ API_KEY = "confam-test"
18
18
  MODEL = next(iter(VALID_MODELS))
19
19
 
20
20
  CACHE_OFF = {"no-cache": True, "no-store": True} # skip read + skip store
21
- CACHE_ON = {"no-cache": False, "no-store": False} # use + store
22
21
 
23
22
 
24
23
  @pytest.fixture
@@ -55,20 +54,13 @@ def test_cache_off_by_default(captured_body):
55
54
  assert captured_body["body"]["cache"] == CACHE_OFF
56
55
 
57
56
 
58
- def test_cache_true_uses_and_stores(captured_body):
57
+ def test_cache_true_omits_field(captured_body):
58
+ # cache=True lets the gateway apply its normal caching by sending NO cache
59
+ # field -- the request shape proven to engage the cache.
59
60
  _gist(cache=True)
60
- assert captured_body["body"]["cache"] == CACHE_ON
61
+ assert "cache" not in captured_body["body"]
61
62
 
62
63
 
63
64
  def test_cache_false_is_explicit_off(captured_body):
64
65
  _gist(cache=False)
65
- assert captured_body["body"]["cache"] == CACHE_OFF
66
-
67
-
68
- def test_cache_field_always_present(captured_body):
69
- # The request should always state its caching intent in both directions,
70
- # never leave it implied by omission.
71
- _gist()
72
- assert "cache" in captured_body["body"]
73
- _gist(cache=True)
74
- assert "cache" in captured_body["body"]
66
+ assert captured_body["body"]["cache"] == CACHE_OFF
@@ -40,7 +40,7 @@ wheels = [
40
40
 
41
41
  [[package]]
42
42
  name = "confamnode"
43
- version = "0.2.4"
43
+ version = "0.2.6"
44
44
  source = { editable = "." }
45
45
  dependencies = [
46
46
  { name = "httpx" },
File without changes
File without changes
File without changes
File without changes