semantic-router
semantic-router copied to clipboard
Dynamic Routes with Ollama and Llama3
The logger sends an error since the json output is different from what the docs say (as shown in the screenshot), despite it been correct , and while i did solve that by commenting out this block at the end of semantic_layer/llms/base.py
(which is not ideal but i just wanted to test),
this is the Ollama llm parameter i used
llm_llama3 = OllamaLLM(name="ollama",temperature=0.1,llm_name="llama3_full")
for context i did hardcode the function_schema parameter for testing purposes this is the json object i used for it
dynamic_route_test_schema:list[dict[str, any]] = [
{
"type": "function",
"function": {
"name": "get_card",
"description": "Finds the color of the card.\n\n :param color: the color of the card which is either 'blue' or 'silver' or 'gold' or 'platinum'.\n param function_name : the name of the function\n :type color: str \n :type function_name: str \n:return: The color of the card and the function name.",
"parameters": {
"type": "object",
"properties": {
"color": {
"type": "string",
"description": "the color of the card which is either 'blue' or 'silver' or 'gold' or 'platinum'."
},
},
"required": ["color"]
}
}
}
]
This is the part i removed
if not self._is_valid_inputs(function_inputs, function_schemas):
print(function_inputs)
raise ValueError("Invalid inputs")