-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-recursive-chunking
- Loading branch information
Showing
7 changed files
with
183 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
releasenotes/notes/chatmsg-from-openai-dict-f15b50d38bdf9abb.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
enhancements: | ||
- | | ||
Add the `from_openai_dict_format` class method to the `ChatMessage` class. It allows you to create a `ChatMessage` | ||
from a dictionary in the format expected by OpenAI's Chat API. |
6 changes: 6 additions & 0 deletions
6
releasenotes/notes/use-importlib-when-deserializing-callable-1f36f07c4518c2cf.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
enhancements: | ||
- | | ||
Improved deserialization of callables by using `importlib` instead of `sys.modules`. | ||
This change allows importing local functions and classes that are not in `sys.modules` | ||
when deserializing callables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# SPDX-FileCopyrightText: 2022-present deepset GmbH <[email protected]> | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import pytest | ||
import requests | ||
|
||
from haystack import DeserializationError | ||
from haystack.components.generators.utils import print_streaming_chunk | ||
from haystack.utils import serialize_callable, deserialize_callable | ||
|
||
|
@@ -36,3 +38,10 @@ def test_callable_deserialization_non_local(): | |
result = serialize_callable(requests.api.get) | ||
fn = deserialize_callable(result) | ||
assert fn is requests.api.get | ||
|
||
|
||
def test_callable_deserialization_error(): | ||
with pytest.raises(DeserializationError): | ||
deserialize_callable("this.is.not.a.valid.module") | ||
with pytest.raises(DeserializationError): | ||
deserialize_callable("sys.foobar") |