Skip to content

Commit 361ef21

Browse files
committed
Vector store may not have a name
This is not required in the API, so we must account for unnamed ones.
1 parent 3c64821 commit 361ef21

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dotnet-openai/Vectors/ListCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ public override int Execute(CommandContext context, ListCommandSettings settings
4545
foreach (var node in nodes["data"]!.AsArray().AsEnumerable().Where(x => x != null))
4646
{
4747
var id = node!["id"]!.ToString();
48-
var name = node["name"]!.ToString();
48+
var name = node["name"]?.ToString() ?? "";
4949

50-
mapper.SetId(name, id);
50+
if (!string.IsNullOrEmpty(name))
51+
mapper.SetId(name, id);
5152

5253
table.AddRow(
5354
id,

0 commit comments

Comments
 (0)