-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Move all ModelClient classes into client module.
#551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a9a7b25
149c6eb
6bdc4e8
98e499e
7ef9f19
6d2869e
a601f2b
5066942
c411bee
0cb8957
075fbd5
9b8c5b5
f939434
0843588
da71585
592523e
c7c823a
84f0517
8613d94
0bf2d4b
9907fdc
d1afda8
e66ae52
990f7b9
c233a44
d4bd5f2
95d00b4
52ee7cf
b336142
a47da86
5de7d92
a9e1e41
9ca0ae5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| 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 adalflow.components.model_client import ( | ||
| AzureAIClient, | ||
| OpenAIClient, | ||
| GoogleGenAIClient, | ||
| ) | ||
| from .bedrock import BedrockClient | ||
| from .dashscope import DashscopeClient | ||
| from .google_embedder import GoogleEmbedderClient | ||
| from .litellm import LiteLLMClient | ||
| from .ollama import OllamaClient | ||
| from .openrouter import OpenRouterClient | ||
|
|
||
| __all__ = [ | ||
| "AzureAIClient", | ||
| "BedrockClient", | ||
| "DashscopeClient", | ||
| "GoogleEmbedderClient", | ||
| "GoogleGenAIClient", | ||
| "LiteLLMClient", | ||
| "OllamaClient", | ||
| "OpenAIClient", | ||
| "OpenRouterClient", | ||
| ] |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 ( | ||||||||||||||||||||||||||||||||||||||||||||||
| AzureAIClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| BedrockClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| DashscopeClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| GoogleEmbedderClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| GoogleGenAIClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| LiteLLMClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| OllamaClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| OpenAIClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| OpenRouterClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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') | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Importing
OpenAIClientdirectly from the public namespaceadalflow.components.model_clientis preferred over importing from the internal submoduleadalflow.components.model_client.openai_client. This ensures consistency with other imports in the project and guards against potential internal refactoring of the library.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenAIClientin scopemodel_clientis wrapped as anLazyImportinstance, 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
OpenAIClientmust be explicitly imported fromopenai_clientso thatLiteLLMClientcould inherit from it.