pr review changes

This commit is contained in:
Justin Lee 2024-11-08 14:50:44 -08:00
parent 6dd5ea7631
commit c79c8367b7
6 changed files with 152 additions and 209 deletions

View file

@ -97,40 +97,38 @@
"metadata": {},
"outputs": [],
"source": [
"from llama_stack_client.types import CompletionMessage, UserMessage\n",
"\n",
"few_shot_examples = messages=[\n",
" UserMessage(content='Have shorter, spear-shaped ears.', role='user'),\n",
" CompletionMessage(\n",
" content=\"That's Alpaca!\",\n",
" role='assistant',\n",
" stop_reason='end_of_message',\n",
" tool_calls=[],\n",
" ),\n",
" UserMessage(\n",
" content='Known for their calm nature and used as pack animals in mountainous regions.',\n",
" role='user',\n",
" ),\n",
" CompletionMessage(\n",
" content=\"That's Llama!\",\n",
" role='assistant',\n",
" stop_reason='end_of_message',\n",
" tool_calls=[],\n",
" ),\n",
" UserMessage(\n",
" content='Has a straight, slender neck and is smaller in size compared to its relative.',\n",
" role='user',\n",
" ),\n",
" CompletionMessage(\n",
" content=\"That's Alpaca!\",\n",
" role='assistant',\n",
" stop_reason='end_of_message',\n",
" tool_calls=[],\n",
" ),\n",
" UserMessage(\n",
" content='Generally taller and more robust, commonly seen as guard animals.',\n",
" role='user',\n",
" ),\n",
"few_shot_examples = [\n",
" {\"role\": \"user\", \"content\": 'Have shorter, spear-shaped ears.'},\n",
" {\n",
" \"role\": \"assistant\",\n",
" \"content\": \"That's Alpaca!\",\n",
" \"stop_reason\": 'end_of_message',\n",
" \"tool_calls\": []\n",
" },\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": 'Known for their calm nature and used as pack animals in mountainous regions.'\n",
" },\n",
" {\n",
" \"role\": \"assistant\",\n",
" \"content\": \"That's Llama!\",\n",
" \"stop_reason\": 'end_of_message',\n",
" \"tool_calls\": []\n",
" },\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": 'Has a straight, slender neck and is smaller in size compared to its relative.'\n",
" },\n",
" {\n",
" \"role\": \"assistant\",\n",
" \"content\": \"That's Alpaca!\",\n",
" \"stop_reason\": 'end_of_message',\n",
" \"tool_calls\": []\n",
" },\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": 'Generally taller and more robust, commonly seen as guard animals.'\n",
" }\n",
"]"
]
},
@ -228,38 +226,38 @@
"\n",
"response = client.inference.chat_completion(\n",
" messages=[\n",
" UserMessage(content='Have shorter, spear-shaped ears.', role='user'),\n",
" CompletionMessage(\n",
" content=\"That's Alpaca!\",\n",
" role='assistant',\n",
" stop_reason='end_of_message',\n",
" tool_calls=[],\n",
" ),\n",
" UserMessage(\n",
" content='Known for their calm nature and used as pack animals in mountainous regions.',\n",
" role='user',\n",
" ),\n",
" CompletionMessage(\n",
" content=\"That's Llama!\",\n",
" role='assistant',\n",
" stop_reason='end_of_message',\n",
" tool_calls=[],\n",
" ),\n",
" UserMessage(\n",
" content='Has a straight, slender neck and is smaller in size compared to its relative.',\n",
" role='user',\n",
" ),\n",
" CompletionMessage(\n",
" content=\"That's Alpaca!\",\n",
" role='assistant',\n",
" stop_reason='end_of_message',\n",
" tool_calls=[],\n",
" ),\n",
" UserMessage(\n",
" content='Generally taller and more robust, commonly seen as guard animals.',\n",
" role='user',\n",
" ),\n",
" ],\n",
" {\"role\": \"user\", \"content\": 'Have shorter, spear-shaped ears.'},\n",
" {\n",
" \"role\": \"assistant\",\n",
" \"content\": \"That's Alpaca!\",\n",
" \"stop_reason\": 'end_of_message',\n",
" \"tool_calls\": []\n",
" },\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": 'Known for their calm nature and used as pack animals in mountainous regions.'\n",
" },\n",
" {\n",
" \"role\": \"assistant\",\n",
" \"content\": \"That's Llama!\",\n",
" \"stop_reason\": 'end_of_message',\n",
" \"tool_calls\": []\n",
" },\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": 'Has a straight, slender neck and is smaller in size compared to its relative.'\n",
" },\n",
" {\n",
" \"role\": \"assistant\",\n",
" \"content\": \"That's Alpaca!\",\n",
" \"stop_reason\": 'end_of_message',\n",
" \"tool_calls\": []\n",
" },\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": 'Generally taller and more robust, commonly seen as guard animals.'\n",
" }\n",
"],\n",
" model='Llama3.2-11B-Vision-Instruct',\n",
")\n",
"\n",