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

.Net: 09-memory-with-chroma System.Text.Json.JsonException: Cannot get the value of a token type 'False' as a number. #2322

Closed
StevenTCramer opened this issue Aug 4, 2023 · 5 comments
Assignees
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@StevenTCramer
Copy link
Contributor

Describe the bug
I get an exception when running the 09-memory-with-chroma.ipynb notebook

To Reproduce
Steps to reproduce the behavior:

  1. go to 09-memory-with-chroma and run all.
  2. Scroll down to 'Let's try searching the memory:'
  3. See error

Expected behavior
No Error.

Platform

  • OS: Windows
  • IDE: VS Code
  • Version: 1.81.0-insider (user setup)
  • Language: C#
  • Source: Nuget
    Microsoft.SemanticKernel, 0.18.230725.3-preview
    Microsoft.SemanticKernel.Connectors.Memory.Chroma, 0.18.230725.3-preview
    System.Linq.Async, 6.0.1

Main Branch 8552943

Additional context
Chroma running in docker shows all 200 results.

Output
Installed Packages
Microsoft.SemanticKernel, 0.18.230725.3-preview
Microsoft.SemanticKernel.Connectors.Memory.Chroma, 0.18.230725.3-preview
System.Linq.Async, 6.0.1
Error: System.Text.Json.JsonException: The JSON value could not be converted to Microsoft.SemanticKernel.Memory.MemoryRecordMetadata. Path: $.is_reference | LineNumber: 0 | BytePositionInLine: 102.
---> System.InvalidOperationException: Cannot get the value of a token type 'False' as a number.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedNumber(JsonTokenType tokenType)
at System.Text.Json.Utf8JsonReader.TryGetInt16(Int16& value)
at Microsoft.SemanticKernel.Connectors.Memory.Chroma.ChromaBooleanConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter1.TryReadAsObject(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state, Object& value)
at System.Text.Json.Serialization.Converters.LargeObjectWithParameterizedConstructorConverter1.ReadAndCacheConstructorArgument(ReadStack& state, Utf8JsonReader& reader, JsonParameterInfo jsonParameterInfo) at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at Microsoft.SemanticKernel.Connectors.Memory.Chroma.ChromaMemoryStore.GetMetadataForMemoryRecord(List1 metadatas, Int32 recordIndex) at Microsoft.SemanticKernel.Connectors.Memory.[Chroma](https://www.trychroma.com/).ChromaMemoryStore.GetMemoryRecordFromModel(List1 metadatas, List1 embeddings, List1 ids, Int32 recordIndex)
at Microsoft.SemanticKernel.Connectors.Memory.Chroma.ChromaMemoryStore.GetMemoryRecordFromQueryResultModel(ChromaQueryResultModel queryResultModel, Int32 recordIndex)
at Microsoft.SemanticKernel.Connectors.Memory.Chroma.ChromaMemoryStore.GetNearestMatchesAsync(String collectionName, Embedding1 embedding, Int32 limit, Double minRelevanceScore, Boolean withEmbeddings, CancellationToken cancellationToken)+MoveNext() at Microsoft.SemanticKernel.Connectors.Memory.Chroma.ChromaMemoryStore.GetNearestMatchesAsync(String collectionName, Embedding1 embedding, Int32 limit, Double minRelevanceScore, Boolean withEmbeddings, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Microsoft.SemanticKernel.Memory.SemanticTextMemory.SearchAsync(String collection, String query, Int32 limit, Double minRelevanceScore, Boolean withEmbeddings, CancellationToken cancellationToken)+MoveNext()
at Microsoft.SemanticKernel.Memory.SemanticTextMemory.SearchAsync(String collection, String query, Int32 limit, Double minRelevanceScore, Boolean withEmbeddings, CancellationToken cancellationToken)+MoveNext()
at Microsoft.SemanticKernel.Memory.SemanticTextMemory.SearchAsync(String collection, String query, Int32 limit, Double minRelevanceScore, Boolean withEmbeddings, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at System.Linq.AsyncEnumerable.g__Core|95_0[TSource](IAsyncEnumerable1 source, CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/FirstOrDefault.cs:line 130 at System.Linq.AsyncEnumerable.<TryGetFirst>g__Core|95_0[TSource](IAsyncEnumerable1 source, CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/FirstOrDefault.cs:line 132
at System.Linq.AsyncEnumerable.g__Core|91_0[TSource](IAsyncEnumerable1 source, CancellationToken cancellationToken) in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/FirstOrDefault.cs:line 30 at Submission#6.<<Initialize>>d__0.MoveNext() --- End of stack trace from previous location --- at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray1 precedingExecutors, Func2 currentExecutor, StrongBox1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)

Error: (4,24): error CS7036: There is no argument given that corresponds to the required parameter 'memory' of 'TextMemorySkill.TextMemorySkill(ISemanticTextMemory)'

@shawncal shawncal added .NET Issue or Pull requests regarding .NET code triage labels Aug 4, 2023
@shawncal shawncal changed the title 09-memory-with-chroma System.Text.Json.JsonException: Cannot get the value of a token type 'False' as a number. .Net: 09-memory-with-chroma System.Text.Json.JsonException: Cannot get the value of a token type 'False' as a number. Aug 4, 2023
@alexminza
Copy link

alexminza commented Aug 4, 2023

Related to #2049

@Augustukas
Copy link

issue still occurs with 0.19.230804.2-preview

@evchaki evchaki added samples bug Something isn't working and removed triage labels Aug 10, 2023
@WillFrasier
Copy link

I'm also repro'ing.

@askfenn
Copy link

askfenn commented Sep 5, 2023

still present on 0.21.230828.2-preview

@dmytrostruk
Copy link
Member

Closing as fixed in this PR: #2796.
Supporting Chroma version 0.4.10 now.

@dmytrostruk dmytrostruk self-assigned this Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code
Projects
Archived in project
Development

No branches or pull requests

8 participants