mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
[Bug Fix] [Bug]: Knowledge Base Call returning error (#12628)
* bug fix using vector stores as tools * test_e2e_bedrock_knowledgebase_retrieval_with_llm_api_call_with_tools
This commit is contained in:
parent
782969bb05
commit
d8327b4740
2 changed files with 30 additions and 3 deletions
|
|
@ -600,7 +600,9 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
custom_logger = (
|
||||
prompt_management_logger
|
||||
or self.get_custom_logger_for_prompt_management(
|
||||
model=model, non_default_params=non_default_params
|
||||
model=model,
|
||||
tools=tools,
|
||||
non_default_params=non_default_params
|
||||
)
|
||||
)
|
||||
|
||||
|
|
@ -625,7 +627,7 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
return model, messages, non_default_params
|
||||
|
||||
def get_custom_logger_for_prompt_management(
|
||||
self, model: str, non_default_params: Dict
|
||||
self, model: str, non_default_params: Dict, tools: Optional[List[Dict]] = None
|
||||
) -> Optional[CustomLogger]:
|
||||
"""
|
||||
Get a custom logger for prompt management based on model name or available callbacks.
|
||||
|
|
@ -673,7 +675,8 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
#########################################################
|
||||
if litellm.vector_store_registry is not None:
|
||||
if vector_store_to_run := litellm.vector_store_registry.get_vector_store_to_run(
|
||||
non_default_params=non_default_params
|
||||
non_default_params=non_default_params,
|
||||
tools=tools
|
||||
):
|
||||
vector_store_custom_logger = (
|
||||
litellm.ProviderConfigManager.get_provider_vector_store_config(
|
||||
|
|
|
|||
|
|
@ -132,6 +132,30 @@ async def test_e2e_bedrock_knowledgebase_retrieval_with_llm_api_call(setup_vecto
|
|||
assert response is not None
|
||||
|
||||
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_e2e_bedrock_knowledgebase_retrieval_with_llm_api_call_with_tools(setup_vector_store_registry):
|
||||
"""
|
||||
Test that the Bedrock Knowledge Base Hook works when making a real llm api call
|
||||
"""
|
||||
|
||||
# Init client
|
||||
litellm._turn_on_debug()
|
||||
litellm.callbacks = [BedrockVectorStore(aws_region_name="us-west-2")]
|
||||
response = await litellm.acompletion(
|
||||
model="anthropic/claude-3-5-haiku-latest",
|
||||
messages=[{"role": "user", "content": "what is litellm?"}],
|
||||
max_tokens=10,
|
||||
tools=[
|
||||
{
|
||||
"type": "file_search",
|
||||
"vector_store_ids": ["T37J8R4WTM"]
|
||||
}
|
||||
],
|
||||
)
|
||||
assert response is not None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_openai_with_knowledge_base_mock_openai(setup_vector_store_registry):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue