mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
The repo linted at 120 (E501, isort) but ran ruff format at 88 via a --line-length 88 override in the Makefile and CI, leaving the formatter and the linter disagreeing on wrap width. Drop the override so ruff.toml's line-length = 120 is the single source of truth and reformat the tree to match.
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""
|
|
Build the litellm_content_retrieve tool definition for the LLM.
|
|
"""
|
|
|
|
from typing import List
|
|
|
|
|
|
def build_retrieval_tool(available_keys: List[str]) -> dict:
|
|
"""
|
|
Return an OpenAI-format tool definition that lets the model
|
|
retrieve the full content of a compressed message.
|
|
"""
|
|
return {
|
|
"type": "function",
|
|
"function": {
|
|
"name": "litellm_content_retrieve",
|
|
"description": (
|
|
"Retrieve the full content of a file or message that was "
|
|
"compressed to save tokens. Use this when you need the complete "
|
|
"content to answer accurately. Available keys: " + ", ".join(available_keys)
|
|
),
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
"key": {
|
|
"type": "string",
|
|
"description": "The identifier of the content to retrieve",
|
|
"enum": available_keys,
|
|
}
|
|
},
|
|
"required": ["key"],
|
|
},
|
|
},
|
|
}
|