-
Notifications
You must be signed in to change notification settings - Fork 63
LCORE-332: Lightspeed core needs to fully support WatsonX LLM provider #943
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
Merged
Merged
Changes from all commits
Commits
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| version: 2 | ||
|
|
||
| apis: | ||
| - agents | ||
| - batches | ||
| - datasetio | ||
| - eval | ||
| - files | ||
| - inference | ||
| - safety | ||
| - scoring | ||
| - telemetry | ||
| - tool_runtime | ||
| - vector_io | ||
|
|
||
| benchmarks: [] | ||
| conversations_store: | ||
| db_path: ${env.SQLITE_STORE_DIR:=~/.llama/storage/conversations.db} | ||
| type: sqlite | ||
| datasets: [] | ||
| image_name: starter | ||
| # external_providers_dir: /opt/app-root/src/.llama/providers.d | ||
| inference_store: | ||
| db_path: ${env.SQLITE_STORE_DIR:=~/.llama/storage/inference-store.db} | ||
| type: sqlite | ||
| metadata_store: | ||
| db_path: ${env.SQLITE_STORE_DIR:=~/.llama/storage/registry.db} | ||
| type: sqlite | ||
|
|
||
| providers: | ||
| inference: | ||
| - provider_id: watsonx | ||
| provider_type: remote::watsonx | ||
| config: | ||
| url: ${env.WATSONX_BASE_URL:=https://us-south.ml.cloud.ibm.com} | ||
| api_key: ${env.WATSONX_API_KEY:=key-not-set} | ||
| project_id: ${env.WATSONX_PROJECT_ID:=project-not-set} | ||
| timeout: 1200 | ||
| - provider_id: openai | ||
| provider_type: remote::openai | ||
| config: | ||
| api_key: ${env.OPENAI_API_KEY} | ||
| - config: {} | ||
| provider_id: sentence-transformers | ||
| provider_type: inline::sentence-transformers | ||
| files: | ||
| - config: | ||
| metadata_store: | ||
| table_name: files_metadata | ||
| backend: sql_default | ||
| storage_dir: ${env.SQLITE_STORE_DIR:=~/.llama/storage/files} | ||
| provider_id: meta-reference-files | ||
| provider_type: inline::localfs | ||
| safety: | ||
| - config: | ||
| excluded_categories: [] | ||
| provider_id: llama-guard | ||
| provider_type: inline::llama-guard | ||
| scoring: | ||
| - provider_id: basic | ||
| provider_type: inline::basic | ||
| config: {} | ||
| - provider_id: llm-as-judge | ||
| provider_type: inline::llm-as-judge | ||
| config: {} | ||
| - provider_id: braintrust | ||
| provider_type: inline::braintrust | ||
| config: | ||
| openai_api_key: '********' | ||
| tool_runtime: | ||
| - config: {} # Enable the RAG tool | ||
| provider_id: rag-runtime | ||
| provider_type: inline::rag-runtime | ||
| vector_io: | ||
| - config: # Define the storage backend for RAG | ||
| persistence: | ||
| namespace: vector_io::faiss | ||
| backend: kv_default | ||
| provider_id: faiss | ||
| provider_type: inline::faiss | ||
| agents: | ||
| - config: | ||
| persistence: | ||
| agent_state: | ||
| namespace: agents_state | ||
| backend: kv_default | ||
| responses: | ||
| table_name: agents_responses | ||
| backend: sql_default | ||
| provider_id: meta-reference | ||
| provider_type: inline::meta-reference | ||
| batches: | ||
| - config: | ||
| kvstore: | ||
| namespace: batches_store | ||
| backend: kv_default | ||
| provider_id: reference | ||
| provider_type: inline::reference | ||
| datasetio: | ||
| - config: | ||
| kvstore: | ||
| namespace: huggingface_datasetio | ||
| backend: kv_default | ||
| provider_id: huggingface | ||
| provider_type: remote::huggingface | ||
| - config: | ||
| kvstore: | ||
| namespace: localfs_datasetio | ||
| backend: kv_default | ||
| provider_id: localfs | ||
| provider_type: inline::localfs | ||
| eval: | ||
| - config: | ||
| kvstore: | ||
| namespace: eval_store | ||
| backend: kv_default | ||
| provider_id: meta-reference | ||
| provider_type: inline::meta-reference | ||
| scoring_fns: [] | ||
| telemetry: | ||
| enabled: true | ||
| server: | ||
| port: 8321 | ||
| storage: | ||
| backends: | ||
| kv_default: # Define the storage backend type for RAG, in this case registry and RAG are unified i.e. information on registered resources (e.g. models, vector_stores) are saved together with the RAG chunks | ||
| type: kv_sqlite | ||
| db_path: ${env.SQLITE_STORE_DIR:=~/.llama/storage/rag/kv_store.db} | ||
| sql_default: | ||
| type: sql_sqlite | ||
| db_path: ${env.SQLITE_STORE_DIR:=~/.llama/storage/sql_store.db} | ||
| stores: | ||
| metadata: | ||
| namespace: registry | ||
| backend: kv_default | ||
| inference: | ||
| table_name: inference_store | ||
| backend: sql_default | ||
| max_write_queue_size: 10000 | ||
| num_writers: 4 | ||
| conversations: | ||
| table_name: openai_conversations | ||
| backend: sql_default | ||
| prompts: | ||
| namespace: prompts | ||
| backend: kv_default | ||
| registered_resources: | ||
| models: | ||
| - model_id: custom-watsonx-model | ||
| provider_id: watsonx | ||
| model_type: llm | ||
| provider_model_id: watsonx/meta-llama/llama-3-3-70b-instruct | ||
| shields: | ||
| - shield_id: llama-guard | ||
| provider_id: llama-guard | ||
| provider_shield_id: openai/gpt-4o-mini | ||
| vector_dbs: [] | ||
| datasets: [] | ||
| scoring_fns: [] | ||
| benchmarks: [] | ||
| tool_groups: | ||
| - toolgroup_id: builtin::rag # Register the RAG tool | ||
| provider_id: rag-runtime | ||
| vector_stores: | ||
| default_provider_id: faiss | ||
| default_embedding_model: # Define the default embedding model for RAG | ||
| provider_id: sentence-transformers | ||
| model_id: nomic-ai/nomic-embed-text-v1.5 |
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 |
|---|---|---|
|
|
@@ -20,9 +20,9 @@ | |
| Toolgroup, | ||
| ToolgroupAgentToolGroupWithArgs, | ||
| ) | ||
| from llama_stack_client.types.alpha.tool_execution_step import ToolExecutionStep | ||
| from llama_stack_client.types.model_list_response import ModelListResponse | ||
| from llama_stack_client.types.shared.interleaved_content_item import TextContentItem | ||
| from llama_stack_client.types.alpha.tool_execution_step import ToolExecutionStep | ||
| from sqlalchemy.exc import SQLAlchemyError | ||
|
|
||
| import constants | ||
|
|
@@ -41,8 +41,8 @@ | |
| ForbiddenResponse, | ||
| InternalServerErrorResponse, | ||
| NotFoundResponse, | ||
| QueryResponse, | ||
| PromptTooLongResponse, | ||
| QueryResponse, | ||
| QuotaExceededResponse, | ||
| ReferencedDocument, | ||
| ServiceUnavailableResponse, | ||
|
|
@@ -543,7 +543,8 @@ def select_model_and_provider_id( | |
| logger.debug("Searching for model: %s, provider: %s", model_id, provider_id) | ||
| # TODO: Create sepparate validation of provider | ||
| if not any( | ||
| m.identifier == llama_stack_model_id and m.provider_id == provider_id | ||
| m.identifier in (llama_stack_model_id, model_id) | ||
|
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. the whole model/provider handling is a bit wacky, but it is OT: not a problem for this PR
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. Yep I agree |
||
| and m.provider_id == provider_id | ||
| for m in models | ||
| ): | ||
| message = f"Model {model_id} from provider {provider_id} not found in available 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.
Uh oh!
There was an error while loading. Please reload this page.