| 24 | |
| 25 | |
| 26 | class RetrievalConfig(BaseModel): |
| 27 | top_k: int = Field( |
| 28 | 3, |
| 29 | ge=1, |
| 30 | le=20, |
| 31 | description="Specifies the maximum number of relevant text chunks to retrieve during the " |
| 32 | "retrieval-augmented generation process.", |
| 33 | examples=[3], |
| 34 | ) |
| 35 | max_tokens: Optional[int] = Field( |
| 36 | None, |
| 37 | ge=1, |
| 38 | description="Specifies the maximum token number of relevant text chunks to retrieve.", |
| 39 | examples=[1000], |
| 40 | ) |
| 41 | |
| 42 | score_threshold: Optional[float] = Field( |
| 43 | None, |
| 44 | ge=0.0, |
| 45 | le=1.0, |
| 46 | description="Specifies the minimum score threshold for relevant text chunks to retrieve.", |
| 47 | examples=[0.5], |
| 48 | ) |
| 49 | |
| 50 | method: RetrievalMethod = Field( |
| 51 | ..., |
| 52 | description="The retrieval method.", |
| 53 | examples=["function_call"], |
| 54 | ) |
| 55 | |
| 56 | function_description: Optional[str] = Field( |
| 57 | None, |
| 58 | description="Describes the purpose and appropriate context for triggering the retrieval function, " |
| 59 | "guiding the assistant on when it is most useful to invoke it.", |
| 60 | examples=[ |
| 61 | "Trigger this function to search TaskingAI's documentation " |
| 62 | "for specific information about the product's features and applications." |
| 63 | ], |
| 64 | ) |
| 65 | |
| 66 | |
| 67 | DEFAULT_RETRIEVAL_CONFIG = RetrievalConfig( |
no outgoing calls
no test coverage detected