Skip to content
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a9a7b25
Refactor/chat streamer (#1)
GdoongMathew Jul 18, 2026
149c6eb
update `input_too_large` threshold (#2)
GdoongMathew Jul 18, 2026
6bdc4e8
patch: patch adalflow OllamaClient to support batch embedding api. (#3)
GdoongMathew Jul 18, 2026
98e499e
Revert "patch: patch adalflow OllamaClient to support batch embedding…
GdoongMathew Jul 18, 2026
7ef9f19
Feat/ollama batch embed patch (#5)
GdoongMathew Jul 18, 2026
6d2869e
Refactor/chat streamer (#6)
GdoongMathew Jul 18, 2026
a601f2b
fix: fix simple_chat format
GdoongMathew Jul 18, 2026
5066942
refactor and add clients module (#7)
GdoongMathew Jul 18, 2026
c411bee
centralize prompt (related to #306)
GdoongMathew Jul 19, 2026
0cb8957
centralize prompt (related to #306) (#8)
GdoongMathew Jul 19, 2026
075fbd5
fix prompt
GdoongMathew Jul 19, 2026
9b8c5b5
Merge branch 'refs/heads/refactor/centralize_prompt'
GdoongMathew Jul 19, 2026
f939434
Merge branch 'refs/heads/main' into feat/my_branch
GdoongMathew Jul 19, 2026
0843588
update `check_ollama_model_exists` using ollama.list api.
GdoongMathew Jul 19, 2026
da71585
fix exception type
GdoongMathew Jul 19, 2026
592523e
fix import scope
GdoongMathew Jul 19, 2026
c7c823a
Merge branch 'refs/heads/ref/check_ollama_model_exists' into feat/my_…
GdoongMathew Jul 19, 2026
84f0517
fix catching exception
GdoongMathew Jul 19, 2026
8613d94
Merge branch 'refs/heads/ref/check_ollama_model_exists' into feat/my_…
GdoongMathew Jul 19, 2026
0bf2d4b
remove dangling file.
GdoongMathew Jul 19, 2026
9907fdc
use field_validator to simplify dirs and files parsing in `ChatComple…
GdoongMathew Jul 20, 2026
d1afda8
Merge branch 'refs/heads/refactor/chat_completion_req' into feat/my_b…
GdoongMathew Jul 20, 2026
e66ae52
Apply suggestions from code review
GdoongMathew Jul 20, 2026
990f7b9
prevent empty string
GdoongMathew Jul 20, 2026
c233a44
unify chat model in `websocket_wiki` and `simple_chat`
GdoongMathew Jul 20, 2026
d4bd5f2
Merge branch 'refs/heads/refactor/chat_completion_req' into feat/my_b…
GdoongMathew Jul 20, 2026
95d00b4
import cleanup
GdoongMathew Jul 20, 2026
52ee7cf
Merge branch 'refs/heads/refactor/chat_completion_req' into feat/my_b…
GdoongMathew Jul 20, 2026
b336142
import documentations
GdoongMathew Jul 20, 2026
a47da86
Merge branch 'refs/heads/main' into feat/my_branch
GdoongMathew Jul 20, 2026
5de7d92
add EOF
GdoongMathew Jul 20, 2026
a9e1e41
change azureai client import path in `_stream` module.
GdoongMathew Jul 20, 2026
9ca0ae5
follwing pep8.
GdoongMathew Jul 20, 2026
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
488 changes: 0 additions & 488 deletions api/azureai_client.py

This file was deleted.

14 changes: 7 additions & 7 deletions api/chat/_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ollama import ChatResponse
from openai.types.chat import ChatCompletionChunk
from openai import AsyncStream
from api.openai_client import OpenAIClient
from api.clients import OpenAIClient

MODEL_CFG = dict[str, str | int | float]

Expand Down Expand Up @@ -106,7 +106,7 @@ def __init__(self, *, model: str, model_config: MODEL_CFG):
if not OPENROUTER_API_KEY:
logger.warning("OPENROUTER_API_KEY not configured, but continuing with request")
# We'll let the OpenRouterClient handle this and return a friendly error message
from api.openrouter_client import OpenRouterClient
from api.clients import OpenRouterClient

self.client = OpenRouterClient()
self.model_kwargs = {
Expand Down Expand Up @@ -185,7 +185,7 @@ def __init__(self, *, model: str, model_config: MODEL_CFG):
super().__init__(model=model, model_config=model_config)

def _build_client(self):
from api.openai_client import OpenAIClient
from api.clients import OpenAIClient
return OpenAIClient()


Expand All @@ -198,7 +198,7 @@ class AzureChatStreamer(_OpenAICompatStreamer):
)

def _build_client(self):
from api.azureai_client import AzureAIClient
from api.clients import AzureAIClient
return AzureAIClient()


Expand All @@ -217,7 +217,7 @@ def __init__(self, *, model: str, model_config: MODEL_CFG):
super().__init__(model=model, model_config=model_config)

def _build_client(self):
from api.litellm_client import LiteLLMClient
from api.clients import LiteLLMClient
return LiteLLMClient()


Expand All @@ -232,7 +232,7 @@ def __init__(self, *, model: str, model_config: MODEL_CFG):
if not AWS_ACCESS_KEY_ID or not AWS_SECRET_ACCESS_KEY:
logger.warning("AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY not configured, but continuing with request")
# We'll let the BedrockClient handle this and return an error message
from api.bedrock_client import BedrockClient
from api.clients import BedrockClient

self.client = BedrockClient()
self.model_kwargs = {"model": model}
Expand Down Expand Up @@ -267,7 +267,7 @@ class DashScopeChatStreamer(ChatStreamer):
)

def __init__(self, *, model: str, model_config: MODEL_CFG):
from api.dashscope_client import DashscopeClient
from api.clients import DashscopeClient

self.client = DashscopeClient()
self.model_kwargs = {
Expand Down
27 changes: 27 additions & 0 deletions api/clients/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Unify Adalflow compatible clients to here.
Any patches and additional clients could be applied or imported in this module.
"""

from .google_embedder import GoogleEmbedderClient
from .bedrock import BedrockClient
from .dashscope import DashscopeClient
from .ollama import OllamaClient
from .litellm import LiteLLMClient
from .openrouter import OpenRouterClient
from adalflow.components.model_client import (
AzureAIClient,
OpenAIClient,
GoogleGenAIClient,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to PEP 8, imports should be grouped in the following order:

  1. Standard library imports.
  2. Related third-party imports.
  3. Local application/library specific imports.

Currently, the third-party import from adalflow is placed after the local relative imports (e.g., .google_embedder). Placing third-party imports before local relative imports improves readability and adheres to PEP 8 guidelines.

Suggested change
from .google_embedder import GoogleEmbedderClient
from .bedrock import BedrockClient
from .dashscope import DashscopeClient
from .ollama import OllamaClient
from .litellm import LiteLLMClient
from .openrouter import OpenRouterClient
from adalflow.components.model_client import (
AzureAIClient,
OpenAIClient,
GoogleGenAIClient,
)
from adalflow.components.model_client import (
AzureAIClient,
OpenAIClient,
GoogleGenAIClient,
)
from .google_embedder import GoogleEmbedderClient
from .bedrock import BedrockClient
from .dashscope import DashscopeClient
from .ollama import OllamaClient
from .litellm import LiteLLMClient
from .openrouter import OpenRouterClient

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 9ca0ae5


__all__ = [
"AzureAIClient",
"BedrockClient",
"DashscopeClient",
"GoogleEmbedderClient",
"GoogleGenAIClient",
"LiteLLMClient",
"OllamaClient",
"OpenAIClient",
"OpenRouterClient",
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion api/litellm_client.py → api/clients/litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Optional, Callable
from openai import AsyncOpenAI, OpenAI

from api.openai_client import OpenAIClient
from adalflow.components.model_client.openai_client import OpenAIClient

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Importing OpenAIClient directly from the public namespace adalflow.components.model_client is preferred over importing from the internal submodule adalflow.components.model_client.openai_client. This ensures consistency with other imports in the project and guards against potential internal refactoring of the library.

Suggested change
from adalflow.components.model_client.openai_client import OpenAIClient
from adalflow.components.model_client import OpenAIClient

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenAIClient in scope model_client is wrapped as an LazyImport instance, which could not be subclassed.

https://github.com/SylphAI-Inc/AdalFlow/blob/810de99d86191b3aa0c939aa6d6d1a21977555aa/adalflow/adalflow/utils/lazy_import.py#L133-L139

Thus in this scenario, the OpenAIClient must be explicitly imported from openai_client so that LiteLLMClient could inherit from it.



class LiteLLMClient(OpenAIClient):
Expand Down
File renamed without changes.
File renamed without changes.
20 changes: 11 additions & 9 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@

logger = logging.getLogger(__name__)

from api.openai_client import OpenAIClient
from api.litellm_client import LiteLLMClient
from api.openrouter_client import OpenRouterClient
from api.bedrock_client import BedrockClient
from api.google_embedder_client import GoogleEmbedderClient
from api.azureai_client import AzureAIClient
from api.dashscope_client import DashscopeClient
from api.ollama_client import OllamaClient
from adalflow import GoogleGenAIClient
from api.clients import (
LiteLLMClient,
OpenRouterClient,
BedrockClient,
GoogleGenAIClient,
GoogleEmbedderClient,
AzureAIClient,
DashscopeClient,
OpenAIClient,
OllamaClient,
)
Comment on lines +10 to +20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Sorting imported names alphabetically within a multi-line import block improves readability and makes it easier to find specific clients as the list grows.

Suggested change
from api.clients import (
LiteLLMClient,
OpenRouterClient,
BedrockClient,
GoogleGenAIClient,
GoogleEmbedderClient,
AzureAIClient,
DashscopeClient,
OpenAIClient,
OllamaClient,
)
from api.clients import (
AzureAIClient,
BedrockClient,
DashscopeClient,
GoogleEmbedderClient,
GoogleGenAIClient,
LiteLLMClient,
OllamaClient,
OpenAIClient,
OpenRouterClient,
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 9ca0ae5


# Get API keys from environment variables
OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY')
Expand Down
Loading
Loading