Add prefix / suffix
parent
8956056120
commit
9a488e21f5
|
|
@ -11,12 +11,24 @@ mod languages;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
|
#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
|
||||||
pub struct CompletionRequest {
|
pub struct CompletionRequest {
|
||||||
|
#[schema(example = "def fib(n):")]
|
||||||
|
prompt: String,
|
||||||
|
|
||||||
/// https://code.visualstudio.com/docs/languages/identifiers
|
/// https://code.visualstudio.com/docs/languages/identifiers
|
||||||
#[schema(example = "python")]
|
#[schema(example = "python")]
|
||||||
language: Option<String>,
|
language: Option<String>,
|
||||||
|
|
||||||
#[schema(example = "def fib(n):")]
|
/// When segments are set, the `prompt` is ignored during the inference.
|
||||||
prompt: String,
|
segments: Option<Segments>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
|
||||||
|
pub struct Segments {
|
||||||
|
/// Content that appears before the cursor in the editor window.
|
||||||
|
prefix: String,
|
||||||
|
|
||||||
|
/// Content that appears after the cursor in the editor window.
|
||||||
|
suffix: String
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
|
#[derive(Serialize, Deserialize, ToSchema, Clone, Debug)]
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ use utoipa_swagger_ui::SwaggerUi;
|
||||||
events::LogEventRequest,
|
events::LogEventRequest,
|
||||||
completions::CompletionRequest,
|
completions::CompletionRequest,
|
||||||
completions::CompletionResponse,
|
completions::CompletionResponse,
|
||||||
|
completions::Segments,
|
||||||
completions::Choice
|
completions::Choice
|
||||||
))
|
))
|
||||||
)]
|
)]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue