Skip to content

Commit

Permalink
feat: Added trimming compatible project to TrimmingHelper.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Aug 6, 2024
1 parent 824933c commit 709070b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
24 changes: 24 additions & 0 deletions src/Helpers/TrimmingHelper/TrimmingHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,34 @@

<ItemGroup>
<ProjectReference Include="..\..\Abstractions\src\LangChain.Databases.Abstractions.csproj" />
<ProjectReference Include="..\..\AzureCognitiveSearch\src\LangChain.Databases.AzureCognitiveSearch.csproj" />
<ProjectReference Include="..\..\AzureSearch\src\LangChain.Databases.AzureSearch.csproj" />
<ProjectReference Include="..\..\Elasticsearch\src\LangChain.Databases.Elasticsearch.csproj" />
<ProjectReference Include="..\..\InMemory\src\LangChain.Databases.InMemory.csproj" />
<ProjectReference Include="..\..\Kendra\src\LangChain.Databases.Kendra.csproj" />

<!-- <ProjectReference Include="..\..\SemanticKernel\src\LangChain.Databases.SemanticKernel.csproj" />-->
<!-- <ProjectReference Include="..\..\Chroma\src\LangChain.Databases.Chroma.csproj" />-->
<!-- <ProjectReference Include="..\..\Weaviate\src\LangChain.Databases.Weaviate.csproj" />-->
<!-- <ProjectReference Include="..\..\Milvus\src\LangChain.Databases.Milvus.csproj" />-->
<!-- <ProjectReference Include="..\..\DuckDb\src\LangChain.Databases.DuckDb.csproj" />-->
<!-- <ProjectReference Include="..\..\Redis\src\LangChain.Databases.Redis.csproj" />-->
<!-- <ProjectReference Include="..\..\Pinecone\src\LangChain.Databases.Pinecone.csproj" />-->
<!-- <ProjectReference Include="..\..\Qdrant\src\LangChain.Databases.Qdrant.csproj" />-->

<!-- <ProjectReference Include="..\..\Mongo\src\LangChain.Databases.Mongo.csproj" />-->
<!-- <ProjectReference Include="..\..\OpenSearch\src\LangChain.Databases.OpenSearch.csproj" />-->
<!-- <ProjectReference Include="..\..\Postgres\src\LangChain.Databases.Postgres.csproj" />-->
<!-- <ProjectReference Include="..\..\Sqlite\src\LangChain.Databases.Sqlite.csproj" />-->
</ItemGroup>

<ItemGroup>
<TrimmerRootAssembly Include="LangChain.Databases.Abstractions" />
<TrimmerRootAssembly Include="LangChain.Databases.AzureCognitiveSearch" />
<TrimmerRootAssembly Include="LangChain.Databases.AzureSearch" />
<TrimmerRootAssembly Include="LangChain.Databases.Elasticsearch" />
<TrimmerRootAssembly Include="LangChain.Databases.InMemory" />
<TrimmerRootAssembly Include="LangChain.Databases.Kendra" />
</ItemGroup>

<PropertyGroup Label="Publish">
Expand Down
13 changes: 13 additions & 0 deletions src/Sqlite/src/SourceGenerationContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
using LangChain.Databases.JsonConverters;
using LangChain.DocumentLoaders;

namespace LangChain.Databases.Sqlite;

[JsonSourceGenerationOptions(WriteIndented = true, Converters = [typeof(ObjectAsPrimitiveConverter)])]
[JsonSerializable(typeof(Document))]
[JsonSerializable(typeof(float[]))]
[JsonSerializable(typeof(int))]
[JsonSerializable(typeof(double))]
[JsonSerializable(typeof(float))]
internal sealed partial class SourceGenerationContext : JsonSerializerContext;
12 changes: 1 addition & 11 deletions src/Sqlite/src/SqLiteVectorCollection.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Serialization;
using LangChain.Databases.JsonConverters;
using LangChain.DocumentLoaders;
using Microsoft.Data.Sqlite;

Expand Down Expand Up @@ -173,12 +171,4 @@ public async Task<VectorSearchResponse> SearchAsync(
}).ToArray(),
};
}
}

[JsonSourceGenerationOptions(WriteIndented = true, Converters = [typeof(ObjectAsPrimitiveConverter)])]
[JsonSerializable(typeof(Document))]
[JsonSerializable(typeof(float[]))]
[JsonSerializable(typeof(int))]
[JsonSerializable(typeof(double))]
[JsonSerializable(typeof(float))]
internal sealed partial class SourceGenerationContext : JsonSerializerContext;
}

0 comments on commit 709070b

Please sign in to comment.