openai/models/create_search_request.rs
1/*
2 * OpenAI API
3 *
4 * APIs for sampling from and fine-tuning language models
5 *
6 * The version of the OpenAPI document: 1.2.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
15pub struct CreateSearchRequest {
16 /// Query to search against the documents.
17 #[serde(rename = "query")]
18 pub query: String,
19 /// Up to 200 documents to search over, provided as a list of strings. The maximum document length (in tokens) is 2034 minus the number of tokens in the query. You should specify either `documents` or a `file`, but not both.
20 #[serde(rename = "documents", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
21 pub documents: Option<Option<Vec<String>>>,
22 /// The ID of an uploaded file that contains documents to search over. You should specify either `documents` or a `file`, but not both.
23 #[serde(rename = "file", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24 pub file: Option<Option<String>>,
25 /// The maximum number of documents to be re-ranked and returned by search. This flag only takes effect when `file` is set.
26 #[serde(rename = "max_rerank", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27 pub max_rerank: Option<Option<i32>>,
28 /// A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a \"metadata\" field. This flag only takes effect when `file` is set.
29 #[serde(rename = "return_metadata", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30 pub return_metadata: Option<Option<bool>>,
31 /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).
32 #[serde(rename = "user", skip_serializing_if = "Option::is_none")]
33 pub user: Option<String>,
34}
35
36impl CreateSearchRequest {
37 pub fn new(query: String) -> CreateSearchRequest {
38 CreateSearchRequest {
39 query,
40 documents: None,
41 file: None,
42 max_rerank: None,
43 return_metadata: None,
44 user: None,
45 }
46 }
47}
48
49