diff --git a/docs/getting_started.ipynb b/docs/getting_started.ipynb
index 21436327e..4ac8ad3a5 100644
--- a/docs/getting_started.ipynb
+++ b/docs/getting_started.ipynb
@@ -141,7 +141,7 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 18,
"id": "E1UFuJC570Tk",
"metadata": {
"colab": {
@@ -326,54 +326,108 @@
" type: sqlite\n",
"models:\n",
"- metadata: {}\n",
+ " model_id: meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo\n",
+ "- metadata: {}\n",
" model_id: meta-llama/Llama-3.1-8B-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo\n",
"- metadata: {}\n",
+ " model_id: meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo\n",
+ "- metadata: {}\n",
" model_id: meta-llama/Llama-3.1-70B-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo\n",
"- metadata: {}\n",
+ " model_id: meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo\n",
+ "- metadata: {}\n",
" model_id: meta-llama/Llama-3.1-405B-Instruct-FP8\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo\n",
"- metadata: {}\n",
+ " model_id: meta-llama/Llama-3.2-3B-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Llama-3.2-3B-Instruct-Turbo\n",
+ "- metadata: {}\n",
" model_id: meta-llama/Llama-3.2-3B-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Llama-3.2-3B-Instruct-Turbo\n",
"- metadata: {}\n",
+ " model_id: meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo\n",
+ "- metadata: {}\n",
" model_id: meta-llama/Llama-3.2-11B-Vision-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo\n",
"- metadata: {}\n",
+ " model_id: meta-llama/Llama-3.2-90B-Vision-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Llama-3.2-90B-Vision-Instruct-Turbo\n",
+ "- metadata: {}\n",
" model_id: meta-llama/Llama-3.2-90B-Vision-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Llama-3.2-90B-Vision-Instruct-Turbo\n",
"- metadata: {}\n",
+ " model_id: meta-llama/Llama-3.3-70B-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Llama-3.3-70B-Instruct-Turbo\n",
+ "- metadata: {}\n",
" model_id: meta-llama/Llama-3.3-70B-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Llama-3.3-70B-Instruct-Turbo\n",
"- metadata: {}\n",
+ " model_id: meta-llama/Meta-Llama-Guard-3-8B\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Meta-Llama-Guard-3-8B\n",
+ "- metadata: {}\n",
" model_id: meta-llama/Llama-Guard-3-8B\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Meta-Llama-Guard-3-8B\n",
"- metadata: {}\n",
+ " model_id: meta-llama/Llama-Guard-3-11B-Vision-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Llama-Guard-3-11B-Vision-Turbo\n",
+ "- metadata: {}\n",
" model_id: meta-llama/Llama-Guard-3-11B-Vision\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
@@ -473,6 +527,9 @@
" - config: {}\n",
" provider_id: model-context-protocol\n",
" provider_type: remote::model-context-protocol\n",
+ " - config: {}\n",
+ " provider_id: wolfram-alpha\n",
+ " provider_type: remote::wolfram-alpha\n",
" vector_io:\n",
" - config:\n",
" kvstore:\n",
@@ -504,6 +561,10 @@
" mcp_endpoint: null\n",
" provider_id: code-interpreter\n",
" toolgroup_id: builtin::code_interpreter\n",
+ "- args: null\n",
+ " mcp_endpoint: null\n",
+ " provider_id: wolfram-alpha\n",
+ " toolgroup_id: builtin::wolfram_alpha\n",
"vector_dbs: []\n",
"version: '2'\n",
"\n",
@@ -530,54 +591,108 @@
" type: sqlite\n",
"models:\n",
"- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
+ " model_id: meta-llama/Meta-Llama-\u001b[1;36m3.1\u001b[0m-8B-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Meta-Llama-\u001b[1;36m3.1\u001b[0m-8B-Instruct-Turbo\n",
+ "- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
" model_id: meta-llama/Llama-\u001b[1;36m3.1\u001b[0m-8B-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Meta-Llama-\u001b[1;36m3.1\u001b[0m-8B-Instruct-Turbo\n",
"- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
+ " model_id: meta-llama/Meta-Llama-\u001b[1;36m3.1\u001b[0m-70B-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Meta-Llama-\u001b[1;36m3.1\u001b[0m-70B-Instruct-Turbo\n",
+ "- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
" model_id: meta-llama/Llama-\u001b[1;36m3.1\u001b[0m-70B-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Meta-Llama-\u001b[1;36m3.1\u001b[0m-70B-Instruct-Turbo\n",
"- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
+ " model_id: meta-llama/Meta-Llama-\u001b[1;36m3.1\u001b[0m-405B-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Meta-Llama-\u001b[1;36m3.1\u001b[0m-405B-Instruct-Turbo\n",
+ "- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
" model_id: meta-llama/Llama-\u001b[1;36m3.1\u001b[0m-405B-Instruct-FP8\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Meta-Llama-\u001b[1;36m3.1\u001b[0m-405B-Instruct-Turbo\n",
"- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
+ " model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-3B-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-3B-Instruct-Turbo\n",
+ "- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
" model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-3B-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-3B-Instruct-Turbo\n",
"- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
+ " model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-11B-Vision-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-11B-Vision-Instruct-Turbo\n",
+ "- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
" model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-11B-Vision-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-11B-Vision-Instruct-Turbo\n",
"- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
+ " model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-90B-Vision-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-90B-Vision-Instruct-Turbo\n",
+ "- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
" model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-90B-Vision-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Llama-\u001b[1;36m3.2\u001b[0m-90B-Vision-Instruct-Turbo\n",
"- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
+ " model_id: meta-llama/Llama-\u001b[1;36m3.3\u001b[0m-70B-Instruct-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Llama-\u001b[1;36m3.3\u001b[0m-70B-Instruct-Turbo\n",
+ "- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
" model_id: meta-llama/Llama-\u001b[1;36m3.3\u001b[0m-70B-Instruct\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Llama-\u001b[1;36m3.3\u001b[0m-70B-Instruct-Turbo\n",
"- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
+ " model_id: meta-llama/Meta-Llama-Guard-\u001b[1;36m3\u001b[0m-8B\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Meta-Llama-Guard-\u001b[1;36m3\u001b[0m-8B\n",
+ "- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
" model_id: meta-llama/Llama-Guard-\u001b[1;36m3\u001b[0m-8B\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
" provider_id: together\n",
" provider_model_id: meta-llama/Meta-Llama-Guard-\u001b[1;36m3\u001b[0m-8B\n",
"- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
+ " model_id: meta-llama/Llama-Guard-\u001b[1;36m3\u001b[0m-11B-Vision-Turbo\n",
+ " model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
+ " - llm\n",
+ " provider_id: together\n",
+ " provider_model_id: meta-llama/Llama-Guard-\u001b[1;36m3\u001b[0m-11B-Vision-Turbo\n",
+ "- metadata: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
" model_id: meta-llama/Llama-Guard-\u001b[1;36m3\u001b[0m-11B-Vision\n",
" model_type: !!python/object/apply:llama_stack.apis.models.models.ModelType\n",
" - llm\n",
@@ -677,6 +792,9 @@
" - config: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
" provider_id: model-context-protocol\n",
" provider_type: remote::model-context-protocol\n",
+ " - config: \u001b[1m{\u001b[0m\u001b[1m}\u001b[0m\n",
+ " provider_id: wolfram-alpha\n",
+ " provider_type: remote::wolfram-alpha\n",
" vector_io:\n",
" - config:\n",
" kvstore:\n",
@@ -708,6 +826,10 @@
" mcp_endpoint: null\n",
" provider_id: code-interpreter\n",
" toolgroup_id: builtin::code_interpreter\n",
+ "- args: null\n",
+ " mcp_endpoint: null\n",
+ " provider_id: wolfram-alpha\n",
+ " toolgroup_id: builtin::wolfram_alpha\n",
"vector_dbs: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m\n",
"version: \u001b[32m'2'\u001b[0m\n",
"\n"
@@ -4098,7 +4220,7 @@
"source": [
"## 4. Image Understanding with Llama 3.2\n",
"\n",
- "Below is a complete example of using Together's Llama Stack 0.1 server at https://llama-stack.together.ai to ask Llama 3.2 questions about an image."
+ "Below is a complete example of to ask Llama 3.2 questions about an image."
]
},
{
@@ -4106,14 +4228,12 @@
"id": "82e381ec",
"metadata": {},
"source": [
- "### 4.1 Setup and helpers\n",
- "\n",
- "Below we install the Llama Stack client 0.1, download the example image, define two image helpers, and set Llama Stack Together server URL and Llama 3.2 model name.\n"
+ "### 4.1 Setup and helpers\n"
]
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 1,
"id": "44e05e16",
"metadata": {},
"outputs": [
@@ -4123,7 +4243,7 @@
"text": [
" % Total % Received % Xferd Average Speed Time Time Time Current\n",
" Dload Upload Total Spent Left Speed\n",
- "100 275k 100 275k 0 0 780k 0 --:--:-- --:--:-- --:--:-- 780k\n"
+ "100 275k 100 275k 0 0 905k 0 --:--:-- --:--:-- --:--:-- 906k\n"
]
}
],
@@ -4133,32 +4253,13 @@
},
{
"cell_type": "code",
- "execution_count": null,
- "id": "469750f7",
- "metadata": {},
- "outputs": [],
- "source": [
- "# NBVAL_SKIP\n",
- "from PIL import Image\n",
- "import matplotlib.pyplot as plt\n",
- "\n",
- "def display_image(path):\n",
- " img = Image.open(path)\n",
- " plt.imshow(img)\n",
- " plt.axis('off')\n",
- " plt.show()\n",
- "\n",
- "display_image(\"Llama_Repo.jpeg\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
+ "execution_count": 20,
"id": "a2c1e1c2",
"metadata": {},
"outputs": [],
"source": [
"import base64\n",
+ "vision_model_id = \"meta-llama/Llama-3.2-11B-Vision-Instruct\"\n",
"\n",
"def encode_image(image_path):\n",
" with open(image_path, \"rb\") as image_file:\n",
@@ -4167,19 +4268,6 @@
" return base64_url"
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "c565f99e",
- "metadata": {},
- "outputs": [],
- "source": [
- "from llama_stack_client import LlamaStackClient\n",
- "\n",
- "LLAMA_STACK_API_TOGETHER_URL=\"https://llama-stack.together.ai\"\n",
- "LLAMA32_11B_INSTRUCT = \"meta-llama/Llama-3.2-11B-Vision-Instruct\""
- ]
- },
{
"cell_type": "markdown",
"id": "7737cd41",
@@ -4192,55 +4280,44 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 21,
"id": "d7914894",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "There are three llamas in the image. The llama in the middle is purple, the llama on the left is white, and the llama on the right is also white, but it is wearing a blue party hat. Therefore, there are two different colors of llama in the image: purple and white.\n"
+ ]
+ }
+ ],
"source": [
- "from llama_stack_client.lib.inference.event_logger import EventLogger\n",
- "\n",
- "async def run_main(image_path: str, prompt):\n",
- " client = LlamaStackClient(\n",
- " base_url=LLAMA_STACK_API_TOGETHER_URL,\n",
- " )\n",
- "\n",
- " message = {\n",
- " \"role\": \"user\",\n",
- " \"content\": [\n",
- " {\n",
- " \"type\": \"image\",\n",
- " \"image\": {\n",
- " \"url\": {\n",
- " \"uri\": encode_image(image_path)\n",
- " }\n",
+ "response = client.inference.chat_completion(\n",
+ " messages=[\n",
+ " {\n",
+ " \"role\": \"user\",\n",
+ " \"content\": [\n",
+ " {\n",
+ " \"type\": \"image\",\n",
+ " \"image\": {\n",
+ " \"url\": {\n",
+ " \"uri\": encode_image(\"Llama_Repo.jpeg\")\n",
+ " }\n",
+ " }\n",
+ " },\n",
+ " {\n",
+ " \"type\": \"text\",\n",
+ " \"text\": \"How many different colors are those llamas? What are those colors?\",\n",
" }\n",
- " },\n",
- " {\n",
- " \"type\": \"text\",\n",
- " \"text\": prompt,\n",
- " }\n",
- " ]\n",
- " }\n",
+ " ]\n",
+ " }\n",
+ " ],\n",
+ " model_id=vision_model_id,\n",
+ " stream=False,\n",
+ ")\n",
"\n",
- " response = client.inference.chat_completion(\n",
- " messages=[message],\n",
- " model_id=LLAMA32_11B_INSTRUCT,\n",
- " stream=False,\n",
- " )\n",
- "\n",
- " print(response.completion_message.content.lower().strip())"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "4ee09b97",
- "metadata": {},
- "outputs": [],
- "source": [
- "await run_main(\"Llama_Repo.jpeg\",\n",
- " \"How many different colors are those llamas?\\\n",
- " What are those colors?\")"
+ "print(response.completion_message.content)"
]
},
{
@@ -4255,68 +4332,65 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 19,
"id": "f9a83275",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\u001b[33minference> \u001b[0m\u001b[33mThere\u001b[0m\u001b[33m are\u001b[0m\u001b[33m three\u001b[0m\u001b[33m different\u001b[0m\u001b[33m colors\u001b[0m\u001b[33m of\u001b[0m\u001b[33m ll\u001b[0m\u001b[33mamas\u001b[0m\u001b[33m in\u001b[0m\u001b[33m the\u001b[0m\u001b[33m image\u001b[0m\u001b[33m.\u001b[0m\u001b[33m The\u001b[0m\u001b[33m first\u001b[0m\u001b[33m llama\u001b[0m\u001b[33m on\u001b[0m\u001b[33m the\u001b[0m\u001b[33m left\u001b[0m\u001b[33m is\u001b[0m\u001b[33m white\u001b[0m\u001b[33m,\u001b[0m\u001b[33m the\u001b[0m\u001b[33m second\u001b[0m\u001b[33m llama\u001b[0m\u001b[33m in\u001b[0m\u001b[33m the\u001b[0m\u001b[33m middle\u001b[0m\u001b[33m is\u001b[0m\u001b[33m purple\u001b[0m\u001b[33m,\u001b[0m\u001b[33m and\u001b[0m\u001b[33m the\u001b[0m\u001b[33m third\u001b[0m\u001b[33m llama\u001b[0m\u001b[33m on\u001b[0m\u001b[33m the\u001b[0m\u001b[33m right\u001b[0m\u001b[33m is\u001b[0m\u001b[33m white\u001b[0m\u001b[33m with\u001b[0m\u001b[33m a\u001b[0m\u001b[33m blue\u001b[0m\u001b[33m party\u001b[0m\u001b[33m hat\u001b[0m\u001b[33m.\u001b[0m\u001b[97m\u001b[0m\n",
+ "\u001b[30m\u001b[0m"
+ ]
+ }
+ ],
"source": [
- "from llama_stack_client.lib.agents.agent import Agent\n",
- "from llama_stack_client.lib.agents.event_logger import EventLogger\n",
"from llama_stack_client.types.agent_create_params import AgentConfig\n",
"\n",
- "async def run_main(image_path, prompt):\n",
- " base64_image = encode_image(image_path)\n",
+ "agent_config = AgentConfig(\n",
+ " model=vision_model_id,\n",
+ " instructions=\"You are a helpful assistant\",\n",
+ " enable_session_persistence=False,\n",
+ " toolgroups=[],\n",
+ ")\n",
"\n",
- " client = LlamaStackClient(\n",
- " base_url=LLAMA_STACK_API_TOGETHER_URL,\n",
- " )\n",
+ "agent = Agent(client, agent_config)\n",
+ "session_id = agent.create_session(\"test-session\")\n",
"\n",
- " agent_config = AgentConfig(\n",
- " model=LLAMA32_11B_INSTRUCT,\n",
- " instructions=\"You are a helpful assistant\",\n",
- " enable_session_persistence=False,\n",
- " toolgroups=[],\n",
- " )\n",
- "\n",
- " agent = Agent(client, agent_config)\n",
- " session_id = agent.create_session(\"test-session\")\n",
- "\n",
- " response = agent.create_turn(\n",
- " messages=[{\n",
- " \"role\": \"user\",\n",
- " \"content\": [\n",
- " {\n",
- " \"type\": \"image\",\n",
- " \"image\": {\n",
- " \"url\": {\n",
- " \"uri\": encode_image(image_path)\n",
- " }\n",
- " }\n",
- " },\n",
- " {\n",
- " \"type\": \"text\",\n",
- " \"text\": prompt,\n",
+ "response = agent.create_turn(\n",
+ " messages=[{\n",
+ " \"role\": \"user\",\n",
+ " \"content\": [\n",
+ " {\n",
+ " \"type\": \"image\",\n",
+ " \"image\": {\n",
+ " \"url\": {\n",
+ " \"uri\": encode_image(\"Llama_Repo.jpeg\")\n",
+ " }\n",
" }\n",
- " ]\n",
- " }],\n",
- " session_id=session_id,\n",
- " )\n",
+ " },\n",
+ " {\n",
+ " \"type\": \"text\",\n",
+ " \"text\": \"How many different colors are those llamas? What are those colors?\",\n",
+ " }\n",
+ " ]\n",
+ " }],\n",
+ " session_id=session_id,\n",
+ ")\n",
"\n",
- " for log in EventLogger().log(response):\n",
- " log.print()"
+ "for log in EventLogger().log(response):\n",
+ " log.print()\n",
+ " "
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "15d0098b",
+ "id": "f3352379",
"metadata": {},
"outputs": [],
- "source": [
- "await run_main(\"Llama_Repo.jpeg\",\n",
- " \"How many different colors are those llamas?\\\n",
- " What are those colors?\")"
- ]
+ "source": []
}
],
"metadata": {