Skip to content
Discussion options

You must be logged in to vote

And figured it out

Model

public class Item
{
    [VectorStoreData]
    [JsonPropertyName("partitionKey")]
    public string PartitionKey => $"{Publication}-{PublishedDate:yyyy-MM}";

    [JsonPropertyName("id")]
    [VectorStoreKey]
    public required string Id { get; init; }
var database = cosmosClient.GetDatabase(_cosmosOptions.Database);

var cosmosOptions = new CosmosNoSqlCollectionOptions
{
    EmbeddingGenerator = embeddingGenerator,
    PartitionKeyProperties = new[] { nameof(Item.PartitionKey) }
};

_collection = new CosmosNoSqlCollection<CosmosNoSqlKey, Item>(database, _cosmosOptions.Container, cosmosOptions);

Upsert

await _collection.UpsertAsync(item, cancellationToken);

Read

var 

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jyrijh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
1 participant