Skip to content

Commit

Permalink
validate prompt has at least one character (#1954)
Browse files Browse the repository at this point in the history
* validate prompt has at least one character

* min lenght
  • Loading branch information
lferran authored Mar 18, 2024
1 parent 5a49335 commit 4f0c85b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions nucliadb_models/nucliadb_models/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,6 @@ class SearchParamDefaults:
title="Chat features",
description="Features enabled for the chat endpoint. Semantic search is done if `vectors` is included. If `paragraphs` is included, the results will include matching paragraphs from the bm25 index. If `relations` is included, a graph of entities related to the answer is returned.", # noqa
)
prompt = ParamDefault(
default=None,
title="Prompt",
description="Input here your prompt with the words {context} and {question} in brackets where you want those fields to be placed, in case you want them in your prompt. Context will be the data returned by the retrieval step.", # noqa
)
suggest_features = ParamDefault(
default=[
SuggestOptions.PARAGRAPH,
Expand Down Expand Up @@ -889,7 +884,12 @@ class ChatRequest(BaseModel):
resource_filters: List[
str
] = SearchParamDefaults.resource_filters.to_pydantic_field()
prompt: Optional[str] = SearchParamDefaults.prompt.to_pydantic_field()
prompt: Optional[str] = Field(
default=None,
title="Prompt",
description="Input here your prompt with the words {context} and {question} in brackets where you want those fields to be placed, in case you want them in your prompt. Context will be the data returned by the retrieval step.", # noqa
min_length=1,
)
citations: bool = Field(
default=False,
description="Whether to include the citations for the answer in the response",
Expand Down

1 comment on commit 4f0c85b

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 4f0c85b Previous: d4afd82 Ratio
nucliadb/search/tests/unit/search/test_fetch.py::test_highligh_error 13140.83427821209 iter/sec (stddev: 5.851544434100844e-7) 13028.533525895236 iter/sec (stddev: 4.192637045977425e-7) 0.99

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.