diff --git a/sdk/python/foundation-models/cohere/cohere-embed.ipynb b/sdk/python/foundation-models/cohere/cohere-embed.ipynb index 15f68d00a5..453486c660 100644 --- a/sdk/python/foundation-models/cohere/cohere-embed.ipynb +++ b/sdk/python/foundation-models/cohere/cohere-embed.ipynb @@ -105,6 +105,35 @@ ")" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "For image inputs you can try:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import base64\n", + "\n", + "# Open the image file in binary mode\n", + "with open(\"\", \"rb\") as image_file:\n", + " # Read the image data\n", + " image_data = image_file.read()\n", + "\n", + " # Encode the image data to base64\n", + " base64_encoded_data = base64.b64encode(image_data)\n", + "\n", + " # Convert the base64 bytes to a string\n", + " base64_string = base64_encoded_data.decode(\"utf-8\")\n", + "\n", + "co.embed(images=[base64_string], input_type=\"image\")" + ] + }, { "cell_type": "markdown", "metadata": {},