mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 00:31:02 +00:00
Add chat completions test
This commit is contained in:
@ -349,20 +349,6 @@ async fn render_document_kefir() {
|
|||||||
}
|
}
|
||||||
"#);
|
"#);
|
||||||
|
|
||||||
let (value, code) = index
|
|
||||||
.render(json! {{
|
|
||||||
"template": { "id": "chatCompletions.documentTemplate" },
|
|
||||||
"input": { "documentId": "0" },
|
|
||||||
}})
|
|
||||||
.await;
|
|
||||||
snapshot!(code, @"200 OK");
|
|
||||||
snapshot!(value, @r#"
|
|
||||||
{
|
|
||||||
"template": "{% for field in fields %}{% if field.is_searchable and field.value != nil %}{{ field.name }}: {{ field.value }}\n{% endif %}{% endfor %}",
|
|
||||||
"rendered": "id: 0\nname: kefir\n"
|
|
||||||
}
|
|
||||||
"#);
|
|
||||||
|
|
||||||
let (value, code) = index
|
let (value, code) = index
|
||||||
.render(json! {{
|
.render(json! {{
|
||||||
"template": { "id": "embedders.rest.indexingFragments.withBreed" },
|
"template": { "id": "embedders.rest.indexingFragments.withBreed" },
|
||||||
@ -426,3 +412,36 @@ async fn render_inline_document_iko() {
|
|||||||
}
|
}
|
||||||
"#);
|
"#);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn chat_completions() {
|
||||||
|
let index = shared_index_for_fragments().await;
|
||||||
|
|
||||||
|
let (value, code) = index
|
||||||
|
.render(json! {{
|
||||||
|
"template": { "id": "chatCompletions.documentTemplate" },
|
||||||
|
"input": { "documentId": "0" },
|
||||||
|
}})
|
||||||
|
.await;
|
||||||
|
snapshot!(code, @"200 OK");
|
||||||
|
snapshot!(value, @r#"
|
||||||
|
{
|
||||||
|
"template": "{% for field in fields %}{% if field.is_searchable and field.value != nil %}{{ field.name }}: {{ field.value }}\n{% endif %}{% endfor %}",
|
||||||
|
"rendered": "id: 0\nname: kefir\n"
|
||||||
|
}
|
||||||
|
"#);
|
||||||
|
|
||||||
|
let (value, code) = index
|
||||||
|
.render(json! {{
|
||||||
|
"template": { "id": "chatCompletions.documentTemplate" },
|
||||||
|
"input": { "inline": { "doc": { "name": "iko", "breed": "jack russell" } } },
|
||||||
|
}})
|
||||||
|
.await;
|
||||||
|
snapshot!(code, @"200 OK");
|
||||||
|
snapshot!(value, @r#"
|
||||||
|
{
|
||||||
|
"template": "{% for field in fields %}{% if field.is_searchable and field.value != nil %}{{ field.name }}: {{ field.value }}\n{% endif %}{% endfor %}",
|
||||||
|
"rendered": "name: iko\nbreed: jack russell\n"
|
||||||
|
}
|
||||||
|
"#);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user