-
-
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 32 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 .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, | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| "AzureAIClient", | ||
| "BedrockClient", | ||
| "DashscopeClient", | ||
| "GoogleEmbedderClient", | ||
| "GoogleGenAIClient", | ||
| "LiteLLMClient", | ||
| "OllamaClient", | ||
| "OpenAIClient", | ||
| "OpenRouterClient", | ||
| ] | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||
|
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. Importing
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.
Thus in this scenario, the |
||||||
|
|
||||||
|
|
||||||
| class LiteLLMClient(OpenAIClient): | ||||||
|
|
||||||
| 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 ( | ||||||||||||||||||||||||||||||||||||||||||||||
| LiteLLMClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| OpenRouterClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| BedrockClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| GoogleGenAIClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| GoogleEmbedderClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| AzureAIClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| DashscopeClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| OpenAIClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| OllamaClient, | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
|
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.
According to PEP 8, imports should be grouped in the following order:
Currently, the third-party import from
adalflowis 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.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.
fixed in 9ca0ae5