19 Commits

Author SHA1 Message Date
LHMQ878 f7f0bb09e6 fix: keep title keys inside OpenAPI singular example values (#12314)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 12:21:28 +02:00
LHMQ878 1cd96fcd95 fix: don't strip title when it is a name, not a schema keyword (#12219)
Co-authored-by: LHMQ878 <LHMQ878@users.noreply.github.com>
Co-authored-by: David S. Batista <dsbatista@gmail.com>
2026-08-05 07:45:22 +00:00
Sohum Trivedi 3780936e45 fix: crash when a tool parameter is named properties (create_tool_from_function, @tool, ComponentTool) (#12037) 2026-07-20 14:41:12 +02:00
Sebastian Husch Lee 1cab85a5d5 feat: Add support for async functions inside of Tool (#11426) 2026-06-01 11:42:37 +00:00
Sebastian Husch Lee 692ebaf289 refactor!: Remove ToolInvoker and move tool calling code into Agent (#11415) 2026-05-28 09:30:55 +02:00
Max Swain 972b17ab65 chore: Add type checking to test/tools (#11284) 2026-05-13 11:11:01 +02:00
Sebastian Husch Lee e1ae2f4170 feat: Forward state to tools (#11064)
* adding injection of State or State | Optional with tests

* refactor to add new util function to reduce duplicate code

* Add reno

* update state docs
2026-04-09 14:56:50 +00:00
Amanpreet Singh 4e7e4519c8 docs: updated the output to # >> (#11012)
Co-authored-by: David S. Batista <dsbatista@gmail.com>
2026-04-01 16:06:17 +02:00
David S. Batista 52cf1c1eaa docs: fixing docs syntax errors (#10944) 2026-03-27 09:39:47 +00:00
Stefano Fiorucci 819ed7244b chore: drop pylint (#10640)
* draft

* progress

* more fixes

* improvs

* strict

* rm pylint

* rm pylint comments

* fix and simplify

* standardize

* more

* alpha order

* final touch

* remove template

* rm ellipsis comments
2026-02-24 07:46:20 +00:00
Stefano Fiorucci ecb30a7400 feat: support passing images in Tool results (#10410)
* wip: support images in tool results

* revert unneeded changes

* improve and test OpenAI responses message conversion

* improvements to tool, componenttool and pipelinetool

* test fixes

* better toolinvoker tests

* small fixes

* fix

* draft changes

* refinements

* simplify

* expande create_tool_from_function + docs

* fix + release note
2026-01-22 16:13:21 +01:00
Michele Pangrazzi 96b8bc5be3 Skip callables in component tool schema generation (#10362)
* Skip callables in component tool schema generation (eg snapshot_callback)

* Release note

* Fix formatting on release note

* Update test/tools/test_component_tool.py

Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>

* Fix formatting

* Add same fix to create_tool_from_function

---------

Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
2026-01-13 16:19:59 +01:00
Stefano Fiorucci 7c6323b960 refactor: support PEP604 typing syntax (X|Y and X|None) (#10255)
* adopt X|Y syntax: draft

* cast Union

* fix pylint + state testing

* use X|Y

* rm unused imports

* trigger e2e tests

* fix + simplification

* add compatibility tests

* rm e2e tests trigger

* fix

* add relnote

* simplify/fix pep604 union parsing

* fix comments

* test _is_optional_type

* introduce _build_pep604_union_type; make _is_union_type private

* try removing problematic test
2025-12-19 15:47:51 +01:00
Abdelrahman Kaseb 5f3c37d287 chore: adopt PEP 585 type hints (#9678)
* chore(lint): enforce and apply PEP 585 type hinting

* Run fmt fixes

* Fix all typing imports using some regex

* Fix all typing written in string in tests

* undo changes in the e2e tests

* make e2e test use list instead of List

* type fixes

* remove type:ignore

* pylint

* Remove typing from Usage example comments

* Remove typing from most of comments

* try to fix e2e tests on comm PRs

* fix

* Add tests typing.List in to adjust test compatiplity
- test/components/agents/test_state_class.py
- test/components/converters/test_output_adapter.py
- test/components/joiners/test_list_joiner.py

* simplify pyproject

* improve relnote

---------

Co-authored-by: anakin87 <stefanofiorucci@gmail.com>
2025-08-07 10:23:14 +02:00
Julian Risch 85721c19dd docs: fix curly brackets (#9599) 2025-07-08 12:51:47 +00:00
Denis Washington eefda0452d chore: Make the Haystack core "type complete" (#9438)
* chore: Make the Haystack core "type complete"

For libraries with a `py.typed` marker, it is [recommended][1] to
make all public interfaces "type complete", i.e. to explicitly
annotate all function parameters and return types. Doing so has the
following benefits:

- It maximizes the type information available to users and IDEs.
- It ensures that the argument and return types are the intended ones.
- It sidesteps differences in type inference between the different
  type checker implementations.

This change makes a first step towards type completeness by enabling
the Mypy `disallow_incomplete_defs` for the core modules (excluding
`haystack.components.*` and `haystack.testing.*`) and fixing the
resulting errors.

[1]: https://typing.python.org/en/latest/guides/libraries.html#how-much-of-my-library-needs-types

* chore: Add `python_version = 3.9` to Mypy config

This catches type constructs that are only supported in later Python
versions.

* Remove unused import

* try to fix linting

---------

Co-authored-by: Stefano Fiorucci <stefanofiorucci@gmail.com>
2025-05-26 11:00:22 +02:00
Sebastian Husch Lee 9ae76e1653 Fix component tool parameters (#9342)
* Starting property schema refactor

* Adding more tests

* More tests

* Handle null type explicitly

* More updates of tests to accomodate Optional properly

* Fix more tests

* Remove unecessary check

* Some cleanup

* Update test

* Add reno

* Fix typing

* Add license header

* Use docstrings of dataclasses in parameter spec generation

* More tests of Haystack dataclass types

* Properly handle Sequence

* Fix license header

* Update OpenAI tests to add more complicated tool parameter signature

* Properly set required for dataclasses

* Add integration test for azure that includes additionalProperties

* Add more complicated integration test for HuggingFaceAPIChatGenerator

* Alternate approach using pydantic like we do in from_function.py

* Cleanup and fix other affected tests

* Fix mypy

* PR comments

* PR comment

* Remove test from HF API

* Update reno

* Update reno
2025-05-15 07:51:06 +00:00
Julian Risch 657d09d7f1 feat: integrate updates of Tool, ToolInvoker, State, create_tool_from_function, ComponentTool from haystack-experimental (#9113)
* update Tool,ToolInvoker,ComponentTool,create_tool_from_function

* add State and its utils

* add tests for State and its utils

* update tests for Tool etc.

* reno

* fix circular imports

* update experimental imports in tests

* fix unit tests

* fix ChatGenerator unit tests

* mypy

* add State to init and pydoc

* explain State in more detail in release note

* add test from #8913

* re-add _check_duplicate_tool_names and refactor imports

* rename inputs and outputs
2025-03-28 10:49:23 +01:00
Stefano Fiorucci 08cf09f83f refactor: create_tool_from_function + tool decorator (#8697)
* create_tool_from_function + decorator

* release note

* improve usage example

* add imports to @tool usage example

* clarify docstrings

* small docstring addition
2025-01-10 12:15:15 +01:00