mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-08-29 10:56:40 +00:00

* chatgpt backend * fix tests * reno * remove print * helpers tests * add chatgpt generator * use openai sdk * remove backend * tests are broken * fix tests * stray param * move _check_troncated_answers into the class * wrong import * rename function * typo in test * add openai deps * mypy * improve system prompt docstring * typos update * Update haystack/preview/components/generators/openai/chatgpt.py * pylint * Update haystack/preview/components/generators/openai/chatgpt.py Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com> * Update haystack/preview/components/generators/openai/chatgpt.py Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com> * Update haystack/preview/components/generators/openai/chatgpt.py Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com> * review feedback * fix tests * freview feedback * reno * remove tenacity mock * gpt35generator * fix naming * remove stray references to chatgpt * fix e2e * Update releasenotes/notes/chatgpt-llm-generator-d043532654efe684.yaml Co-authored-by: Daria Fokina <daria.fokina@deepset.ai> * add another test * test wrong model name * review feedback --------- Co-authored-by: Daria Fokina <daria.fokina@deepset.ai> Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com>
14 lines
307 B
Python
14 lines
307 B
Python
from unittest.mock import Mock, patch
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture()
|
|
def mock_tokenizer():
|
|
"""
|
|
Tokenizes the string by splitting on spaces.
|
|
"""
|
|
tokenizer = Mock()
|
|
tokenizer.encode = lambda text: text.split()
|
|
tokenizer.decode = lambda tokens: " ".join(tokens)
|
|
return tokenizer
|