Skip to content

Commit 4c11b95

Browse files
author
Raja Phanindra Chava
committed
Updated embedding model alias in samples
1 parent 25c917f commit 4c11b95

6 files changed

Lines changed: 26 additions & 12 deletions

File tree

samples/cs/embeddings/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
var catalog = await mgr.GetCatalogAsync();
2121

2222
// Get an embedding model
23-
var model = await catalog.GetModelAsync("qwen3-0.6b-embedding") ?? throw new Exception("Embedding model not found");
23+
var model = await catalog.GetModelAsync("qwen3-embedding-0.6b") ?? throw new Exception("Embedding model not found");
2424

2525
// Download the model (the method skips download if already cached)
2626
await model.DownloadAsync(progress =>

samples/js/embeddings/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ console.log('✓ SDK initialized successfully');
1616

1717
// <model_setup>
1818
// Get an embedding model
19-
const modelAlias = 'qwen3-0.6b-embedding';
19+
const modelAlias = 'qwen3-embedding-0.6b';
2020
const model = await manager.catalog.getModel(modelAlias);
2121

2222
// Download the model

samples/python/embeddings/src/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def main():
1212
manager = FoundryLocalManager.instance
1313

1414
# Select and load an embedding model from the catalog
15-
model = manager.catalog.get_model("qwen3-0.6b-embedding")
15+
model = manager.catalog.get_model("qwen3-embedding-0.6b")
1616
model.download(
1717
lambda progress: print(
1818
f"\rDownloading model: {progress:.2f}%",

samples/rust/embeddings/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use foundry_local_sdk::{FoundryLocalConfig, FoundryLocalManager};
77
// </imports>
88

9-
const ALIAS: &str = "qwen3-0.6b-embedding";
9+
const ALIAS: &str = "qwen3-embedding-0.6b";
1010

1111
#[tokio::main]
1212
async fn main() -> Result<(), Box<dyn std::error::Error>> {

sdk/cpp/sample/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ int main() {
387387
ChatWithToolCalling(manager, "phi-3.5-mini");
388388

389389
// 6. Embeddings (uncomment and set a valid embedding model alias)
390-
// GenerateEmbeddings(manager, "qwen3-0.6b-embedding");
390+
GenerateEmbeddings(manager, "qwen3-embedding-0.6b");
391391

392392
Manager::Destroy();
393393
return 0;

sdk/cpp/test/e2e_test.cpp

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,29 @@ class EndToEndTest : public ::testing::Test {
6363

6464
static bool IsEmbeddingModel(const std::string& alias) { return alias.find("embedding") != std::string::npos; }
6565

66-
/// Variant ID the other SDK test suites use and that test-data-shared ships.
67-
static constexpr const char* kTestEmbeddingModelVariantId = "qwen3-0.6b-embedding-generic-cpu:1";
6866

69-
/// Returns the specific embedding model variant shipped by the sibling
70-
/// test-data-shared repo. Mirrors the C#/JS/Python/Rust SDK test suites,
71-
/// which all load `qwen3-0.6b-embedding-generic-cpu:1` directly rather
72-
/// than picking whatever happens to be cached.
67+
/// Find an embedding model, preferring cached.
7368
static IModel* FindEmbeddingModel(Catalog& catalog) {
74-
return catalog.GetModelVariant(kTestEmbeddingModelVariantId);
69+
IModel* target = nullptr;
70+
71+
auto cached = catalog.GetCachedModels();
72+
for (auto* variant : cached) {
73+
if (IsEmbeddingModel(variant->GetAlias())) {
74+
target = catalog.GetModel(variant->GetAlias());
75+
if (target)
76+
break;
77+
}
78+
}
79+
80+
if (!target) {
81+
for (const auto& alias : {"qwen3-embedding-0.6b"}) {
82+
target = catalog.GetModel(alias);
83+
if (target)
84+
break;
85+
}
86+
}
87+
88+
return target;
7589
}
7690

7791
/// Find a chat-capable model, preferring cached, then known small models, then any.

0 commit comments

Comments
 (0)