Skip to content
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

Cosmos DB No SQL Vector Search #103

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

aayush3011
Copy link
Member

Read more about CosmosDB NoSql Vector Search here

@aayush3011 aayush3011 changed the title Cosmos DB No SQL Vecto Search Cosmos DB No SQL Vector Search Jul 19, 2024
src/Directory.Build.props Outdated Show resolved Hide resolved
@manvkaur
Copy link
Collaborator

manvkaur commented Oct 4, 2024

merge latest of main branch

CosmosClient cosmosClient;
if (
!string.IsNullOrEmpty(connectionStringName)
&& this.cosmosDBClients.TryGetValue(connectionStringName, out cosmosClient)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line can be moved inside the if block rather than keeping it empty

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving that will be wrong, because in this if condition we need to check if the connectionStringName is not null and if the dictionary already contains the value retrieve it.

I can update this this with a different approach, where I use containsKey in the if statement and then assign it in the if block.

But normally in multithreaded apps, it's better to use TryGetValue, as it combines both the operation. It avoids the race condition, if the dictionary gets updated between the two separate operations.

Let me know which approach to go with.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to clarify my previous comment regarding line 119. I wasn’t suggesting any changes to lines 117 or 118; my focus was specifically on ensuring that the if block is not left blank.

I agree that using TryGetValue is a good approach, especially in multithreaded contexts. Please make sure to include logic within the if block to handle the value retrieval properly.

Let me know if you have any questions or need further clarification.

@@ -13,6 +13,24 @@ The sample is available in the following language stacks:

Please refer to the [root README](../../README.md#requirements) for common prerequisites that apply to all samples.

### Chat Storage Configuration
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heading to be updated

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, isn't this meant for No SQL sample but has been added in mongo v core sample

Comment on lines +20 to +22
- Please refer to this two documents to assign permissions for cosmos db account to the managed identity.
- [Control Plane operations](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/security/how-to-grant-control-plane-role-based-access?tabs=built-in-definition%2Ccsharp&pivots=azure-interface-cli)
- [Data Plane operations](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/security/how-to-grant-data-plane-role-based-access?tabs=built-in-definition%2Ccsharp&pivots=azure-interface-cli)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please suggest what are the minimal role assignment requirements for this sample?
It will be confusing for the users to figure this out from all the roles available.

Comment on lines +24 to +30
1. **Configure Cosmos URI**:

- Set the `cosmosUri` in the configuration as follows:

```json
"<CONNECTION_NAME_PREFIX>__cosmosUri": "cosmosUri"
```
Copy link
Collaborator

@manvkaur manvkaur Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few questions regarding the settings:

  1. Are these the only settings available?
  2. I noticed the following keywords in the code: tokenCredential, AccountEndpoint, and AccountKey. How are these intended to be used?
  3. Has the sample been verified on Azure using the following approaches?
    Managed Identity
    Connection String

@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>11.0</LangVersion>
<LangVersion>12.0</LangVersion>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants