Skip to content

Commit bc8cd54

Browse files
authored
Merge pull request #721 from Cualeva/master
Added parameters on RequestModels for using new OpenAI features
2 parents e1eb5e5 + c83e686 commit bc8cd54

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

OpenAI.SDK/ObjectModels/RequestModels/CreateVectorStoreFileRequest.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,13 @@ public class CreateVectorStoreFileRequest
1010
/// </summary>
1111
[JsonPropertyName("file_id")]
1212
public string FileId { get; set; }
13+
14+
/// <summary>
15+
/// Set of 16 key-value pairs that can be attached to an object.
16+
/// This can be useful for storing additional information about the object in a structured format,
17+
/// and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters.
18+
/// Values are strings with a maximum length of 512 characters, booleans, or numbers.
19+
/// </summary>
20+
[JsonPropertyName("attributes")]
21+
public Dictionary<string, object>? Attributes { get; set; }
1322
}

OpenAI.SDK/ObjectModels/RequestModels/RunCreateRequest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,11 @@ public class RunCreateRequest : IOpenAIModels.IModel, IOpenAIModels.IMetaData, I
117117
/// </summary>
118118
[JsonPropertyName("temperature")]
119119
public float? Temperature { get; set; }
120+
121+
/// <summary>
122+
/// Constrains effort on reasoning for <see href="https://platform.openai.com/docs/guides/reasoning">reasoning models</see>. Currently supported values are low, medium, and high.
123+
/// Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
124+
/// </summary>
125+
[JsonPropertyName("reasoning_effort")]
126+
public string? ReasoningEffort { get; set; }
120127
}

OpenAI.SDK/ObjectModels/RequestModels/ToolDefinition.cs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ public class FileSearchTool
109109
/// </summary>
110110
[JsonPropertyName("ranking_options")]
111111
public RankingOptions? RankingOptions { get; set; }
112+
113+
/// <summary>
114+
/// Use comparison filters to compare a specific key in a file's attributes with a given value,
115+
/// and compound filters to combine multiple filters using and and or.
116+
/// <see href="https://platform.openai.com/docs/guides/retrieval#attribute-filtering">Attribute filtering</see>
117+
/// </summary>
118+
[JsonPropertyName("filters")]
119+
public FileSearchFilter? Filters { get; set; }
112120
}
113121

114122
public class RankingOptions
@@ -124,4 +132,59 @@ public class RankingOptions
124132
/// </summary>
125133
[JsonPropertyName("score_threshold")]
126134
public float ScoreThreshold { get; set; }
135+
}
136+
137+
public class FileSearchFilter
138+
{
139+
[JsonPropertyName("type")]
140+
public string Type { get; set; }
141+
142+
[JsonPropertyName("key")]
143+
public string? Key { get; set; }
144+
145+
[JsonPropertyName("value")]
146+
public object? Value { get; set; }
147+
148+
[JsonPropertyName("filters")]
149+
public List<FileSearchFilter>? Filters { get; set; }
150+
151+
public FileSearchFilter(string type)
152+
{
153+
Type = type;
154+
}
155+
156+
public static FileSearchFilter DefineComparisonFilter(string property, string condition, object value)
157+
{
158+
return new FileSearchFilter(condition)
159+
{
160+
Key = property,
161+
Value = value
162+
};
163+
}
164+
165+
public static FileSearchFilter DefineCompoundFilter(List<FileSearchFilter> filters, string condition)
166+
{
167+
return new FileSearchFilter(condition)
168+
{
169+
Filters = filters
170+
};
171+
}
172+
}
173+
174+
public static class ComparisonFilter
175+
{
176+
//Types
177+
public static string Equal = "eq";
178+
public static string NotEqual = "ne";
179+
public static string Greater = "gt";
180+
public static string GreaterOrEqual = "gte";
181+
public static string Less = "lt";
182+
public static string LessOrEqual = "lte";
183+
}
184+
185+
public static class CompoundFilter
186+
{
187+
//Types
188+
public static string And = "and";
189+
public static string Or = "or";
127190
}

0 commit comments

Comments
 (0)