Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions haystack/components/embedders/azure_document_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@ def warm_up(self) -> None:
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=False)
self.client = AzureOpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.client = AzureOpenAI(http_client=http_client, **self._client_kwargs())

async def warm_up_async(self) -> None: # noqa: RUF029
"""
Expand All @@ -186,10 +183,7 @@ async def warm_up_async(self) -> None: # noqa: RUF029
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=True)
self.async_client = AsyncAzureOpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.async_client = AsyncAzureOpenAI(http_client=http_client, **self._client_kwargs())

def close(self) -> None:
"""
Expand Down
10 changes: 2 additions & 8 deletions haystack/components/embedders/azure_text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ def warm_up(self) -> None:
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=False)
self.client = AzureOpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.client = AzureOpenAI(http_client=http_client, **self._client_kwargs())

async def warm_up_async(self) -> None: # noqa: RUF029
"""
Expand All @@ -167,10 +164,7 @@ async def warm_up_async(self) -> None: # noqa: RUF029
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=True)
self.async_client = AsyncAzureOpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.async_client = AsyncAzureOpenAI(http_client=http_client, **self._client_kwargs())

def close(self) -> None:
"""
Expand Down
10 changes: 2 additions & 8 deletions haystack/components/embedders/openai_document_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,7 @@ def warm_up(self) -> None:
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=False)
self.client = OpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.client = OpenAI(http_client=http_client, **self._client_kwargs())

async def warm_up_async(self) -> None: # noqa: RUF029
"""
Expand All @@ -159,10 +156,7 @@ async def warm_up_async(self) -> None: # noqa: RUF029
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=True)
self.async_client = AsyncOpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.async_client = AsyncOpenAI(http_client=http_client, **self._client_kwargs())

def close(self) -> None:
"""
Expand Down
10 changes: 2 additions & 8 deletions haystack/components/embedders/openai_text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ def warm_up(self) -> None:
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=False)
self.client = OpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.client = OpenAI(http_client=http_client, **self._client_kwargs())

async def warm_up_async(self) -> None: # noqa: RUF029
"""
Expand All @@ -134,10 +131,7 @@ async def warm_up_async(self) -> None: # noqa: RUF029
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=True)
self.async_client = AsyncOpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.async_client = AsyncOpenAI(http_client=http_client, **self._client_kwargs())

def close(self) -> None:
"""
Expand Down
2 changes: 2 additions & 0 deletions haystack/components/generators/chat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

_import_structure = {
"openai": ["OpenAIChatGenerator"],
"openai_batch": ["OpenAIBatchChatGenerator"],
"openai_responses": ["OpenAIResponsesChatGenerator"],
"azure": ["AzureOpenAIChatGenerator"],
"azure_responses": ["AzureOpenAIResponsesChatGenerator"],
Expand All @@ -24,6 +25,7 @@
from .llm import LLM as LLM
from .mock import MockChatGenerator as MockChatGenerator
from .openai import OpenAIChatGenerator as OpenAIChatGenerator
from .openai_batch import OpenAIBatchChatGenerator as OpenAIBatchChatGenerator
from .openai_responses import OpenAIResponsesChatGenerator as OpenAIResponsesChatGenerator

else:
Expand Down
10 changes: 2 additions & 8 deletions haystack/components/generators/chat/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,7 @@ def warm_up(self) -> None:
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=False)
self.client = AzureOpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.client = AzureOpenAI(http_client=http_client, **self._client_kwargs())

async def warm_up_async(self) -> None: # noqa: RUF029
"""
Expand All @@ -288,10 +285,7 @@ async def warm_up_async(self) -> None: # noqa: RUF029
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=True)
self.async_client = AsyncAzureOpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.async_client = AsyncAzureOpenAI(http_client=http_client, **self._client_kwargs())

def close(self) -> None:
"""
Expand Down
10 changes: 2 additions & 8 deletions haystack/components/generators/chat/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,7 @@ def warm_up(self) -> None:
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=False)
self.client = OpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.client = OpenAI(http_client=http_client, **self._client_kwargs())

async def warm_up_async(self) -> None: # noqa: RUF029
"""
Expand All @@ -254,10 +251,7 @@ async def warm_up_async(self) -> None: # noqa: RUF029
# openai>=3 annotates http_client as httpx2, but legacy httpx clients are supported at runtime.
# https://github.com/openai/openai-python/blob/main/httpx2.md
http_client = init_http_client(self.http_client_kwargs, async_client=True)
self.async_client = AsyncOpenAI(
http_client=http_client, # type: ignore[arg-type]
**self._client_kwargs(),
)
self.async_client = AsyncOpenAI(http_client=http_client, **self._client_kwargs())

def close(self) -> None:
"""
Expand Down
Loading
Loading