diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 000000000..26d33521a
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/haystack-core-integrations.iml b/.idea/haystack-core-integrations.iml
new file mode 100644
index 000000000..aad402c4e
--- /dev/null
+++ b/.idea/haystack-core-integrations.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 000000000..f8c314c08
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,275 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 000000000..105ce2da2
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 000000000..35eb1ddfb
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/integrations/cohere/src/haystack_integrations/components/embedders/__init__.py b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/__init__.py
similarity index 100%
rename from integrations/cohere/src/haystack_integrations/components/embedders/__init__.py
rename to integrations/cohere/src/haystack_integrations/components/embedders/cohere/__init__.py
diff --git a/integrations/cohere/src/haystack_integrations/components/embedders/document_embedder.py b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/document_embedder.py
similarity index 98%
rename from integrations/cohere/src/haystack_integrations/components/embedders/document_embedder.py
rename to integrations/cohere/src/haystack_integrations/components/embedders/cohere/document_embedder.py
index 77d88a395..69308ad19 100644
--- a/integrations/cohere/src/haystack_integrations/components/embedders/document_embedder.py
+++ b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/document_embedder.py
@@ -5,9 +5,10 @@
import os
from typing import Any, Dict, List, Optional
-from cohere import COHERE_API_URL, AsyncClient, Client
from haystack import Document, component, default_to_dict
-from haystack_integrations.components.embedders.utils import get_async_response, get_response
+from haystack_integrations.components.embedders.cohere.utils import get_async_response, get_response
+
+from cohere import COHERE_API_URL, AsyncClient, Client
@component
diff --git a/integrations/cohere/src/haystack_integrations/components/embedders/text_embedder.py b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/text_embedder.py
similarity index 98%
rename from integrations/cohere/src/haystack_integrations/components/embedders/text_embedder.py
rename to integrations/cohere/src/haystack_integrations/components/embedders/cohere/text_embedder.py
index be4c867fa..2fa922004 100644
--- a/integrations/cohere/src/haystack_integrations/components/embedders/text_embedder.py
+++ b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/text_embedder.py
@@ -5,9 +5,10 @@
import os
from typing import Any, Dict, List, Optional
-from cohere import COHERE_API_URL, AsyncClient, Client
from haystack import component, default_to_dict
-from haystack_integrations.components.embedders.utils import get_async_response, get_response
+from haystack_integrations.components.embedders.cohere.utils import get_async_response, get_response
+
+from cohere import COHERE_API_URL, AsyncClient, Client
@component
diff --git a/integrations/cohere/src/haystack_integrations/components/embedders/utils.py b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/utils.py
similarity index 99%
rename from integrations/cohere/src/haystack_integrations/components/embedders/utils.py
rename to integrations/cohere/src/haystack_integrations/components/embedders/cohere/utils.py
index 1c1049852..7b9c90730 100644
--- a/integrations/cohere/src/haystack_integrations/components/embedders/utils.py
+++ b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/utils.py
@@ -3,9 +3,10 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Dict, List, Tuple
-from cohere import AsyncClient, Client, CohereError
from tqdm import tqdm
+from cohere import AsyncClient, Client, CohereError
+
async def get_async_response(cohere_async_client: AsyncClient, texts: List[str], model_name, input_type, truncate):
all_embeddings: List[List[float]] = []
diff --git a/integrations/cohere/src/haystack_integrations/components/generators/__init__.py b/integrations/cohere/src/haystack_integrations/components/generators/cohere/__init__.py
similarity index 100%
rename from integrations/cohere/src/haystack_integrations/components/generators/__init__.py
rename to integrations/cohere/src/haystack_integrations/components/generators/cohere/__init__.py
diff --git a/integrations/cohere/src/haystack_integrations/components/generators/chat/__init__.py b/integrations/cohere/src/haystack_integrations/components/generators/cohere/chat/__init__.py
similarity index 100%
rename from integrations/cohere/src/haystack_integrations/components/generators/chat/__init__.py
rename to integrations/cohere/src/haystack_integrations/components/generators/cohere/chat/__init__.py
diff --git a/integrations/cohere/src/haystack_integrations/components/generators/chat/chat_generator.py b/integrations/cohere/src/haystack_integrations/components/generators/cohere/chat/chat_generator.py
similarity index 100%
rename from integrations/cohere/src/haystack_integrations/components/generators/chat/chat_generator.py
rename to integrations/cohere/src/haystack_integrations/components/generators/cohere/chat/chat_generator.py
diff --git a/integrations/cohere/src/haystack_integrations/components/generators/generator.py b/integrations/cohere/src/haystack_integrations/components/generators/cohere/generator.py
similarity index 99%
rename from integrations/cohere/src/haystack_integrations/components/generators/generator.py
rename to integrations/cohere/src/haystack_integrations/components/generators/cohere/generator.py
index 9917f17ea..7bca3ed9f 100644
--- a/integrations/cohere/src/haystack_integrations/components/generators/generator.py
+++ b/integrations/cohere/src/haystack_integrations/components/generators/cohere/generator.py
@@ -6,9 +6,10 @@
import sys
from typing import Any, Callable, Dict, List, Optional, cast
+from haystack import DeserializationError, component, default_from_dict, default_to_dict
+
from cohere import COHERE_API_URL, Client
from cohere.responses import Generations
-from haystack import DeserializationError, component, default_from_dict, default_to_dict
logger = logging.getLogger(__name__)
diff --git a/integrations/cohere/tests/test_cohere_chat_generator.py b/integrations/cohere/tests/test_cohere_chat_generator.py
index b3502d51e..cc360f5c9 100644
--- a/integrations/cohere/tests/test_cohere_chat_generator.py
+++ b/integrations/cohere/tests/test_cohere_chat_generator.py
@@ -5,7 +5,7 @@
import pytest
from haystack.components.generators.utils import default_streaming_callback
from haystack.dataclasses import ChatMessage, ChatRole, StreamingChunk
-from haystack_integrations.components.generators.chat import CohereChatGenerator
+from haystack_integrations.components.generators.cohere.chat import CohereChatGenerator
pytestmark = pytest.mark.chat_generators
@@ -87,7 +87,7 @@ def test_to_dict_default(self):
component = CohereChatGenerator(api_key="test-api-key")
data = component.to_dict()
assert data == {
- "type": "haystack_integrations.components.generators.chat.chat_generator.CohereChatGenerator",
+ "type": "haystack_integrations.components.generators.cohere.chat.chat_generator.CohereChatGenerator",
"init_parameters": {
"model": "command",
"streaming_callback": None,
@@ -107,7 +107,7 @@ def test_to_dict_with_parameters(self):
)
data = component.to_dict()
assert data == {
- "type": "haystack_integrations.components.generators.chat.chat_generator.CohereChatGenerator",
+ "type": "haystack_integrations.components.generators.cohere.chat.chat_generator.CohereChatGenerator",
"init_parameters": {
"model": "command-nightly",
"streaming_callback": "haystack.components.generators.utils.default_streaming_callback",
@@ -127,7 +127,7 @@ def test_to_dict_with_lambda_streaming_callback(self):
)
data = component.to_dict()
assert data == {
- "type": "haystack_integrations.components.generators.chat.chat_generator.CohereChatGenerator",
+ "type": "haystack_integrations.components.generators.cohere.chat.chat_generator.CohereChatGenerator",
"init_parameters": {
"model": "command",
"api_base_url": "test-base-url",
@@ -140,7 +140,7 @@ def test_to_dict_with_lambda_streaming_callback(self):
def test_from_dict(self, monkeypatch):
monkeypatch.setenv("COHERE_API_KEY", "fake-api-key")
data = {
- "type": "haystack_integrations.components.generators.chat.chat_generator.CohereChatGenerator",
+ "type": "haystack_integrations.components.generators.cohere.chat.chat_generator.CohereChatGenerator",
"init_parameters": {
"model": "command",
"api_base_url": "test-base-url",
@@ -158,7 +158,7 @@ def test_from_dict(self, monkeypatch):
def test_from_dict_fail_wo_env_var(self, monkeypatch):
monkeypatch.delenv("COHERE_API_KEY", raising=False)
data = {
- "type": "haystack_integrations.components.generators.chat.chat_generator.CohereChatGenerator",
+ "type": "haystack_integrations.components.generators.cohere.chat.chat_generator.CohereChatGenerator",
"init_parameters": {
"model": "command",
"api_base_url": "test-base-url",
diff --git a/integrations/cohere/tests/test_cohere_generators.py b/integrations/cohere/tests/test_cohere_generators.py
index bc98731d0..e2ce10405 100644
--- a/integrations/cohere/tests/test_cohere_generators.py
+++ b/integrations/cohere/tests/test_cohere_generators.py
@@ -5,7 +5,7 @@
import pytest
from cohere import COHERE_API_URL
-from haystack_integrations.components.generators import CohereGenerator
+from haystack_integrations.components.generators.cohere import CohereGenerator
pytestmark = pytest.mark.generators
@@ -47,7 +47,7 @@ def test_to_dict_default(self):
component = CohereGenerator(api_key="test-api-key")
data = component.to_dict()
assert data == {
- "type": "haystack_integrations.components.generators.generator.CohereGenerator",
+ "type": "haystack_integrations.components.generators.cohere.generator.CohereGenerator",
"init_parameters": {
"model": "command",
"streaming_callback": None,
@@ -66,7 +66,7 @@ def test_to_dict_with_parameters(self):
)
data = component.to_dict()
assert data == {
- "type": "haystack_integrations.components.generators.generator.CohereGenerator",
+ "type": "haystack_integrations.components.generators.cohere.generator.CohereGenerator",
"init_parameters": {
"model": "command-light",
"max_tokens": 10,
@@ -87,7 +87,7 @@ def test_to_dict_with_lambda_streaming_callback(self):
)
data = component.to_dict()
assert data == {
- "type": "haystack_integrations.components.generators.generator.CohereGenerator",
+ "type": "haystack_integrations.components.generators.cohere.generator.CohereGenerator",
"init_parameters": {
"model": "command",
"streaming_callback": "tests.test_cohere_generators.",
@@ -100,7 +100,7 @@ def test_to_dict_with_lambda_streaming_callback(self):
def test_from_dict(self, monkeypatch):
monkeypatch.setenv("COHERE_API_KEY", "test-key")
data = {
- "type": "haystack_integrations.components.generators.generator.CohereGenerator",
+ "type": "haystack_integrations.components.generators.cohere.generator.CohereGenerator",
"init_parameters": {
"model": "command",
"max_tokens": 10,
diff --git a/integrations/cohere/tests/test_document_embedder.py b/integrations/cohere/tests/test_document_embedder.py
index 5cc8eb745..efe8eb36a 100644
--- a/integrations/cohere/tests/test_document_embedder.py
+++ b/integrations/cohere/tests/test_document_embedder.py
@@ -6,7 +6,7 @@
import pytest
from cohere import COHERE_API_URL
from haystack import Document
-from haystack_integrations.components.embedders import CohereDocumentEmbedder
+from haystack_integrations.components.embedders.cohere import CohereDocumentEmbedder
pytestmark = pytest.mark.embedders
@@ -59,7 +59,7 @@ def test_to_dict(self):
embedder_component = CohereDocumentEmbedder(api_key="test-api-key")
component_dict = embedder_component.to_dict()
assert component_dict == {
- "type": "haystack_integrations.components.embedders.document_embedder.CohereDocumentEmbedder",
+ "type": "haystack_integrations.components.embedders.cohere.document_embedder.CohereDocumentEmbedder",
"init_parameters": {
"model": "embed-english-v2.0",
"input_type": "search_document",
@@ -92,7 +92,7 @@ def test_to_dict_with_custom_init_parameters(self):
)
component_dict = embedder_component.to_dict()
assert component_dict == {
- "type": "haystack_integrations.components.embedders.document_embedder.CohereDocumentEmbedder",
+ "type": "haystack_integrations.components.embedders.cohere.document_embedder.CohereDocumentEmbedder",
"init_parameters": {
"model": "embed-multilingual-v2.0",
"input_type": "search_query",
diff --git a/integrations/cohere/tests/test_text_embedder.py b/integrations/cohere/tests/test_text_embedder.py
index 825b62942..657d8df83 100644
--- a/integrations/cohere/tests/test_text_embedder.py
+++ b/integrations/cohere/tests/test_text_embedder.py
@@ -5,7 +5,7 @@
import pytest
from cohere import COHERE_API_URL
-from haystack_integrations.components.embedders import CohereTextEmbedder
+from haystack_integrations.components.embedders.cohere import CohereTextEmbedder
pytestmark = pytest.mark.embedders
@@ -56,7 +56,7 @@ def test_to_dict(self):
embedder_component = CohereTextEmbedder(api_key="test-api-key")
component_dict = embedder_component.to_dict()
assert component_dict == {
- "type": "haystack_integrations.components.embedders.text_embedder.CohereTextEmbedder",
+ "type": "haystack_integrations.components.embedders.cohere.text_embedder.CohereTextEmbedder",
"init_parameters": {
"model": "embed-english-v2.0",
"input_type": "search_query",
@@ -84,7 +84,7 @@ def test_to_dict_with_custom_init_parameters(self):
)
component_dict = embedder_component.to_dict()
assert component_dict == {
- "type": "haystack_integrations.components.embedders.text_embedder.CohereTextEmbedder",
+ "type": "haystack_integrations.components.embedders.cohere.text_embedder.CohereTextEmbedder",
"init_parameters": {
"model": "embed-multilingual-v2.0",
"input_type": "classification",