-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit - Moves the implicit conversions for Grpc types to Qdrant.Client.Grpc. - Introduce a conversion for Values and update usage in tests - Mark timeout readonly and simplify switch not null check - Add implicit conversions for WithPayloadSelector and WithVectorsSelector.
- Loading branch information
Showing
9 changed files
with
137 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Qdrant.Client.Grpc; | ||
|
||
/// <summary> | ||
/// A vector | ||
/// </summary> | ||
public partial class Vector | ||
{ | ||
/// <summary> | ||
/// Implicitly converts an array of <see cref="float"/> to a new instance of <see cref="Vector"/> | ||
/// </summary> | ||
/// <param name="values">the array of floats</param> | ||
/// <returns>a new instance of <see cref="Vector"/></returns> | ||
public static implicit operator Vector(float[] values) => new() { Data = { values } }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace Qdrant.Client.Grpc; | ||
|
||
/// <summary> | ||
/// A single vector or map of named vectors. | ||
/// </summary> | ||
public partial class Vectors | ||
{ | ||
/// <summary> | ||
/// Implicitly converts an array of <see cref="float"/> to a new instance of <see cref="Vectors"/> | ||
/// </summary> | ||
/// <param name="values">the array of floats</param> | ||
/// <returns>a new instance of <see cref="Vectors"/></returns> | ||
public static implicit operator Vectors(float[] values) => | ||
new() { Vector = new() { Data = { values } } }; | ||
|
||
/// <summary> | ||
/// Implicitly converts a dictionary of <see cref="string"/> and array of <see cref="float"/> to a new instance | ||
/// of <see cref="Vectors"/> | ||
/// </summary> | ||
/// <param name="values">a dictionary of string and array of floats</param> | ||
/// <returns>a new instance of <see cref="Vectors"/></returns> | ||
public static implicit operator Vectors(Dictionary<string, float[]> values) | ||
{ | ||
var namedVectors = new NamedVectors(); | ||
foreach (var value in values) | ||
namedVectors.Vectors.Add(value.Key, value.Value); | ||
|
||
return new Vectors { Vectors_ = namedVectors }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Qdrant.Client.Grpc; | ||
|
||
/// <summary> | ||
/// Selects payload to return | ||
/// </summary> | ||
public partial class WithPayloadSelector | ||
{ | ||
/// <summary> | ||
/// Implicitly converts <see cref="bool"/> to a new instance of <see cref="WithPayloadSelector"/> | ||
/// </summary> | ||
/// <param name="enable">If <code>true</code> return all payload, if <code>false</code> then none</param> | ||
/// <returns>a new instance of <see cref="WithPayloadSelector"/></returns> | ||
public static implicit operator WithPayloadSelector(bool enable) => new() { Enable = enable }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Qdrant.Client.Grpc; | ||
|
||
/// <summary> | ||
/// Selects vectors to return | ||
/// </summary> | ||
public partial class WithVectorsSelector | ||
{ | ||
/// <summary> | ||
/// Implicitly converts <see cref="bool"/> to a new instance of <see cref="WithPayloadSelector"/> | ||
/// </summary> | ||
/// <param name="enable">If <code>true</code> return all vectors, if <code>false</code> then none</param> | ||
/// <returns>a new instance of <see cref="WithPayloadSelector"/></returns> | ||
public static implicit operator WithVectorsSelector(bool enable) => new() { Enable = enable }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters