mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 15:23:51 +00:00
function_tag system prompt is also added as a user message
This commit is contained in:
parent
8e526b9536
commit
00053b5bb0
2 changed files with 15 additions and 23 deletions
|
@ -104,34 +104,25 @@ async def run_main(host: str, port: int):
|
||||||
AgenticSystemToolDefinition(
|
AgenticSystemToolDefinition(
|
||||||
tool_name=BuiltinTool.wolfram_alpha,
|
tool_name=BuiltinTool.wolfram_alpha,
|
||||||
),
|
),
|
||||||
AgenticSystemToolDefinition(
|
|
||||||
tool_name=BuiltinTool.photogen,
|
|
||||||
),
|
|
||||||
AgenticSystemToolDefinition(
|
AgenticSystemToolDefinition(
|
||||||
tool_name=BuiltinTool.code_interpreter,
|
tool_name=BuiltinTool.code_interpreter,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
tool_definitions += [
|
tool_definitions += [
|
||||||
AgenticSystemToolDefinition(
|
AgenticSystemToolDefinition(
|
||||||
tool_name="custom_tool",
|
tool_name="get_boiling_point",
|
||||||
description="a custom tool",
|
description="Get the boiling point of a imaginary liquids (eg. polyjuice)",
|
||||||
parameters={
|
parameters={
|
||||||
"param1": ToolParamDefinition(
|
"liquid_name": ToolParamDefinition(
|
||||||
param_type="str",
|
param_type="str",
|
||||||
description="a string parameter",
|
description="The name of the liquid",
|
||||||
required=True,
|
required=True,
|
||||||
)
|
),
|
||||||
},
|
"celcius": ToolParamDefinition(
|
||||||
),
|
|
||||||
AgenticSystemToolDefinition(
|
|
||||||
tool_name="custom_tool_2",
|
|
||||||
description="a second custom tool",
|
|
||||||
parameters={
|
|
||||||
"param2": ToolParamDefinition(
|
|
||||||
param_type="str",
|
param_type="str",
|
||||||
description="a string parameter",
|
description="Whether to return the boiling point in Celcius",
|
||||||
required=True,
|
required=False,
|
||||||
)
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -163,7 +154,10 @@ async def run_main(host: str, port: int):
|
||||||
|
|
||||||
user_prompts = [
|
user_prompts = [
|
||||||
"Who are you?",
|
"Who are you?",
|
||||||
|
"what is the 100th prime number?",
|
||||||
|
"Search web for who was 44th President of USA?",
|
||||||
"Write code to check if a number is prime. Use that to check if 7 is prime",
|
"Write code to check if a number is prime. Use that to check if 7 is prime",
|
||||||
|
"What is the boiling point of polyjuicepotion ?",
|
||||||
]
|
]
|
||||||
for content in user_prompts:
|
for content in user_prompts:
|
||||||
cprint(f"User> {content}", color="blue")
|
cprint(f"User> {content}", color="blue")
|
||||||
|
|
|
@ -48,15 +48,13 @@ def get_agentic_prefix_messages(
|
||||||
Cutting Knowledge Date: December 2023
|
Cutting Knowledge Date: December 2023
|
||||||
Today Date: {formatted_date}\n"""
|
Today Date: {formatted_date}\n"""
|
||||||
content += date_str
|
content += date_str
|
||||||
|
messages.append(SystemMessage(content=content))
|
||||||
|
|
||||||
if custom_tools:
|
if custom_tools:
|
||||||
if tool_prompt_format == ToolPromptFormat.function_tag:
|
if tool_prompt_format == ToolPromptFormat.function_tag:
|
||||||
custom_message = prompt_for_function_tag(custom_tools)
|
text = prompt_for_function_tag(custom_tools)
|
||||||
content += custom_message
|
messages.append(UserMessage(content=text))
|
||||||
messages.append(SystemMessage(content=content))
|
|
||||||
elif tool_prompt_format == ToolPromptFormat.json:
|
elif tool_prompt_format == ToolPromptFormat.json:
|
||||||
messages.append(SystemMessage(content=content))
|
|
||||||
# json is added as a user prompt
|
|
||||||
text = prompt_for_json(custom_tools)
|
text = prompt_for_json(custom_tools)
|
||||||
messages.append(UserMessage(content=text))
|
messages.append(UserMessage(content=text))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue