-
Notifications
You must be signed in to change notification settings - Fork 8.2k
feat: Get live provider and model data from model.dev #11007
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
Open
deon-sanchez
wants to merge
10
commits into
main
Choose a base branch
from
lfoss-3056
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+921
−423
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
841b365
backend updated
deon-sanchez 76e271b
Merge branch 'main' of https://github.com/langflow-ai/langflow into l…
deon-sanchez cd81575
[autofix.ci] apply automated fixes
autofix-ci[bot] 114591e
updated to use provider env variable
deon-sanchez cf8d0c9
Merge branch 'lfoss-3056' of https://github.com/langflow-ai/langflow …
deon-sanchez 53f365d
[autofix.ci] apply automated fixes
autofix-ci[bot] 3c3fc1e
added doc url link
deon-sanchez 8a2f85f
Merge branch 'lfoss-3056' of https://github.com/langflow-ai/langflow …
deon-sanchez f6666e1
added doc prop
deon-sanchez f32664a
Merge branch 'main' of https://github.com/langflow-ai/langflow into l…
deon-sanchez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/frontend/src/controllers/API/queries/models/use-get-provider-variable-mapping.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { useQueryFunctionType } from "@/types/api"; | ||
| import { api } from "../../api"; | ||
| import { getURL } from "../../helpers/constants"; | ||
| import { UseRequestProcessor } from "../../services/request-processor"; | ||
|
|
||
| export type ProviderVariableMapping = Record<string, string>; | ||
|
|
||
| export const useGetProviderVariableMapping: useQueryFunctionType< | ||
| undefined, | ||
| ProviderVariableMapping | ||
| > = (options) => { | ||
| const { query } = UseRequestProcessor(); | ||
|
|
||
| const getProviderVariableMappingFn = | ||
| async (): Promise<ProviderVariableMapping> => { | ||
| try { | ||
| const url = `${getURL("MODELS")}/provider-variable-mapping`; | ||
| const response = await api.get<ProviderVariableMapping>(url); | ||
| return response.data; | ||
| } catch (error) { | ||
| console.error("Error fetching provider variable mapping:", error); | ||
| return {}; | ||
| } | ||
| }; | ||
|
|
||
| const queryResult = query( | ||
| ["useGetProviderVariableMapping"], | ||
| getProviderVariableMappingFn, | ||
| { | ||
| refetchOnWindowFocus: false, | ||
| staleTime: 1000 * 60 * 5, // 5 minutes | ||
| ...options, | ||
| }, | ||
| ); | ||
|
|
||
| return queryResult; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,41 @@ | ||
| from .model import LCModelComponent | ||
| from .model_metadata import ModelCost, ModelLimits, ModelMetadata, ModelModalities, create_model_metadata | ||
| from .models_dev_client import ( | ||
| clear_cache as clear_live_models_cache, | ||
| ) | ||
| from .models_dev_client import ( | ||
| fetch_models_dev_data, | ||
| get_live_models_detailed, | ||
| get_models_by_provider, | ||
| get_provider_metadata_from_api, | ||
| search_models, | ||
| ) | ||
| from .unified_models import ( | ||
| get_model_provider_variable_mapping, | ||
| get_model_providers, | ||
| get_unified_models_detailed, | ||
| refresh_live_model_data, | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| # Core components | ||
| "LCModelComponent", | ||
| # Unified models API | ||
| "get_model_provider_variable_mapping", | ||
| "get_model_providers", | ||
| "get_unified_models_detailed", | ||
| "refresh_live_model_data", | ||
| # Model metadata types | ||
| "ModelCost", | ||
| "ModelLimits", | ||
| "ModelMetadata", | ||
| "ModelModalities", | ||
| "create_model_metadata", | ||
| # Live models API (models.dev) | ||
| "clear_live_models_cache", | ||
| "fetch_models_dev_data", | ||
| "get_live_models_detailed", | ||
| "get_models_by_provider", | ||
| "get_provider_metadata_from_api", | ||
| "search_models", | ||
| ] | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Fix:
__all__is not sorted (pipeline failure).The static analysis is failing because
__all__entries are not sorted alphabetically. While the grouping comments are helpful for organization, Ruff's RUF022 rule requires sorted exports.Apply this diff to fix the pipeline failure:
📝 Committable suggestion
🧰 Tools
🪛 GitHub Actions: Ruff Style Check
[error] 20-20: RUF022
__all__is not sorted.🪛 GitHub Check: Ruff Style Check (3.13)
[failure] 20-41: Ruff (RUF022)
src/lfx/src/lfx/base/models/init.py:20:11: RUF022
__all__is not sorted🤖 Prompt for AI Agents