anthropic-haystack 6.1.0__tar.gz → 6.2.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.
Files changed (29) hide show
  1. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/CHANGELOG.md +12 -0
  2. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/PKG-INFO +1 -1
  3. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/src/haystack_integrations/components/generators/anthropic/chat/chat_generator.py +12 -0
  4. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/tests/test_chat_generator.py +76 -0
  5. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/.gitignore +0 -0
  6. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/LICENSE.txt +0 -0
  7. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/README.md +0 -0
  8. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/example/documentation_rag_with_claude.py +0 -0
  9. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/example/prompt_caching.py +0 -0
  10. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/pydoc/config_docusaurus.yml +0 -0
  11. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/pyproject.toml +0 -0
  12. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/src/haystack_integrations/components/generators/anthropic/__init__.py +0 -0
  13. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/src/haystack_integrations/components/generators/anthropic/chat/__init__.py +0 -0
  14. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/src/haystack_integrations/components/generators/anthropic/chat/foundry_chat_generator.py +0 -0
  15. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/src/haystack_integrations/components/generators/anthropic/chat/utils.py +0 -0
  16. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/src/haystack_integrations/components/generators/anthropic/chat/vertex_chat_generator.py +0 -0
  17. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/src/haystack_integrations/components/generators/py.typed +0 -0
  18. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/src/haystack_integrations/token_counters/anthropic/__init__.py +0 -0
  19. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/src/haystack_integrations/token_counters/anthropic/token_counter.py +0 -0
  20. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/src/haystack_integrations/token_counters/py.typed +0 -0
  21. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/tests/__init__.py +0 -0
  22. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/tests/conftest.py +0 -0
  23. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/tests/test_chat_generator_async.py +0 -0
  24. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/tests/test_files/apple.jpg +0 -0
  25. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/tests/test_files/sample_pdf_3.pdf +0 -0
  26. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/tests/test_foundry_chat_generator.py +0 -0
  27. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/tests/test_token_counter.py +0 -0
  28. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/tests/test_utils.py +0 -0
  29. {anthropic_haystack-6.1.0 → anthropic_haystack-6.2.0}/tests/test_vertex_chat_generator.py +0 -0
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [integrations/anthropic-v6.1.0] - 2026-09-22
4
+
5
+ ### 🐛 Bug Fixes
6
+
7
+ - Anthropic - respect an empty runtime tools list (#3977)
8
+ - Drop Anthropic tool calls truncated at max_tokens and raise the default limit (#3982)
9
+
10
+ ### 🧹 Chores
11
+
12
+ - Refresh Anthropic model lists and expose service_tierupdates (#3983)
13
+
14
+
3
15
  ## [integrations/anthropic-v6.0.1] - 2026-09-14
4
16
 
5
17
  ### 🐛 Bug Fixes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: anthropic-haystack
3
- Version: 6.1.0
3
+ Version: 6.2.0
4
4
  Summary: An integration of Anthropic Claude models into the Haystack framework.
5
5
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/anthropic#readme
6
6
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
@@ -349,6 +349,11 @@ class AnthropicChatGenerator:
349
349
 
350
350
  def _resolve_flattened_generation_kwargs(self, generation_kwargs: dict[str, Any]) -> dict[str, Any]:
351
351
  generation_kwargs = generation_kwargs.copy()
352
+ # Copy the nested dicts the flattened kwargs write into; a shallow copy would share them with the
353
+ # component's init-time generation_kwargs, so a per-run flattened kwarg would persist across runs.
354
+ for key in ("tool_choice", "thinking", "output_config"):
355
+ if isinstance(generation_kwargs.get(key), dict):
356
+ generation_kwargs[key] = dict(generation_kwargs[key])
352
357
 
353
358
  disable_parallel_tool_use = generation_kwargs.pop("disable_parallel_tool_use", None)
354
359
  parallel_tool_use = generation_kwargs.pop("parallel_tool_use", None)
@@ -385,6 +390,13 @@ class AnthropicChatGenerator:
385
390
  output_config = generation_kwargs.setdefault("output_config", {})
386
391
  output_config["effort"] = adaptive_thinking_effort
387
392
 
393
+ thinking_display = generation_kwargs.pop("thinking_display", None)
394
+ if thinking_display is not None:
395
+ thinking = generation_kwargs.setdefault("thinking", {})
396
+ # `display` is only accepted with enabled or adaptive thinking, so it's dropped when thinking is disabled
397
+ if thinking.get("type") != "disabled":
398
+ thinking["display"] = thinking_display
399
+
388
400
  return generation_kwargs
389
401
 
390
402
  def _process_response(
@@ -481,6 +481,7 @@ class TestRun:
481
481
  "parallel_tool_use": None,
482
482
  "tool_choice_type": None,
483
483
  "adaptive_thinking_effort": None,
484
+ "thinking_display": None,
484
485
  },
485
486
  {},
486
487
  ),
@@ -517,6 +518,46 @@ class TestRun:
517
518
  "service_tier": "standard_only",
518
519
  },
519
520
  ),
521
+ (
522
+ {
523
+ "adaptive_thinking_effort": "high",
524
+ "thinking_display": "summarized",
525
+ },
526
+ {
527
+ "thinking": {"type": "adaptive", "display": "summarized"},
528
+ "output_config": {"effort": "high"},
529
+ },
530
+ ),
531
+ (
532
+ # thinking_display is merged into an explicitly passed thinking dict
533
+ {
534
+ "thinking": {"type": "adaptive"},
535
+ "thinking_display": "omitted",
536
+ },
537
+ {
538
+ "thinking": {"type": "adaptive", "display": "omitted"},
539
+ },
540
+ ),
541
+ (
542
+ # thinking_display is dropped when thinking is disabled through a flattened kwarg
543
+ {
544
+ "adaptive_thinking_effort": "none",
545
+ "thinking_display": "summarized",
546
+ },
547
+ {
548
+ "thinking": {"type": "disabled"},
549
+ },
550
+ ),
551
+ (
552
+ # thinking_display is dropped when thinking is disabled through an explicit thinking dict
553
+ {
554
+ "thinking": {"type": "disabled"},
555
+ "thinking_display": "summarized",
556
+ },
557
+ {
558
+ "thinking": {"type": "disabled"},
559
+ },
560
+ ),
520
561
  ],
521
562
  )
522
563
  def test_run_with_flattened_generation_kwargs(
@@ -538,6 +579,41 @@ class TestRun:
538
579
  assert actual_kwargs.get("output_config") == expected_kwargs.get("output_config")
539
580
  assert actual_kwargs.get("service_tier") == expected_kwargs.get("service_tier")
540
581
 
582
+ def test_run_with_flattened_generation_kwargs_does_not_leak_across_runs(self, chat_messages, mock_chat_completion):
583
+ init_generation_kwargs = {
584
+ "tool_choice": {"type": "auto"},
585
+ "thinking": {"type": "adaptive"},
586
+ "output_config": {"effort": "low"},
587
+ }
588
+ component = AnthropicChatGenerator(
589
+ api_key=Secret.from_token("test-api-key"),
590
+ generation_kwargs=init_generation_kwargs,
591
+ )
592
+
593
+ component.run(
594
+ chat_messages,
595
+ generation_kwargs={
596
+ "parallel_tool_use": False,
597
+ "thinking_display": "summarized",
598
+ "adaptive_thinking_effort": "high",
599
+ },
600
+ )
601
+ first_kwargs = mock_chat_completion.call_args.kwargs
602
+ assert first_kwargs["tool_choice"] == {"type": "auto", "disable_parallel_tool_use": True}
603
+ assert first_kwargs["thinking"] == {"type": "adaptive", "display": "summarized"}
604
+ assert first_kwargs["output_config"] == {"effort": "high"}
605
+
606
+ component.run(chat_messages)
607
+ second_kwargs = mock_chat_completion.call_args.kwargs
608
+ assert second_kwargs["tool_choice"] == {"type": "auto"}
609
+ assert second_kwargs["thinking"] == {"type": "adaptive"}
610
+ assert second_kwargs["output_config"] == {"effort": "low"}
611
+ assert component.generation_kwargs == {
612
+ "tool_choice": {"type": "auto"},
613
+ "thinking": {"type": "adaptive"},
614
+ "output_config": {"effort": "low"},
615
+ }
616
+
541
617
 
542
618
  class TestAnthropicServerTools:
543
619
  def test_init_with_anthropic_server_tools(self, monkeypatch):