# embeddings_queue

created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: e27a6c91-065b-4625-b861-69c35c12d6b2
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat.ipynb", "title": "Azure chat completions example", "tokens": 1590, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"e27a6c91-065b-4625-b861-69c35c12d6b2\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat.ipynb\", \"title\": \"Azure chat completions example\", \"tokens\": 1590, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"c69a2058-2a4c-4430-afbf-5653863f88ce\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat.ipynb\", \"title\": \"Azure chat completions example\", \"tokens\": 1590, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"086cf0d64bdf19aa254495b517b9c8b4694b72751a67ae2416b85edd8aba1b1d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"194883bb-1149-41e8-8d21-af8f998d37bf\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat.ipynb\", \"title\": \"Azure chat completions example\", \"tokens\": 1590, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"77a0f4e1b3e0955b2913cb563a789beeb19fd6652c4c85b23cdabb6fe31a4b95\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 4138, \"end_char_idx\": 7123, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "c69a2058-2a4c-4430-afbf-5653863f88ce", "doc_id": "c69a2058-2a4c-4430-afbf-5653863f88ce", "ref_doc_id": "c69a2058-2a4c-4430-afbf-5653863f88ce", "chroma:document": "```python\nresponse = client.chat.completions.create(\n    model=deployment,\n    messages=[\n        {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n        {\"role\": \"user\", \"content\": \"Knock knock.\"},\n        {\"role\": \"assistant\", \"content\": \"Who's there?\"},\n        {\"role\": \"user\", \"content\": \"Orange.\"},\n    ],\n    temperature=0,\n    stream=True\n)\n\nfor chunk in response:\n    if len(chunk.choices) > 0:\n        delta = chunk.choices[0].delta\n\n        if delta.role:\n            print(delta.role + \": \", end=\"\", flush=True)\n        if delta.content:\n            print(delta.content, end=\"\", flush=True)\n```\n\n### Content filtering\n\nAzure OpenAI service includes content filtering of prompts and completion responses. You can learn more about content filtering and how to configure it [here](https://learn.microsoft.com/azure/ai-services/openai/concepts/content-filter).\n\nIf the prompt is flagged by the content filter, the library will raise a `BadRequestError` exception with a `content_filter` error code. Otherwise, you can access the `prompt_filter_results` and `content_filter_results` on the response to see the results of the content filtering and what categories were flagged.\n\n#### Prompt flagged by content filter\n\n\n```python\nimport json\n\nmessages = [\n    {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n    {\"role\": \"user\", \"content\": \"<text violating the content policy>\"}\n]\n\ntry:\n    completion = client.chat.completions.create(\n        messages=messages,\n        model=deployment,\n    )\nexcept openai.BadRequestError as e:\n    err = json.loads(e.response.text)\n    if err[\"error\"][\"code\"] == \"content_filter\":\n        print(\"Content filter triggered!\")\n        content_filter_result = err[\"error\"][\"innererror\"][\"content_filter_result\"]\n        for category, details in content_filter_result.items():\n            print(f\"{category}:\\n filtered={details['filtered']}\\n severity={details['severity']}\")\n```\n\n### Checking the result of the content filter\n\n\n```python\nmessages = [\n    {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n    {\"role\": \"user\", \"content\": \"What's the biggest city in Washington?\"}\n]\n\ncompletion = client.chat.completions.create(\n    messages=messages,\n    model=deployment,\n)\nprint(f\"Answer: {completion.choices[0].message.content}\")\n\n# prompt content filter result in \"model_extra\" for azure\nprompt_filter_result = completion.model_extra[\"prompt_filter_results\"][0][\"content_filter_results\"]\nprint(\"\\nPrompt content filter results:\")\nfor category, details in prompt_filter_result.items():\n    print(f\"{category}:\\n filtered={details['filtered']}\\n severity={details['severity']}\")\n\n# completion content filter result\nprint(\"\\nCompletion content filter results:\")\ncompletion_filter_result = completion.choices[0].model_extra[\"content_filter_results\"]\nfor category, details in completion_filter_result.items():\n    print(f\"{category}:\\n filtered={details['filtered']}\\n severity={details['severity']}\")\n```"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 7b6b9f12-b381-4696-94e5-1baafb63c9af
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/embeddings.ipynb", "title": "Azure embeddings example", "tokens": 816, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"7b6b9f12-b381-4696-94e5-1baafb63c9af\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 816, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"1c25507a-561e-4c48-a18a-98473cf582ff\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 816, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"7fe0a7c5a5a05e3f4dcf45a0cb7b6ca5891e8066acbdd6132b75ddb500394eea\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"60f25c3d-ba66-4739-9b5a-37066aa0a4a8\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"fbd8f45a5a3061b55914161907a16ca286419e6595edc7dc7554805c507e8925\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3308, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "1c25507a-561e-4c48-a18a-98473cf582ff", "doc_id": "1c25507a-561e-4c48-a18a-98473cf582ff", "ref_doc_id": "1c25507a-561e-4c48-a18a-98473cf582ff", "chroma:document": "# Azure embeddings example\n\nThis example will cover embeddings using the Azure OpenAI service.\n\n## Setup\n\nFirst, we install the necessary dependencies and import the libraries we will be using.\n\n\n```python\n! pip install \"openai>=1.0.0,<2.0.0\"\n! pip install python-dotenv\n```\n\n\n```python\nimport os\nimport openai\nimport dotenv\n\ndotenv.load_dotenv()\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure Active Directory token credentials.\n\n\n```python\nuse_azure_active_directory = False  # Set this flag to True if you are using Azure Active Directory\n```\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com)). You'll also find the endpoint for your resource here.\n\n\n```python\nif not use_azure_active_directory:\n    endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n    api_key = os.environ[\"AZURE_OPENAI_API_KEY\"]\n\n    client = openai.AzureOpenAI(\n        azure_endpoint=endpoint,\n        api_key=api_key,\n        api_version=\"2023-09-01-preview\"\n    )\n```\n\n#### Authentication using Azure Active Directory\nLet's now see how we can autheticate via Azure Active Directory. We'll start by installing the `azure-identity` library. This library will provide the token credentials we need to authenticate and help us build a token credential provider through the `get_bearer_token_provider` helper function. It's recommended to use `get_bearer_token_provider` over providing a static token to `AzureOpenAI` because this API will automatically cache and refresh tokens for you. \n\nFor more information on how to set up Azure Active Directory authentication with Azure OpenAI, see the [documentation](https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity).\n\n\n```python\n! pip install \"azure-identity>=1.15.0\"\n```\n\n\n```python\nfrom azure.identity import DefaultAzureCredential, get_bearer_token_provider\n\nif use_azure_active_directory:\n    endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n    api_key = os.environ[\"AZURE_OPENAI_API_KEY\"]\n\n    client = openai.AzureOpenAI(\n        azure_endpoint=endpoint,\n        azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), \"https://cognitiveservices.azure.com/.default\"),\n        api_version=\"2023-09-01-preview\"\n    )\n```\n\n> Note: the AzureOpenAI infers the following arguments from their corresponding environment variables if they are not provided:\n\n- `api_key` from `AZURE_OPENAI_API_KEY`\n- `azure_ad_token` from `AZURE_OPENAI_AD_TOKEN`\n- `api_version` from `OPENAI_API_VERSION`\n- `azure_endpoint` from `AZURE_OPENAI_ENDPOINT`\n\n\n## Deployments\n\nIn this section we are going to create a deployment of a model that we can use to create embeddings.\n\n### Deployments: Create in the Azure OpenAI Studio\nLet's deploy a model to use with embeddings. Go to https://portal.azure.com, find your Azure OpenAI resource, and then navigate to the Azure OpenAI Studio. Click on the \"Deployments\" tab and then create a deployment for the model you want to use for embeddings. The deployment name that you give the model will be used in the code below."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 60f25c3d-ba66-4739-9b5a-37066aa0a4a8
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/embeddings.ipynb", "title": "Azure embeddings example", "tokens": 816, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"60f25c3d-ba66-4739-9b5a-37066aa0a4a8\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 816, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"1c25507a-561e-4c48-a18a-98473cf582ff\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 816, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"7fe0a7c5a5a05e3f4dcf45a0cb7b6ca5891e8066acbdd6132b75ddb500394eea\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"7b6b9f12-b381-4696-94e5-1baafb63c9af\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 816, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"9e88bed39f8c866b1163d02e8114e3bf8ef7e20a98529ebc2e7fbfc7f0acc071\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1967, \"end_char_idx\": 3645, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "1c25507a-561e-4c48-a18a-98473cf582ff", "doc_id": "1c25507a-561e-4c48-a18a-98473cf582ff", "ref_doc_id": "1c25507a-561e-4c48-a18a-98473cf582ff", "chroma:document": "```python\n! pip install \"azure-identity>=1.15.0\"\n```\n\n\n```python\nfrom azure.identity import DefaultAzureCredential, get_bearer_token_provider\n\nif use_azure_active_directory:\n    endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n    api_key = os.environ[\"AZURE_OPENAI_API_KEY\"]\n\n    client = openai.AzureOpenAI(\n        azure_endpoint=endpoint,\n        azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), \"https://cognitiveservices.azure.com/.default\"),\n        api_version=\"2023-09-01-preview\"\n    )\n```\n\n> Note: the AzureOpenAI infers the following arguments from their corresponding environment variables if they are not provided:\n\n- `api_key` from `AZURE_OPENAI_API_KEY`\n- `azure_ad_token` from `AZURE_OPENAI_AD_TOKEN`\n- `api_version` from `OPENAI_API_VERSION`\n- `azure_endpoint` from `AZURE_OPENAI_ENDPOINT`\n\n\n## Deployments\n\nIn this section we are going to create a deployment of a model that we can use to create embeddings.\n\n### Deployments: Create in the Azure OpenAI Studio\nLet's deploy a model to use with embeddings. Go to https://portal.azure.com, find your Azure OpenAI resource, and then navigate to the Azure OpenAI Studio. Click on the \"Deployments\" tab and then create a deployment for the model you want to use for embeddings. The deployment name that you give the model will be used in the code below.\n\n\n```python\ndeployment = \"\" # Fill in the deployment name from the portal here\n```\n\n## Embeddings\n\nNow let's create embeddings using the client we built.\n\n\n```python\nembeddings = client.embeddings.create(\n    model=deployment,\n    input=\"The food was delicious and the waiter...\"\n)\n                                \nprint(embeddings)\n```"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: b1dae1ce-442d-4580-8ad5-44573ce68c80
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb", "title": "Azure functions example", "tokens": 1653, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"b1dae1ce-442d-4580-8ad5-44573ce68c80\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 1653, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"6ab98de4-bf90-406c-858b-6a08d9ada54e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 1653, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"d0de622efed18c3134dc1bb74fd204f24f1823f6c027a442308bf7a6d2b7b14b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"50e73423-5a5e-46b4-a4d2-a6450dea57d3\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"7f3fdbc7c63dcbb05852019f307d7636a7ebaf33392c485545571f75670347c4\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3264, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "6ab98de4-bf90-406c-858b-6a08d9ada54e", "doc_id": "6ab98de4-bf90-406c-858b-6a08d9ada54e", "ref_doc_id": "6ab98de4-bf90-406c-858b-6a08d9ada54e", "chroma:document": "# Azure functions example\n\nThis notebook shows how to use the function calling capability with the Azure OpenAI service. Functions allow a caller of chat completions to define capabilities that the model can use to extend its\nfunctionality into external tools and data sources.\n\nYou can read more about chat functions on OpenAI's blog: https://openai.com/blog/function-calling-and-other-api-updates\n\n**NOTE**: Chat functions require model versions beginning with gpt-4 and gpt-35-turbo's `-0613` labels. They are not supported by older versions of the models.\n\n## Setup\n\nFirst, we install the necessary dependencies and import the libraries we will be using.\n\n\n```python\n! pip install \"openai>=1.0.0,<2.0.0\"\n! pip install python-dotenv\n```\n\n\n```python\nimport os\nimport openai\nimport dotenv\n\ndotenv.load_dotenv()\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure Active Directory token credentials.\n\n\n```python\nuse_azure_active_directory = False  # Set this flag to True if you are using Azure Active Directory\n```\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com)). You'll also find the endpoint for your resource here.\n\n\n```python\nif not use_azure_active_directory:\n    endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n    api_key = os.environ[\"AZURE_OPENAI_API_KEY\"]\n\n    client = openai.AzureOpenAI(\n        azure_endpoint=endpoint,\n        api_key=api_key,\n        api_version=\"2023-09-01-preview\"\n    )\n```\n\n#### Authentication using Azure Active Directory\nLet's now see how we can autheticate via Azure Active Directory. We'll start by installing the `azure-identity` library. This library will provide the token credentials we need to authenticate and help us build a token credential provider through the `get_bearer_token_provider` helper function. It's recommended to use `get_bearer_token_provider` over providing a static token to `AzureOpenAI` because this API will automatically cache and refresh tokens for you. \n\nFor more information on how to set up Azure Active Directory authentication with Azure OpenAI, see the [documentation](https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity).\n\n\n```python\n! pip install \"azure-identity>=1.15.0\"\n```\n\n\n```python\nfrom azure.identity import DefaultAzureCredential, get_bearer_token_provider\n\nif use_azure_active_directory:\n    endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n    api_key = os.environ[\"AZURE_OPENAI_API_KEY\"]\n\n    client = openai.AzureOpenAI(\n        azure_endpoint=endpoint,\n        azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), \"https://cognitiveservices.azure.com/.default\"),\n        api_version=\"2023-09-01-preview\"\n    )\n```\n\n> Note: the AzureOpenAI infers the following arguments from their corresponding environment variables if they are not provided:\n\n- `api_key` from `AZURE_OPENAI_API_KEY`\n- `azure_ad_token` from `AZURE_OPENAI_AD_TOKEN`\n- `api_version` from `OPENAI_API_VERSION`\n- `azure_endpoint` from `AZURE_OPENAI_ENDPOINT`"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 50e73423-5a5e-46b4-a4d2-a6450dea57d3
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb", "title": "Azure functions example", "tokens": 1653, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"50e73423-5a5e-46b4-a4d2-a6450dea57d3\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 1653, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"6ab98de4-bf90-406c-858b-6a08d9ada54e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 1653, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"d0de622efed18c3134dc1bb74fd204f24f1823f6c027a442308bf7a6d2b7b14b\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"b1dae1ce-442d-4580-8ad5-44573ce68c80\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 1653, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"d6b041abbc08a853f560a9e0a452681f0299b4f542918a608ba6807b01a7bb5b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"755272ac-ae4d-430a-8dec-7619bbb914ea\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"aca4adeab92c6a47a3a9f517693ef4ccee787d6a4ba39d21fa2aed5f016ddf13\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2432, \"end_char_idx\": 5725, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "6ab98de4-bf90-406c-858b-6a08d9ada54e", "doc_id": "6ab98de4-bf90-406c-858b-6a08d9ada54e", "ref_doc_id": "6ab98de4-bf90-406c-858b-6a08d9ada54e", "chroma:document": "```python\n! pip install \"azure-identity>=1.15.0\"\n```\n\n\n```python\nfrom azure.identity import DefaultAzureCredential, get_bearer_token_provider\n\nif use_azure_active_directory:\n    endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n    api_key = os.environ[\"AZURE_OPENAI_API_KEY\"]\n\n    client = openai.AzureOpenAI(\n        azure_endpoint=endpoint,\n        azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), \"https://cognitiveservices.azure.com/.default\"),\n        api_version=\"2023-09-01-preview\"\n    )\n```\n\n> Note: the AzureOpenAI infers the following arguments from their corresponding environment variables if they are not provided:\n\n- `api_key` from `AZURE_OPENAI_API_KEY`\n- `azure_ad_token` from `AZURE_OPENAI_AD_TOKEN`\n- `api_version` from `OPENAI_API_VERSION`\n- `azure_endpoint` from `AZURE_OPENAI_ENDPOINT`\n\n\n## Deployments\n\nIn this section we are going to create a deployment of a GPT model that we can use to call functions.\n\n### Deployments: Create in the Azure OpenAI Studio\nLet's deploy a model to use with chat completions. Go to https://portal.azure.com, find your Azure OpenAI resource, and then navigate to the Azure OpenAI Studio. Click on the \"Deployments\" tab and then create a deployment for the model you want to use for chat completions. The deployment name that you give the model will be used in the code below.\n\n\n```python\ndeployment = \"\" # Fill in the deployment name from the portal here\n```\n\n## Functions\n\nWith setup and authentication complete, you can now use functions with the Azure OpenAI service. This will be split into a few steps:\n\n1. Define the function(s)\n2. Pass function definition(s) into chat completions API\n3. Call function with arguments from the response\n4. Feed function response back into chat completions API\n\n#### 1. Define the function(s)\n\nA list of functions can be defined, each containing the name of the function, an optional description, and the parameters the function accepts (described as a JSON schema).\n\n\n```python\nfunctions = [\n    {\n        \"name\": \"get_current_weather\",\n        \"description\": \"Get the current weather\",\n        \"parameters\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"location\": {\n                    \"type\": \"string\",\n                    \"description\": \"The city and state, e.g. San Francisco, CA\",\n                },\n                \"format\": {\n                    \"type\": \"string\",\n                    \"enum\": [\"celsius\", \"fahrenheit\"],\n                    \"description\": \"The temperature unit to use. Infer this from the users location.\",\n                },\n            },\n            \"required\": [\"location\"],\n        },\n    }\n]\n```\n\n#### 2. Pass function definition(s) into chat completions API\n\nNow we can pass the function into the chat completions API. If the model determines it should call the function, a `finish_reason` of \"tool_calls\" will be populated on the choice and the details of which function to call and its arguments will be present in the `message`. Optionally, you can set the `tool_choice` keyword argument to force the model to call a particular function (e.g. `{\"type\": \"function\", \"function\": {\"name\": get_current_weather}}`). By default, this is set to `auto`, allowing the model to choose whether to call the function or not."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 755272ac-ae4d-430a-8dec-7619bbb914ea
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb", "title": "Azure functions example", "tokens": 1653, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"755272ac-ae4d-430a-8dec-7619bbb914ea\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 1653, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"6ab98de4-bf90-406c-858b-6a08d9ada54e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 1653, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"d0de622efed18c3134dc1bb74fd204f24f1823f6c027a442308bf7a6d2b7b14b\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"50e73423-5a5e-46b4-a4d2-a6450dea57d3\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 1653, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"7118d8c34a95c44be8919d00f9ec978312c9da69e01e776ae3f6550bead40c98\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 4418, \"end_char_idx\": 7562, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "6ab98de4-bf90-406c-858b-6a08d9ada54e", "doc_id": "6ab98de4-bf90-406c-858b-6a08d9ada54e", "ref_doc_id": "6ab98de4-bf90-406c-858b-6a08d9ada54e", "chroma:document": "```python\nfunctions = [\n    {\n        \"name\": \"get_current_weather\",\n        \"description\": \"Get the current weather\",\n        \"parameters\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"location\": {\n                    \"type\": \"string\",\n                    \"description\": \"The city and state, e.g. San Francisco, CA\",\n                },\n                \"format\": {\n                    \"type\": \"string\",\n                    \"enum\": [\"celsius\", \"fahrenheit\"],\n                    \"description\": \"The temperature unit to use. Infer this from the users location.\",\n                },\n            },\n            \"required\": [\"location\"],\n        },\n    }\n]\n```\n\n#### 2. Pass function definition(s) into chat completions API\n\nNow we can pass the function into the chat completions API. If the model determines it should call the function, a `finish_reason` of \"tool_calls\" will be populated on the choice and the details of which function to call and its arguments will be present in the `message`. Optionally, you can set the `tool_choice` keyword argument to force the model to call a particular function (e.g. `{\"type\": \"function\", \"function\": {\"name\": get_current_weather}}`). By default, this is set to `auto`, allowing the model to choose whether to call the function or not. \n\n\n```python\nmessages = [\n    {\"role\": \"system\", \"content\": \"Don't make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous.\"},\n    {\"role\": \"user\", \"content\": \"What's the weather like today in Seattle?\"}\n]\n\nchat_completion = client.chat.completions.create(\n    model=deployment,\n    messages=messages,\n    tools=functions,\n)\nprint(chat_completion)\n```\n\n#### 3. Call function with arguments from the response\n\nThe name of the function call will be one that was provided initially and the arguments will include JSON matching the schema included in the function definition.\n\n\n```python\nimport json\n\ndef get_current_weather(request):\n    \"\"\"\n    This function is for illustrative purposes.\n    The location and unit should be used to determine weather\n    instead of returning a hardcoded response.\n    \"\"\"\n    location = request.get(\"location\")\n    unit = request.get(\"unit\")\n    return {\"temperature\": \"22\", \"unit\": \"celsius\", \"description\": \"Sunny\"}\n\nfunction_call = chat_completion.choices[0].message.tool_calls[0].function\nprint(function_call.name)\nprint(function_call.arguments)\n\nif function_call.name == \"get_current_weather\":\n    response = get_current_weather(json.loads(function_call.arguments))\n```\n\n#### 4. Feed function response back into chat completions API\n\nThe response from the function should be serialized into a new message with the role set to \"function\". Now the model will use the response data to formulate its answer.\n\n\n```python\nmessages.append(\n    {\n        \"role\": \"function\",\n        \"name\": \"get_current_weather\",\n        \"content\": json.dumps(response)\n    }\n)\n\nfunction_completion = client.chat.completions.create(\n    model=deployment,\n    messages=messages,\n    tools=functions,\n)\n\nprint(function_completion.choices[0].message.content.strip())\n```"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 6d701d10-1e79-4e3f-bfe2-6c96e8e2183b
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 2205, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"6d701d10-1e79-4e3f-bfe2-6c96e8e2183b\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"772f6b12-dd18-4220-a289-39a4569d4087\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"4ec30e7d81fd63c5649ef3e786352185e9512594ae626d36f61e5d4fed8d7782\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"1a451c06-a258-4337-93c5-ca02e8a52489\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"c4fa17786a418259288dfdebf63475528419c324e41bdab2fea2918b1f23da29\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3192, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "772f6b12-dd18-4220-a289-39a4569d4087", "doc_id": "772f6b12-dd18-4220-a289-39a4569d4087", "ref_doc_id": "772f6b12-dd18-4220-a289-39a4569d4087", "chroma:document": "# Azure chat completion models with your own data (preview)\nThis example shows how to use Azure OpenAI service models with your own data. The feature is currently in preview. \n\nAzure OpenAI on your data enables you to run supported chat models such as GPT-3.5-Turbo and GPT-4 on your data without needing to train or fine-tune models. Running models on your data enables you to chat on top of, and analyze your data with greater accuracy and speed. One of the key benefits of Azure OpenAI on your data is its ability to tailor the content of conversational AI. Because the model has access to, and can reference specific sources to support its responses, answers are not only based on its pretrained knowledge but also on the latest information available in the designated data source. This grounding data also helps the model avoid generating responses based on outdated or incorrect information.\n\nAzure OpenAI on your own data with Azure AI Search (f.k.a. Azure Cognitive Search) provides a customizable, pre-built solution for knowledge retrieval, from which a conversational AI application can be built. To see alternative methods for knowledge retrieval and semantic search, check out the cookbook examples for [vector databases](https://github.com/openai/openai-cookbook/tree/main/examples/vector_databases).\n\n## How it works\n\n[Azure OpenAI on your own data](https://learn.microsoft.com/azure/ai-services/openai/concepts/use-your-data) connects the model with your data, giving it the ability to retrieve and utilize data in a way that enhances the model's output. Together with Azure AI Search, data is retrieved from designated data sources based on the user input and provided conversation history. The data is then augmented and resubmitted as a prompt to the model, giving the model contextual information it can use to generate a response.\n\nSee the [Data, privacy, and security for Azure OpenAI Service](https://learn.microsoft.com/legal/cognitive-services/openai/data-privacy?context=%2Fazure%2Fai-services%2Fopenai%2Fcontext%2Fcontext) for more information.\n\n## Prerequisites\nTo get started, we'll cover a few prequisites. \n\nTo properly access the Azure OpenAI Service, we need to create the proper resources at the [Azure Portal](https://portal.azure.com) (you can check a detailed guide on how to do this in the [Microsoft Docs](https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal))\n\nTo use your own data with Azure OpenAI models, you will need:\n\n1. Azure OpenAI access and a resource with a chat model deployed (for example, GPT-3 or GPT-4)\n2. Azure AI Search (f.k.a. Azure Cognitive Search) resource\n3. Azure Blob Storage resource\n4. Your documents to be used as data (See [data source options](https://learn.microsoft.com/azure/ai-services/openai/concepts/use-your-data#data-source-options))\n\n\nFor a full walk-through on how to upload your documents to blob storage and create an index using the Azure AI Studio, see this [Quickstart](https://learn.microsoft.com/azure/ai-services/openai/use-your-data-quickstart?pivots=programming-language-studio&tabs=command-line).\n\n## Setup\n\nFirst, we install the necessary dependencies."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 1a451c06-a258-4337-93c5-ca02e8a52489
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 2205, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"1a451c06-a258-4337-93c5-ca02e8a52489\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"772f6b12-dd18-4220-a289-39a4569d4087\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"4ec30e7d81fd63c5649ef3e786352185e9512594ae626d36f61e5d4fed8d7782\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6d701d10-1e79-4e3f-bfe2-6c96e8e2183b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"7aef50c3d7ef051a664739e113f6a0c8ff77fb050e20279adfaf9e02043309d0\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"e103ab6c-8f65-41b1-9c56-fddc0f7a41ca\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"a3e8d8cd5fac279152ab544faffcebfaffcebe56c69d828e9bf7a069e894ec28\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2862, \"end_char_idx\": 6104, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "772f6b12-dd18-4220-a289-39a4569d4087", "doc_id": "772f6b12-dd18-4220-a289-39a4569d4087", "ref_doc_id": "772f6b12-dd18-4220-a289-39a4569d4087", "chroma:document": "For a full walk-through on how to upload your documents to blob storage and create an index using the Azure AI Studio, see this [Quickstart](https://learn.microsoft.com/azure/ai-services/openai/use-your-data-quickstart?pivots=programming-language-studio&tabs=command-line).\n\n## Setup\n\nFirst, we install the necessary dependencies.\n\n\n```python\n! pip install \"openai>=1.0.0,<2.0.0\"\n! pip install python-dotenv\n```\n\nIn this example, we'll use `dotenv` to load our environment variables. To connect with Azure OpenAI and the Search index, the following variables should be added to a `.env` file in `KEY=VALUE` format:\n\n* `AZURE_OPENAI_ENDPOINT` - the Azure OpenAI endpoint. This can be found under \"Keys and Endpoints\" for your Azure OpenAI resource in the Azure Portal.\n* `AZURE_OPENAI_API_KEY` - the Azure OpenAI API key. This can be found under \"Keys and Endpoints\" for your Azure OpenAI resource in the Azure Portal. Omit if using Azure Active Directory authentication (see below `Authentication using Microsoft Active Directory`)\n* `SEARCH_ENDPOINT` - the AI Search endpoint. This URL be found on the \"Overview\" of your Search resource on the Azure Portal.\n* `SEARCH_KEY` - the AI Search API key. Found under \"Keys\" for your Search resource in the Azure Portal.\n* `SEARCH_INDEX_NAME` - the name of the index you created with your own data.\n\n\n```python\nimport os\nimport openai\nimport dotenv\n\ndotenv.load_dotenv()\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure Active Directory token credentials.\n\n\n```python\nuse_azure_active_directory = False  # Set this flag to True if you are using Azure Active Directory\n```\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com)). You'll also find the endpoint for your resource here.\n\n\n```python\nif not use_azure_active_directory:\n    endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n    api_key = os.environ[\"AZURE_OPENAI_API_KEY\"]\n    # set the deployment name for the model we want to use\n    deployment = \"<deployment-id-of-the-model-to-use>\"\n\n    client = openai.AzureOpenAI(\n        base_url=f\"{endpoint}/openai/deployments/{deployment}/extensions\",\n        api_key=api_key,\n        api_version=\"2023-09-01-preview\"\n    )\n```\n\n#### Authentication using Azure Active Directory\nLet's now see how we can autheticate via Azure Active Directory. We'll start by installing the `azure-identity` library. This library will provide the token credentials we need to authenticate and help us build a token credential provider through the `get_bearer_token_provider` helper function. It's recommended to use `get_bearer_token_provider` over providing a static token to `AzureOpenAI` because this API will automatically cache and refresh tokens for you. \n\nFor more information on how to set up Azure Active Directory authentication with Azure OpenAI, see the [documentation](https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity).\n\n\n```python\n! pip install \"azure-identity>=1.15.0\"\n```"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: e103ab6c-8f65-41b1-9c56-fddc0f7a41ca
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 2205, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"e103ab6c-8f65-41b1-9c56-fddc0f7a41ca\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"772f6b12-dd18-4220-a289-39a4569d4087\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"4ec30e7d81fd63c5649ef3e786352185e9512594ae626d36f61e5d4fed8d7782\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"1a451c06-a258-4337-93c5-ca02e8a52489\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55dbd35d26b7cb6c91bd433bdc23e42ff51c94a192f946cba281ff85130fe50a\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"e0c43395-a920-4451-b584-d0f9a36b6ea6\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"9b068f476c1fd86e5fa7007723a6eb46a6c68fcaf6f1b32cdbebc34ab04c6465\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 4440, \"end_char_idx\": 7040, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "772f6b12-dd18-4220-a289-39a4569d4087", "doc_id": "772f6b12-dd18-4220-a289-39a4569d4087", "ref_doc_id": "772f6b12-dd18-4220-a289-39a4569d4087", "chroma:document": "```python\nuse_azure_active_directory = False  # Set this flag to True if you are using Azure Active Directory\n```\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com)). You'll also find the endpoint for your resource here.\n\n\n```python\nif not use_azure_active_directory:\n    endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n    api_key = os.environ[\"AZURE_OPENAI_API_KEY\"]\n    # set the deployment name for the model we want to use\n    deployment = \"<deployment-id-of-the-model-to-use>\"\n\n    client = openai.AzureOpenAI(\n        base_url=f\"{endpoint}/openai/deployments/{deployment}/extensions\",\n        api_key=api_key,\n        api_version=\"2023-09-01-preview\"\n    )\n```\n\n#### Authentication using Azure Active Directory\nLet's now see how we can autheticate via Azure Active Directory. We'll start by installing the `azure-identity` library. This library will provide the token credentials we need to authenticate and help us build a token credential provider through the `get_bearer_token_provider` helper function. It's recommended to use `get_bearer_token_provider` over providing a static token to `AzureOpenAI` because this API will automatically cache and refresh tokens for you. \n\nFor more information on how to set up Azure Active Directory authentication with Azure OpenAI, see the [documentation](https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity).\n\n\n```python\n! pip install \"azure-identity>=1.15.0\"\n```\n\n\n```python\nfrom azure.identity import DefaultAzureCredential, get_bearer_token_provider\n\nif use_azure_active_directory:\n    endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n    api_key = os.environ[\"AZURE_OPENAI_API_KEY\"]\n    # set the deployment name for the model we want to use\n    deployment = \"<deployment-id-of-the-model-to-use>\"\n\n    client = openai.AzureOpenAI(\n        base_url=f\"{endpoint}/openai/deployments/{deployment}/extensions\",\n        azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), \"https://cognitiveservices.azure.com/.default\"),\n        api_version=\"2023-09-01-preview\"\n    )\n```\n\n> Note: the AzureOpenAI infers the following arguments from their corresponding environment variables if they are not provided:\n\n- `api_key` from `AZURE_OPENAI_API_KEY`\n- `azure_ad_token` from `AZURE_OPENAI_AD_TOKEN`\n- `api_version` from `OPENAI_API_VERSION`\n- `azure_endpoint` from `AZURE_OPENAI_ENDPOINT`"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: e0c43395-a920-4451-b584-d0f9a36b6ea6
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 2205, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"e0c43395-a920-4451-b584-d0f9a36b6ea6\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"772f6b12-dd18-4220-a289-39a4569d4087\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"4ec30e7d81fd63c5649ef3e786352185e9512594ae626d36f61e5d4fed8d7782\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e103ab6c-8f65-41b1-9c56-fddc0f7a41ca\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"a642657e6d271d32d144b9bcf0baa564d5c1f7b0e72a11f3d9b5b27a40d312ca\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"cbfdc8e3-789f-4fbb-89c5-0888fcfc67c5\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"4177c9e850ecfa2998aefdee2181db22fbf4f1ba8f212d4b382b15f953bcb512\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 6052, \"end_char_idx\": 9069, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "772f6b12-dd18-4220-a289-39a4569d4087", "doc_id": "772f6b12-dd18-4220-a289-39a4569d4087", "ref_doc_id": "772f6b12-dd18-4220-a289-39a4569d4087", "chroma:document": "```python\n! pip install \"azure-identity>=1.15.0\"\n```\n\n\n```python\nfrom azure.identity import DefaultAzureCredential, get_bearer_token_provider\n\nif use_azure_active_directory:\n    endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n    api_key = os.environ[\"AZURE_OPENAI_API_KEY\"]\n    # set the deployment name for the model we want to use\n    deployment = \"<deployment-id-of-the-model-to-use>\"\n\n    client = openai.AzureOpenAI(\n        base_url=f\"{endpoint}/openai/deployments/{deployment}/extensions\",\n        azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), \"https://cognitiveservices.azure.com/.default\"),\n        api_version=\"2023-09-01-preview\"\n    )\n```\n\n> Note: the AzureOpenAI infers the following arguments from their corresponding environment variables if they are not provided:\n\n- `api_key` from `AZURE_OPENAI_API_KEY`\n- `azure_ad_token` from `AZURE_OPENAI_AD_TOKEN`\n- `api_version` from `OPENAI_API_VERSION`\n- `azure_endpoint` from `AZURE_OPENAI_ENDPOINT`\n\n\n## Chat completion model with your own data\n\n### Setting the context\n\nIn this example, we want our model to base its responses on Azure AI services documentation data. Following the [Quickstart](https://learn.microsoft.com/azure/ai-services/openai/use-your-data-quickstart?tabs=command-line&pivots=programming-language-studio) shared previously, we have added the [markdown](https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/ai-services/cognitive-services-and-machine-learning.md) file for the [Azure AI services and machine learning](https://learn.microsoft.com/azure/ai-services/cognitive-services-and-machine-learning) documentation page to our search index. The model is now ready to answer questions about Azure AI services and machine learning.\n\n### Code\n\nNow we can use Azure on your own data with Chat Completions. Providing our search endpoint, key, and index name in `dataSources`, any questions posed to the model will now be grounded in our own data. An additional property, `context`, will be provided in the response to show the data the model referenced to answer the question.\n\n\n```python\ncompletion = client.chat.completions.create(\n    messages=[{\"role\": \"user\", \"content\": \"What are the differences between Azure Machine Learning and Azure AI services?\"}],\n    model=deployment,\n    extra_body={\n        \"dataSources\": [\n            {\n                \"type\": \"AzureCognitiveSearch\",\n                \"parameters\": {\n                    \"endpoint\": os.environ[\"SEARCH_ENDPOINT\"],\n                    \"key\": os.environ[\"SEARCH_KEY\"],\n                    \"indexName\": os.environ[\"SEARCH_INDEX_NAME\"],\n                }\n            }\n        ]\n    }\n)\nprint(f\"{completion.choices[0].message.role}: {completion.choices[0].message.content}\")\n\n# `context` is in the model_extra for Azure\nprint(f\"\\nContext: {completion.choices[0].message.model_extra['context']['messages'][0]['content']}\")\n```\n\nIf you would prefer to stream the response from the model, you can pass the `stream=True` keyword argument:"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: cbfdc8e3-789f-4fbb-89c5-0888fcfc67c5
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 2205, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"cbfdc8e3-789f-4fbb-89c5-0888fcfc67c5\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"772f6b12-dd18-4220-a289-39a4569d4087\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"4ec30e7d81fd63c5649ef3e786352185e9512594ae626d36f61e5d4fed8d7782\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e0c43395-a920-4451-b584-d0f9a36b6ea6\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 2205, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"99f42a5905b3a9599d13c0b967232d33d1db50b218fd2973be6767484ca2cf4f\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 8151, \"end_char_idx\": 9990, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "772f6b12-dd18-4220-a289-39a4569d4087", "doc_id": "772f6b12-dd18-4220-a289-39a4569d4087", "ref_doc_id": "772f6b12-dd18-4220-a289-39a4569d4087", "chroma:document": "```python\ncompletion = client.chat.completions.create(\n    messages=[{\"role\": \"user\", \"content\": \"What are the differences between Azure Machine Learning and Azure AI services?\"}],\n    model=deployment,\n    extra_body={\n        \"dataSources\": [\n            {\n                \"type\": \"AzureCognitiveSearch\",\n                \"parameters\": {\n                    \"endpoint\": os.environ[\"SEARCH_ENDPOINT\"],\n                    \"key\": os.environ[\"SEARCH_KEY\"],\n                    \"indexName\": os.environ[\"SEARCH_INDEX_NAME\"],\n                }\n            }\n        ]\n    }\n)\nprint(f\"{completion.choices[0].message.role}: {completion.choices[0].message.content}\")\n\n# `context` is in the model_extra for Azure\nprint(f\"\\nContext: {completion.choices[0].message.model_extra['context']['messages'][0]['content']}\")\n```\n\nIf you would prefer to stream the response from the model, you can pass the `stream=True` keyword argument:\n\n\n```python\nresponse = client.chat.completions.create(\n    messages=[{\"role\": \"user\", \"content\": \"What are the differences between Azure Machine Learning and Azure AI services?\"}],\n    model=deployment,\n    extra_body={\n        \"dataSources\": [\n            {\n                \"type\": \"AzureCognitiveSearch\",\n                \"parameters\": {\n                    \"endpoint\": os.environ[\"SEARCH_ENDPOINT\"],\n                    \"key\": os.environ[\"SEARCH_KEY\"],\n                    \"indexName\": os.environ[\"SEARCH_INDEX_NAME\"],\n                }\n            }\n        ]\n    },\n    stream=True,\n)\n\nfor chunk in response:\n    delta = chunk.choices[0].delta\n\n    if delta.role:\n        print(\"\\n\"+ delta.role + \": \", end=\"\", flush=True)\n    if delta.content:\n        print(delta.content, end=\"\", flush=True)\n    if delta.model_extra.get(\"context\"):\n        print(f\"Context: {delta.model_extra['context']}\", end=\"\", flush=True)\n```"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: d357a457-1497-4ae5-aaf4-e353fc093edf
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/completions.ipynb", "title": "Azure completions example", "tokens": 903, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"d357a457-1497-4ae5-aaf4-e353fc093edf\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/completions.ipynb\", \"title\": \"Azure completions example\", \"tokens\": 903, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"433855fe-ff34-4800-ba87-d4be047e9a64\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/completions.ipynb\", \"title\": \"Azure completions example\", \"tokens\": 903, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"63f93087a77114e71b10b5fcffac807ff702d5c89e4f3bea448e94d9f3f340cb\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"111c20fd-2cf2-4b04-9039-3fc344ed686e\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"927f9a4d15c2070779d098d96c1eceb77e0c210c7b65a68b2565ad798546d011\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 2276, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "433855fe-ff34-4800-ba87-d4be047e9a64", "doc_id": "433855fe-ff34-4800-ba87-d4be047e9a64", "ref_doc_id": "433855fe-ff34-4800-ba87-d4be047e9a64", "chroma:document": "# Azure completions example\n\n> Note: There is a newer version of the openai library available. See https://github.com/openai/openai-python/discussions/742\n\nThis example will cover completions using the Azure OpenAI service.\n\n## Setup\n\n\nFirst, we install the necessary dependencies.\n\n\n```python\n! pip install \"openai>=0.28.1,<1.0.0\"\n```\n\nFor the following sections to work properly we first have to setup some things. Let's start with the `api_base` and `api_version`. To find your `api_base` go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for the \"Endpoint\" value.\n\n\n```python\nimport os\nimport openai\n```\n\n\n```python\nopenai.api_version = '2023-05-15'\nopenai.api_base = '' # Please add your endpoint here\n```\n\nWe next have to setup the `api_type` and `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication. Depending on this the `api_type` is either `azure` or `azure_ad`.\n\n### Setup: Portal\nLet's first look at getting the key from the portal. Go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for one of the \"Keys\" values.\n\n\n```python\nopenai.api_type = 'azure'\nopenai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n### (Optional) Setup: Microsoft Active Directory Authentication\nLet's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal.\n\n\n```python\n# from azure.identity import DefaultAzureCredential\n\n# default_credential = DefaultAzureCredential()\n# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n# openai.api_type = 'azure_ad'\n# openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 111c20fd-2cf2-4b04-9039-3fc344ed686e
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/completions.ipynb", "title": "Azure completions example", "tokens": 903, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"111c20fd-2cf2-4b04-9039-3fc344ed686e\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/completions.ipynb\", \"title\": \"Azure completions example\", \"tokens\": 903, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"433855fe-ff34-4800-ba87-d4be047e9a64\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/completions.ipynb\", \"title\": \"Azure completions example\", \"tokens\": 903, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"63f93087a77114e71b10b5fcffac807ff702d5c89e4f3bea448e94d9f3f340cb\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"d357a457-1497-4ae5-aaf4-e353fc093edf\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/completions.ipynb\", \"title\": \"Azure completions example\", \"tokens\": 903, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"cd96136d07485e14e23c132dec06fdf0bc58b561413ceca82be8f2f062f88858\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 637, \"end_char_idx\": 3915, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "433855fe-ff34-4800-ba87-d4be047e9a64", "doc_id": "433855fe-ff34-4800-ba87-d4be047e9a64", "ref_doc_id": "433855fe-ff34-4800-ba87-d4be047e9a64", "chroma:document": "```python\nimport os\nimport openai\n```\n\n\n```python\nopenai.api_version = '2023-05-15'\nopenai.api_base = '' # Please add your endpoint here\n```\n\nWe next have to setup the `api_type` and `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication. Depending on this the `api_type` is either `azure` or `azure_ad`.\n\n### Setup: Portal\nLet's first look at getting the key from the portal. Go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for one of the \"Keys\" values.\n\n\n```python\nopenai.api_type = 'azure'\nopenai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n### (Optional) Setup: Microsoft Active Directory Authentication\nLet's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal.\n\n\n```python\n# from azure.identity import DefaultAzureCredential\n\n# default_credential = DefaultAzureCredential()\n# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n# openai.api_type = 'azure_ad'\n# openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:\n\n\n```python\nimport typing\nimport time\nimport requests\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\nsession = requests.Session()\nsession.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\nopenai.requestssession = session\n```\n\n## Deployments\nIn this section we are going to create a deployment using the `gpt-3.5-turbo-instruct` model that we can then use to create completions.\n\n### Deployments: Create manually\nCreate a new deployment by going to your Resource in your portal under \"Resource Management\" -> \"Model deployments\". Select `gpt-3.5-turbo-instruct` as the model.\n\n\n```python\ndeployment_id = '' # Fill in the deployment id from the portal here\n```\n\n### Completions\nNow let's send a sample completion to the deployment.\n\n\n```python\nprompt = \"The food was delicious and the waiter\"\ncompletion = openai.Completion.create(deployment_id=deployment_id,\n                                     prompt=prompt, stop=\".\", temperature=0)\n                                \nprint(f\"{prompt}{completion['choices'][0]['text']}.\")\n```"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 2486f717-63d1-45de-ac7a-79ac03f88250
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/whisper.ipynb", "title": "Azure audio whisper (preview) example", "tokens": 1088, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"2486f717-63d1-45de-ac7a-79ac03f88250\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/whisper.ipynb\", \"title\": \"Azure audio whisper (preview) example\", \"tokens\": 1088, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"0eb8a4a1-c605-40db-b988-eee229a1d854\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/whisper.ipynb\", \"title\": \"Azure audio whisper (preview) example\", \"tokens\": 1088, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"078cb8f441b8c6d46823a1448b8a2fdac5e7dfc658867a96a545553dab72a794\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"d59f173f-ed14-4a77-85f9-ce87be3771ee\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8b2df007a1af0dd6e539313308ca210e83cc154d3fbbdde619469781d7ea51dd\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 2995, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0eb8a4a1-c605-40db-b988-eee229a1d854", "doc_id": "0eb8a4a1-c605-40db-b988-eee229a1d854", "ref_doc_id": "0eb8a4a1-c605-40db-b988-eee229a1d854", "chroma:document": "# Azure audio whisper (preview) example\n\n> Note: There is a newer version of the openai library available. See https://github.com/openai/openai-python/discussions/742\n\nThe example shows how to use the Azure OpenAI Whisper model to transcribe audio files.\n\n## Setup\n\nFirst, we install the necessary dependencies.\n\n\n```python\n! pip install \"openai>=0.28.1,<1.0.0\"\n! pip install python-dotenv\n```\n\nNext, we'll import our libraries and configure the Python OpenAI SDK to work with the Azure OpenAI service.\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n\n```python\nimport os\nimport dotenv\nimport openai\n\n\ndotenv.load_dotenv()\n```\n\n\n\n\n    True\n\n\n\n\nTo properly access the Azure OpenAI Service, we need to create the proper resources at the [Azure Portal](https://portal.azure.com) (you can check a detailed guide on how to do this in the [Microsoft Docs](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal))\n\nOnce the resource is created, the first thing we need to use is its endpoint. You can get the endpoint by looking at the *\"Keys and Endpoints\"* section under the *\"Resource Management\"* section. Having this, we will set up the SDK using this information:\n\n\n```python\nopenai.api_base = os.environ[\"OPENAI_API_BASE\"]\n\n# Min API version that supports Whisper\nopenai.api_version = \"2023-09-01-preview\"\n\n# Enter the deployment_id to use for the Whisper model\ndeployment_id = \"<deployment-id-for-your-whisper-model>\"\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure credentials.\n\n\n```python\n# set to True if using Azure Active Directory authentication\nuse_azure_active_directory = False\n```\n\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set up the `api_type` to `azure` and set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com))\n\n\n```python\nif not use_azure_active_directory:\n    openai.api_type = 'azure'\n    openai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n#### Authentication using Azure Active Directory\nLet's now see how we can get a key via Microsoft Active Directory Authentication.\n\n\n```python\nfrom azure.identity import DefaultAzureCredential\n\nif use_azure_active_directory:\n    default_credential = DefaultAzureCredential()\n    token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n    openai.api_type = 'azure_ad'\n    openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: d59f173f-ed14-4a77-85f9-ce87be3771ee
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/whisper.ipynb", "title": "Azure audio whisper (preview) example", "tokens": 1088, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"d59f173f-ed14-4a77-85f9-ce87be3771ee\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/whisper.ipynb\", \"title\": \"Azure audio whisper (preview) example\", \"tokens\": 1088, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"0eb8a4a1-c605-40db-b988-eee229a1d854\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/whisper.ipynb\", \"title\": \"Azure audio whisper (preview) example\", \"tokens\": 1088, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"078cb8f441b8c6d46823a1448b8a2fdac5e7dfc658867a96a545553dab72a794\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"2486f717-63d1-45de-ac7a-79ac03f88250\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/whisper.ipynb\", \"title\": \"Azure audio whisper (preview) example\", \"tokens\": 1088, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"3870cdccc5700223c1261ea70d4e16b9731f322bccfd893389515ffd7b0a707a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1421, \"end_char_idx\": 4768, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0eb8a4a1-c605-40db-b988-eee229a1d854", "doc_id": "0eb8a4a1-c605-40db-b988-eee229a1d854", "ref_doc_id": "0eb8a4a1-c605-40db-b988-eee229a1d854", "chroma:document": "```python\nopenai.api_base = os.environ[\"OPENAI_API_BASE\"]\n\n# Min API version that supports Whisper\nopenai.api_version = \"2023-09-01-preview\"\n\n# Enter the deployment_id to use for the Whisper model\ndeployment_id = \"<deployment-id-for-your-whisper-model>\"\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure credentials.\n\n\n```python\n# set to True if using Azure Active Directory authentication\nuse_azure_active_directory = False\n```\n\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set up the `api_type` to `azure` and set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com))\n\n\n```python\nif not use_azure_active_directory:\n    openai.api_type = 'azure'\n    openai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n#### Authentication using Azure Active Directory\nLet's now see how we can get a key via Microsoft Active Directory Authentication.\n\n\n```python\nfrom azure.identity import DefaultAzureCredential\n\nif use_azure_active_directory:\n    default_credential = DefaultAzureCredential()\n    token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n    openai.api_type = 'azure_ad'\n    openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:\n\n\n```python\nimport typing\nimport time\nimport requests\n\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\nif use_azure_active_directory:\n    session = requests.Session()\n    session.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\n    openai.requestssession = session\n```\n\n## Audio transcription\n\nAudio transcription, or speech-to-text, is the process of converting spoken words into text. Use the `openai.Audio.transcribe` method to transcribe an audio file stream to text.\n\nYou can get sample audio files from the [Azure AI Speech SDK repository at GitHub](https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/sampledata/audiofiles).\n\n\n```python\n# download sample audio file\nimport requests\n\nsample_audio_url = \"https://github.com/Azure-Samples/cognitive-services-speech-sdk/raw/master/sampledata/audiofiles/wikipediaOcelot.wav\"\naudio_file = requests.get(sample_audio_url)\nwith open(\"wikipediaOcelot.wav\", \"wb\") as f:\n    f.write(audio_file.content)\n```\n\n\n```python\ntranscription = openai.Audio.transcribe(\n    file=open(\"wikipediaOcelot.wav\", \"rb\"),\n    model=\"whisper-1\",\n    deployment_id=deployment_id,\n)\nprint(transcription.text)\n```"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: e20f2908-0627-4942-bab5-c7b1a94c38ca
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb", "title": "Azure chat completions example (preview)", "tokens": 1164, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"e20f2908-0627-4942-bab5-c7b1a94c38ca\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb\", \"title\": \"Azure chat completions example (preview)\", \"tokens\": 1164, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"47fa04db-7655-4070-8003-156eb18b64ce\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb\", \"title\": \"Azure chat completions example (preview)\", \"tokens\": 1164, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"53d52c5d42ad01089f2f5de642fd0f7b756c50a816e31657bc1bda528b67c279\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"e54c210e-b9ee-4bb3-8c73-f5f4db2a157d\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"f14f8583f21a13a95c52fb56c41c7e521a95329b8351eea86541c5abe5bd6488\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 2297, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "47fa04db-7655-4070-8003-156eb18b64ce", "doc_id": "47fa04db-7655-4070-8003-156eb18b64ce", "ref_doc_id": "47fa04db-7655-4070-8003-156eb18b64ce", "chroma:document": "# Azure chat completions example (preview)\n\n> Note: There is a newer version of the openai library available. See https://github.com/openai/openai-python/discussions/742\n\nThis example will cover chat completions using the Azure OpenAI service.\n\n## Setup\n\n\nFirst, we install the necessary dependencies.\n\n\n```python\n! pip install \"openai>=0.28.1,<1.0.0\"\n```\n\nFor the following sections to work properly we first have to setup some things. Let's start with the `api_base` and `api_version`. To find your `api_base` go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for the \"Endpoint\" value.\n\n\n```python\nimport os\nimport openai\n```\n\n\n```python\nopenai.api_version = '2023-05-15'\nopenai.api_base = '' # Please add your endpoint here\n```\n\nWe next have to setup the `api_type` and `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication. Depending on this the `api_type` is either `azure` or `azure_ad`.\n\n### Setup: Portal\nLet's first look at getting the key from the portal. Go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for one of the \"Keys\" values.\n\n\n```python\nopenai.api_type = 'azure'\nopenai.api_key = os.environ[\"OPENAI_API_KEY\"]\n\n```\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n### (Optional) Setup: Microsoft Active Directory Authentication\nLet's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal.\n\n\n```python\n# from azure.identity import DefaultAzureCredential\n\n# default_credential = DefaultAzureCredential()\n# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n# openai.api_type = 'azure_ad'\n# openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: e54c210e-b9ee-4bb3-8c73-f5f4db2a157d
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb", "title": "Azure chat completions example (preview)", "tokens": 1164, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"e54c210e-b9ee-4bb3-8c73-f5f4db2a157d\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb\", \"title\": \"Azure chat completions example (preview)\", \"tokens\": 1164, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"47fa04db-7655-4070-8003-156eb18b64ce\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb\", \"title\": \"Azure chat completions example (preview)\", \"tokens\": 1164, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"53d52c5d42ad01089f2f5de642fd0f7b756c50a816e31657bc1bda528b67c279\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e20f2908-0627-4942-bab5-c7b1a94c38ca\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb\", \"title\": \"Azure chat completions example (preview)\", \"tokens\": 1164, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"9390cf8dfd9d1b71b2bb4a26586404d7518df250c6946b7f8130909608c5a10b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"acb7831e-f569-4252-b352-6813d3c1013d\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"71982df42fc00c04aa021216539f95d33c33a7f0a1de6c11cec174e66e9d8a49\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 657, \"end_char_idx\": 3698, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "47fa04db-7655-4070-8003-156eb18b64ce", "doc_id": "47fa04db-7655-4070-8003-156eb18b64ce", "ref_doc_id": "47fa04db-7655-4070-8003-156eb18b64ce", "chroma:document": "```python\nimport os\nimport openai\n```\n\n\n```python\nopenai.api_version = '2023-05-15'\nopenai.api_base = '' # Please add your endpoint here\n```\n\nWe next have to setup the `api_type` and `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication. Depending on this the `api_type` is either `azure` or `azure_ad`.\n\n### Setup: Portal\nLet's first look at getting the key from the portal. Go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for one of the \"Keys\" values.\n\n\n```python\nopenai.api_type = 'azure'\nopenai.api_key = os.environ[\"OPENAI_API_KEY\"]\n\n```\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n### (Optional) Setup: Microsoft Active Directory Authentication\nLet's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal.\n\n\n```python\n# from azure.identity import DefaultAzureCredential\n\n# default_credential = DefaultAzureCredential()\n# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n# openai.api_type = 'azure_ad'\n# openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:\n\n\n```python\nimport typing\nimport time\nimport requests\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\nsession = requests.Session()\nsession.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\nopenai.requestssession = session\n```\n\n## Deployments\nIn this section we are going to create a deployment using the `gpt-35-turbo` model that we can then use to create chat completions.\n\n### Deployments: Create manually\nLet's create a deployment using the `gpt-35-turbo` model. Go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Model deployments\" create a new `gpt-35-turbo` deployment. \n\n\n```python\ndeployment_id = '' # Fill in the deployment id from the portal here\n```\n\n### Create chat completion\nNow let's send a sample chat completion to the deployment."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: acb7831e-f569-4252-b352-6813d3c1013d
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb", "title": "Azure chat completions example (preview)", "tokens": 1164, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"acb7831e-f569-4252-b352-6813d3c1013d\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb\", \"title\": \"Azure chat completions example (preview)\", \"tokens\": 1164, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"47fa04db-7655-4070-8003-156eb18b64ce\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb\", \"title\": \"Azure chat completions example (preview)\", \"tokens\": 1164, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"53d52c5d42ad01089f2f5de642fd0f7b756c50a816e31657bc1bda528b67c279\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e54c210e-b9ee-4bb3-8c73-f5f4db2a157d\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat.ipynb\", \"title\": \"Azure chat completions example (preview)\", \"tokens\": 1164, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"e731cee08237a51bb35861f2bdd32560b1fe2b04343cdc459acc4fdfb5e852ab\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2300, \"end_char_idx\": 4942, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "47fa04db-7655-4070-8003-156eb18b64ce", "doc_id": "47fa04db-7655-4070-8003-156eb18b64ce", "ref_doc_id": "47fa04db-7655-4070-8003-156eb18b64ce", "chroma:document": "```python\nimport typing\nimport time\nimport requests\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\nsession = requests.Session()\nsession.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\nopenai.requestssession = session\n```\n\n## Deployments\nIn this section we are going to create a deployment using the `gpt-35-turbo` model that we can then use to create chat completions.\n\n### Deployments: Create manually\nLet's create a deployment using the `gpt-35-turbo` model. Go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Model deployments\" create a new `gpt-35-turbo` deployment. \n\n\n```python\ndeployment_id = '' # Fill in the deployment id from the portal here\n```\n\n### Create chat completion\nNow let's send a sample chat completion to the deployment.\n\n\n```python\n# For all possible arguments see https://platform.openai.com/docs/api-reference/chat-completions/create\nresponse = openai.ChatCompletion.create(\n    deployment_id=deployment_id,\n    messages=[\n        {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n        {\"role\": \"user\", \"content\": \"Knock knock.\"},\n        {\"role\": \"assistant\", \"content\": \"Who's there?\"},\n        {\"role\": \"user\", \"content\": \"Orange.\"},\n    ],\n    temperature=0,\n)\n\nprint(f\"{response.choices[0].message.role}: {response.choices[0].message.content}\")\n```\n\nWe can also stream the response.\n\n\n\n```python\nresponse = openai.ChatCompletion.create(\n    deployment_id=deployment_id,\n    messages=[\n        {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n        {\"role\": \"user\", \"content\": \"Knock knock.\"},\n        {\"role\": \"assistant\", \"content\": \"Who's there?\"},\n        {\"role\": \"user\", \"content\": \"Orange.\"},\n    ],\n    temperature=0,\n    stream=True\n)\n\nfor chunk in response:\n    if len(chunk.choices) > 0:\n        delta = chunk.choices[0].delta\n\n        if \"role\" in delta.keys():\n            print(delta.role + \": \", end=\"\", flush=True)\n        if \"content\" in delta.keys():\n            print(delta.content, end=\"\", flush=True)\n```"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 7c550179-169a-4dc7-b5c8-c3b191a2766d
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb", "title": "Azure embeddings example", "tokens": 1015, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"7c550179-169a-4dc7-b5c8-c3b191a2766d\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 1015, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"1908645a-dcbd-4593-b7fd-9f096f88fd80\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 1015, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"b223a2145303566d1eca6e5926969569973a4d484a5cb6d353db5ef86daaf1b9\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"7631fd6b-7e82-4c08-8f01-7dc2d9f6a73b\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"68f65e56aa830071d7db7ff48c1e8357be8bb55182030057d900da43cca765ce\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 2258, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "1908645a-dcbd-4593-b7fd-9f096f88fd80", "doc_id": "1908645a-dcbd-4593-b7fd-9f096f88fd80", "ref_doc_id": "1908645a-dcbd-4593-b7fd-9f096f88fd80", "chroma:document": "# Azure embeddings example\n\n> Note: There is a newer version of the openai library available. See https://github.com/openai/openai-python/discussions/742\n\nThis example will cover embeddings using the Azure OpenAI service.\n\n## Setup\n\nFirst, we install the necessary dependencies.\n\n! pip install \"openai>=0.28.1,<1.0.0\"\n\nFor the following sections to work properly we first have to setup some things. Let's start with the `api_base` and `api_version`. To find your `api_base` go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for the \"Endpoint\" value.\n\n\n```python\nimport os\nimport openai\n```\n\n\n```python\nopenai.api_version = '2023-05-15'\nopenai.api_base = '' # Please add your endpoint here\n```\n\nWe next have to setup the `api_type` and `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication. Depending on this the `api_type` is either `azure` or `azure_ad`.\n\n### Setup: Portal\nLet's first look at getting the key from the portal. Go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for one of the \"Keys\" values.\n\n\n```python\nopenai.api_type = 'azure'\nopenai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n### (Optional) Setup: Microsoft Active Directory Authentication\nLet's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal.\n\n\n```python\n# from azure.identity import DefaultAzureCredential\n\n# default_credential = DefaultAzureCredential()\n# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n# openai.api_type = 'azure_ad'\n# openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 7631fd6b-7e82-4c08-8f01-7dc2d9f6a73b
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb", "title": "Azure embeddings example", "tokens": 1015, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"7631fd6b-7e82-4c08-8f01-7dc2d9f6a73b\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 1015, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"1908645a-dcbd-4593-b7fd-9f096f88fd80\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 1015, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"b223a2145303566d1eca6e5926969569973a4d484a5cb6d353db5ef86daaf1b9\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"7c550179-169a-4dc7-b5c8-c3b191a2766d\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 1015, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"892562f3ac8cee006d5aed959f18c1a7614114cc997735862e96bc9b2c316518\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"888f3f8b-48a1-475d-ba55-f62a27b15c09\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8d03c1d6529f6d46ea9697dae7a7b27905b44ee829f649897e786f8ceac5f4bd\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 619, \"end_char_idx\": 3673, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "1908645a-dcbd-4593-b7fd-9f096f88fd80", "doc_id": "1908645a-dcbd-4593-b7fd-9f096f88fd80", "ref_doc_id": "1908645a-dcbd-4593-b7fd-9f096f88fd80", "chroma:document": "```python\nimport os\nimport openai\n```\n\n\n```python\nopenai.api_version = '2023-05-15'\nopenai.api_base = '' # Please add your endpoint here\n```\n\nWe next have to setup the `api_type` and `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication. Depending on this the `api_type` is either `azure` or `azure_ad`.\n\n### Setup: Portal\nLet's first look at getting the key from the portal. Go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for one of the \"Keys\" values.\n\n\n```python\nopenai.api_type = 'azure'\nopenai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n### (Optional) Setup: Microsoft Active Directory Authentication\nLet's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal.\n\n\n```python\n# from azure.identity import DefaultAzureCredential\n\n# default_credential = DefaultAzureCredential()\n# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n# openai.api_type = 'azure_ad'\n# openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:\n\n\n```python\nimport typing\nimport time\nimport requests\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\nsession = requests.Session()\nsession.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\nopenai.requestssession = session\n```\n\n## Deployments\nIn this section we are going to create a deployment that we can use to create embeddings.\n\n### Deployments: Create manually\nLet's create a deployment using the `text-similarity-curie-001` model. Create a new deployment by going to your Resource in your portal under \"Resource Management\" -> \"Model deployments\".\n\n\n```python\ndeployment_id = '' # Fill in the deployment id from the portal here\n```\n\n### Deployments: Listing\nNow because creating a new deployment takes a long time, let's look in the subscription for an already finished deployment that succeeded."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 888f3f8b-48a1-475d-ba55-f62a27b15c09
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb", "title": "Azure embeddings example", "tokens": 1015, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"888f3f8b-48a1-475d-ba55-f62a27b15c09\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 1015, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"1908645a-dcbd-4593-b7fd-9f096f88fd80\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 1015, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"b223a2145303566d1eca6e5926969569973a4d484a5cb6d353db5ef86daaf1b9\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"7631fd6b-7e82-4c08-8f01-7dc2d9f6a73b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/embeddings.ipynb\", \"title\": \"Azure embeddings example\", \"tokens\": 1015, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"3ffb11a851014719a36478fbaed07e49eb0709154f35ec497d1e30645bbc0907\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2261, \"end_char_idx\": 4573, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "1908645a-dcbd-4593-b7fd-9f096f88fd80", "doc_id": "1908645a-dcbd-4593-b7fd-9f096f88fd80", "ref_doc_id": "1908645a-dcbd-4593-b7fd-9f096f88fd80", "chroma:document": "```python\nimport typing\nimport time\nimport requests\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\nsession = requests.Session()\nsession.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\nopenai.requestssession = session\n```\n\n## Deployments\nIn this section we are going to create a deployment that we can use to create embeddings.\n\n### Deployments: Create manually\nLet's create a deployment using the `text-similarity-curie-001` model. Create a new deployment by going to your Resource in your portal under \"Resource Management\" -> \"Model deployments\".\n\n\n```python\ndeployment_id = '' # Fill in the deployment id from the portal here\n```\n\n### Deployments: Listing\nNow because creating a new deployment takes a long time, let's look in the subscription for an already finished deployment that succeeded.\n\n\n```python\nprint('While deployment running, selecting a completed one that supports embeddings.')\ndeployment_id = None\nresult = openai.Deployment.list()\nfor deployment in result.data:\n    if deployment[\"status\"] != \"succeeded\":\n        continue\n    \n    model = openai.Model.retrieve(deployment[\"model\"])\n    if model[\"capabilities\"][\"embeddings\"] != True:\n        continue\n    \n    deployment_id = deployment[\"id\"]\n    break\n\nif not deployment_id:\n    print('No deployment with status: succeeded found.')\nelse:\n    print(f'Found a succeeded deployment that supports embeddings with id: {deployment_id}.')\n```\n\n### Embeddings\nNow let's send a sample embedding to the deployment.\n\n\n```python\nembeddings = openai.Embedding.create(deployment_id=deployment_id,\n                                     input=\"The food was delicious and the waiter...\")\n                                \nprint(embeddings)\n```"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: f6abf454-b77a-4d0b-b987-8ef5d3324778
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb", "title": "Azure DALL\u00b7E image generation example", "tokens": 1190, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"f6abf454-b77a-4d0b-b987-8ef5d3324778\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb\", \"title\": \"Azure DALL\\u00b7E image generation example\", \"tokens\": 1190, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"c3ab16e4-79bf-4cf7-abbe-91b222c2c933\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb\", \"title\": \"Azure DALL\\u00b7E image generation example\", \"tokens\": 1190, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"c227d1babd0c3e54858abf278e8b790d41d1e58013d4c3a966f18e50cf11d353\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"b2c86bd6-d10d-4922-bf06-bc69ec95a05b\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"5e45390f26c442bab7bacf8f5d2204a9119c37f08d1a9451ec9acb491ec0ae66\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 2905, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "c3ab16e4-79bf-4cf7-abbe-91b222c2c933", "doc_id": "c3ab16e4-79bf-4cf7-abbe-91b222c2c933", "ref_doc_id": "c3ab16e4-79bf-4cf7-abbe-91b222c2c933", "chroma:document": "# Azure DALL\u00b7E image generation example\n\n> Note: There is a newer version of the openai library available. See https://github.com/openai/openai-python/discussions/742\n\nThis notebook shows how to generate images with the Azure OpenAI service.\n\n## Setup\n\nFirst, we install the necessary dependencies.\n\n\n```python\n! pip install \"openai>=0.28.1,<1.0.0\"\n# We need requests to retrieve the generated image\n! pip install requests\n# We use Pillow to display the generated image\n! pip install pillow \n# (Optional) If you want to use Microsoft Active Directory\n! pip install azure-identity\n```\n\n\n```python\nimport os\nimport openai\n```\n\n\nAdditionally, to properly access the Azure OpenAI Service, we need to create the proper resources at the [Azure Portal](https://portal.azure.com) (you can check a detailed guide on how to do this in the [Microsoft Docs](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal))\n\nOnce the resource is created, the first thing we need to use is its endpoint. You can get the endpoint by looking at the *\"Keys and Endpoints\"* section under the *\"Resource Management\"* section. Having this, we will set up the SDK using this information:\n\n\n```python\nopenai.api_base = '' # Add your endpoint here\n\n# At the moment DALL\u00b7E is only supported by the 2023-06-01-preview API version\nopenai.api_version = '2023-06-01-preview'\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure credentials.\n\n\n```python\nuse_azure_active_directory = False\n```\n\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set up the `api_type` to `azure` and set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com))\n\n\n```python\nif not use_azure_active_directory:\n    openai.api_type = 'azure'\n    openai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n#### Authentication using Microsoft Active Directory\nLet's now see how we can get a key via Microsoft Active Directory Authentication.\n\n\n```python\nfrom azure.identity import DefaultAzureCredential\n\nif use_azure_active_directory:\n    default_credential = DefaultAzureCredential()\n    token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n    openai.api_type = 'azure_ad'\n    openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: b2c86bd6-d10d-4922-bf06-bc69ec95a05b
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb", "title": "Azure DALL\u00b7E image generation example", "tokens": 1190, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"b2c86bd6-d10d-4922-bf06-bc69ec95a05b\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb\", \"title\": \"Azure DALL\\u00b7E image generation example\", \"tokens\": 1190, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"c3ab16e4-79bf-4cf7-abbe-91b222c2c933\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb\", \"title\": \"Azure DALL\\u00b7E image generation example\", \"tokens\": 1190, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"c227d1babd0c3e54858abf278e8b790d41d1e58013d4c3a966f18e50cf11d353\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f6abf454-b77a-4d0b-b987-8ef5d3324778\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb\", \"title\": \"Azure DALL\\u00b7E image generation example\", \"tokens\": 1190, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"c28da1edf18cd60f556f74aa40cfd7de4dcf94a1851a4f9a6eaa41a7ff266673\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"86192e34-6e03-4c99-bbfb-859a2c93a162\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b8fa68b36d32c8a9eb5599bd4bd3bebcef5ce7b22e8cdfbb005106e0f6e5f841\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1213, \"end_char_idx\": 4346, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "c3ab16e4-79bf-4cf7-abbe-91b222c2c933", "doc_id": "c3ab16e4-79bf-4cf7-abbe-91b222c2c933", "ref_doc_id": "c3ab16e4-79bf-4cf7-abbe-91b222c2c933", "chroma:document": "```python\nopenai.api_base = '' # Add your endpoint here\n\n# At the moment DALL\u00b7E is only supported by the 2023-06-01-preview API version\nopenai.api_version = '2023-06-01-preview'\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure credentials.\n\n\n```python\nuse_azure_active_directory = False\n```\n\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set up the `api_type` to `azure` and set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com))\n\n\n```python\nif not use_azure_active_directory:\n    openai.api_type = 'azure'\n    openai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n#### Authentication using Microsoft Active Directory\nLet's now see how we can get a key via Microsoft Active Directory Authentication.\n\n\n```python\nfrom azure.identity import DefaultAzureCredential\n\nif use_azure_active_directory:\n    default_credential = DefaultAzureCredential()\n    token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n    openai.api_type = 'azure_ad'\n    openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:\n\n\n```python\nimport typing\nimport time\nimport requests\n\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\nif use_azure_active_directory:\n    session = requests.Session()\n    session.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\n    openai.requestssession = session\n```\n\n## Generations\n\nWith setup and authentication complete, you can now generate images on the Azure OpenAI service and retrieve them from the returned URLs.\n\n#### 1. Generate the images\n\nThe first step in this process is to actually generate the images:\n\n\n```python\ngeneration_response = openai.Image.create(\n    prompt='A cyberpunk monkey hacker dreaming of a beautiful bunch of bananas, digital art',\n    size='1024x1024',\n    n=2\n)\n\nprint(generation_response)\n```\n\nHaving the response from the `Image.create` call, we download from the URL using `requests`."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 86192e34-6e03-4c99-bbfb-859a2c93a162
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb", "title": "Azure DALL\u00b7E image generation example", "tokens": 1190, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"86192e34-6e03-4c99-bbfb-859a2c93a162\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb\", \"title\": \"Azure DALL\\u00b7E image generation example\", \"tokens\": 1190, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"c3ab16e4-79bf-4cf7-abbe-91b222c2c933\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb\", \"title\": \"Azure DALL\\u00b7E image generation example\", \"tokens\": 1190, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"c227d1babd0c3e54858abf278e8b790d41d1e58013d4c3a966f18e50cf11d353\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"b2c86bd6-d10d-4922-bf06-bc69ec95a05b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/DALL-E.ipynb\", \"title\": \"Azure DALL\\u00b7E image generation example\", \"tokens\": 1190, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"0f15e1d49a2166caaba8a0f91be35877bb183f69ec1915783fc53d3c7dc4b722\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2908, \"end_char_idx\": 5186, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "c3ab16e4-79bf-4cf7-abbe-91b222c2c933", "doc_id": "c3ab16e4-79bf-4cf7-abbe-91b222c2c933", "ref_doc_id": "c3ab16e4-79bf-4cf7-abbe-91b222c2c933", "chroma:document": "```python\nimport typing\nimport time\nimport requests\n\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\nif use_azure_active_directory:\n    session = requests.Session()\n    session.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\n    openai.requestssession = session\n```\n\n## Generations\n\nWith setup and authentication complete, you can now generate images on the Azure OpenAI service and retrieve them from the returned URLs.\n\n#### 1. Generate the images\n\nThe first step in this process is to actually generate the images:\n\n\n```python\ngeneration_response = openai.Image.create(\n    prompt='A cyberpunk monkey hacker dreaming of a beautiful bunch of bananas, digital art',\n    size='1024x1024',\n    n=2\n)\n\nprint(generation_response)\n```\n\nHaving the response from the `Image.create` call, we download from the URL using `requests`.\n\n\n```python\nimport os\nimport requests\n\n# First a little setup\nimage_dir = os.path.join(os.curdir, 'images')\n# If the directory doesn't exist, create it\nif not os.path.isdir(image_dir):\n    os.mkdir(image_dir)\n\n# With the directory in place, we can initialize the image path (note that filetype should be png)\nimage_path = os.path.join(image_dir, 'generated_image.png')\n\n# Now we can retrieve the generated image\nimage_url = generation_response[\"data\"][0][\"url\"]  # extract image URL from response\ngenerated_image = requests.get(image_url).content  # download the image\nwith open(image_path, \"wb\") as image_file:\n    image_file.write(generated_image)\n```\n\nWith the image downloaded, we use the [Pillow](https://pypi.org/project/Pillow/) library to open and display it:\n\n\n```python\nfrom PIL import Image \n\ndisplay(Image.open(image_path))\n```"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 8e1bccea-561b-4a58-a920-d5a9902fbd4d
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb", "title": "Azure functions example", "tokens": 2044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"8e1bccea-561b-4a58-a920-d5a9902fbd4d\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"0144e318-f9a2-4892-a9c6-d7ac70248c24\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"3daba2c07f7a4cefdf7c224d1382f1fa9245d1f7c2c735e2c0343f8ab96cb2bd\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"99988a00-92af-49be-97c6-59f4b8361e02\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"cab966979611e5832219ed0f63b01d7f986022326e2c24aafec8dac0c8a89a6c\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3196, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "doc_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "ref_doc_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "chroma:document": "# Azure functions example\n\n> Note: There is a newer version of the openai library available. See https://github.com/openai/openai-python/discussions/742\n\nThis notebook shows how to use the function calling capability with the Azure OpenAI service. Functions allow a caller of chat completions to define capabilities that the model can use to extend its\nfunctionality into external tools and data sources.\n\nYou can read more about chat functions on OpenAI's blog: https://openai.com/blog/function-calling-and-other-api-updates\n\n**NOTE**: Chat functions require model versions beginning with gpt-4 and gpt-35-turbo's `-0613` labels. They are not supported by older versions of the models.\n\n## Setup\n\nFirst, we install the necessary dependencies.\n\n\n```python\n! pip install \"openai>=0.28.1,<1.0.0\"\n# (Optional) If you want to use Microsoft Active Directory\n! pip install azure-identity\n```\n\n\n```python\nimport os\nimport openai\n```\n\n\nAdditionally, to properly access the Azure OpenAI Service, we need to create the proper resources at the [Azure Portal](https://portal.azure.com) (you can check a detailed guide on how to do this in the [Microsoft Docs](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal))\n\nOnce the resource is created, the first thing we need to use is its endpoint. You can get the endpoint by looking at the *\"Keys and Endpoints\"* section under the *\"Resource Management\"* section. Having this, we will set up the SDK using this information:\n\n\n```python\nopenai.api_base = \"\" # Add your endpoint here\n\n# functions is only supported by the 2023-07-01-preview API version\nopenai.api_version = \"2023-07-01-preview\"\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure credentials.\n\n\n```python\nuse_azure_active_directory = False\n```\n\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set up the `api_type` to `azure` and set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com))\n\n\n```python\nif not use_azure_active_directory:\n    openai.api_type = \"azure\"\n    openai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n#### Authentication using Microsoft Active Directory\nLet's now see how we can get a key via Microsoft Active Directory Authentication.\n\n\n```python\nfrom azure.identity import DefaultAzureCredential\n\nif use_azure_active_directory:\n    default_credential = DefaultAzureCredential()\n    token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n    openai.api_type = \"azure_ad\"\n    openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 99988a00-92af-49be-97c6-59f4b8361e02
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb", "title": "Azure functions example", "tokens": 2044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"99988a00-92af-49be-97c6-59f4b8361e02\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"0144e318-f9a2-4892-a9c6-d7ac70248c24\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"3daba2c07f7a4cefdf7c224d1382f1fa9245d1f7c2c735e2c0343f8ab96cb2bd\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"8e1bccea-561b-4a58-a920-d5a9902fbd4d\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"7410ae96b9de62f174ae1094afcd1c6ff25a24dabcbce8cf00972aa550e07808\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"2bc532a8-6bc1-48ff-bc96-5546caf8c288\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"2cbc1d9adfb444a369b0c3ea7ccc19e9a9cda83f0347d49447669e7517f21eb5\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1515, \"end_char_idx\": 4624, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "doc_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "ref_doc_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "chroma:document": "```python\nopenai.api_base = \"\" # Add your endpoint here\n\n# functions is only supported by the 2023-07-01-preview API version\nopenai.api_version = \"2023-07-01-preview\"\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure credentials.\n\n\n```python\nuse_azure_active_directory = False\n```\n\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set up the `api_type` to `azure` and set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com))\n\n\n```python\nif not use_azure_active_directory:\n    openai.api_type = \"azure\"\n    openai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n> Note: In this example, we configured the library to use the Azure API by setting the variables in code. For development, consider setting the environment variables instead:\n\n```\nOPENAI_API_BASE\nOPENAI_API_KEY\nOPENAI_API_TYPE\nOPENAI_API_VERSION\n```\n\n#### Authentication using Microsoft Active Directory\nLet's now see how we can get a key via Microsoft Active Directory Authentication.\n\n\n```python\nfrom azure.identity import DefaultAzureCredential\n\nif use_azure_active_directory:\n    default_credential = DefaultAzureCredential()\n    token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n    openai.api_type = \"azure_ad\"\n    openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:\n\n\n```python\nimport typing\nimport time\nimport requests\n\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\nif use_azure_active_directory:\n    session = requests.Session()\n    session.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\n    openai.requestssession = session\n```\n\n## Functions\n\nWith setup and authentication complete, you can now use functions with the Azure OpenAI service. This will be split into a few steps:\n\n1. Define the function(s)\n2. Pass function definition(s) into chat completions API\n3. Call function with arguments from the response\n4. Feed function response back into chat completions API\n\n#### 1. Define the function(s)\n\nA list of functions can be defined, each containing the name of the function, an optional description, and the parameters the function accepts (described as a JSON schema)."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 2bc532a8-6bc1-48ff-bc96-5546caf8c288
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb", "title": "Azure functions example", "tokens": 2044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"2bc532a8-6bc1-48ff-bc96-5546caf8c288\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"0144e318-f9a2-4892-a9c6-d7ac70248c24\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"3daba2c07f7a4cefdf7c224d1382f1fa9245d1f7c2c735e2c0343f8ab96cb2bd\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"99988a00-92af-49be-97c6-59f4b8361e02\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5c05c24e01e071b537425e7311ca00ebae8bc70f8d5e8d678628b5624767f0b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"aceedff4-866a-4bd4-b437-93411baf63ba\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"106b005d31dd35c722d8fac365ebb0cfed417618d47c51e9fd0091cb47374b5b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 3199, \"end_char_idx\": 5919, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "doc_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "ref_doc_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "chroma:document": "```python\nimport typing\nimport time\nimport requests\n\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\nif use_azure_active_directory:\n    session = requests.Session()\n    session.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\n    openai.requestssession = session\n```\n\n## Functions\n\nWith setup and authentication complete, you can now use functions with the Azure OpenAI service. This will be split into a few steps:\n\n1. Define the function(s)\n2. Pass function definition(s) into chat completions API\n3. Call function with arguments from the response\n4. Feed function response back into chat completions API\n\n#### 1. Define the function(s)\n\nA list of functions can be defined, each containing the name of the function, an optional description, and the parameters the function accepts (described as a JSON schema).\n\n\n```python\nfunctions = [\n    {\n        \"name\": \"get_current_weather\",\n        \"description\": \"Get the current weather\",\n        \"parameters\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"location\": {\n                    \"type\": \"string\",\n                    \"description\": \"The city and state, e.g. San Francisco, CA\",\n                },\n                \"format\": {\n                    \"type\": \"string\",\n                    \"enum\": [\"celsius\", \"fahrenheit\"],\n                    \"description\": \"The temperature unit to use. Infer this from the users location.\",\n                },\n            },\n            \"required\": [\"location\"],\n        },\n    }\n]\n```\n\n#### 2. Pass function definition(s) into chat completions API\n\nNow we can pass the function into the chat completions API. If the model determines it should call the function, a `finish_reason` of \"function_call\" will be populated on the choice and the details of which function to call and its arguments will be present in the `message`. Optionally, you can set the `function_call` keyword argument to force the model to call a particular function (e.g. `function_call={\"name\": get_current_weather}`). By default, this is set to `auto`, allowing the model to choose whether to call the function or not."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: aceedff4-866a-4bd4-b437-93411baf63ba
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb", "title": "Azure functions example", "tokens": 2044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"aceedff4-866a-4bd4-b437-93411baf63ba\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"0144e318-f9a2-4892-a9c6-d7ac70248c24\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"3daba2c07f7a4cefdf7c224d1382f1fa9245d1f7c2c735e2c0343f8ab96cb2bd\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"2bc532a8-6bc1-48ff-bc96-5546caf8c288\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"4f776a57806b9f9f79772dce8298aa33b7e7bb3e25bbde955af3dd3f25fcabe4\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"835c1fbb-2ed5-420f-b5f2-cc846cd6492c\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"69071f9436c7333db7729dcb321def546fc67549864ed47183659c53d3d3ba57\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 4627, \"end_char_idx\": 7777, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "doc_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "ref_doc_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "chroma:document": "```python\nfunctions = [\n    {\n        \"name\": \"get_current_weather\",\n        \"description\": \"Get the current weather\",\n        \"parameters\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"location\": {\n                    \"type\": \"string\",\n                    \"description\": \"The city and state, e.g. San Francisco, CA\",\n                },\n                \"format\": {\n                    \"type\": \"string\",\n                    \"enum\": [\"celsius\", \"fahrenheit\"],\n                    \"description\": \"The temperature unit to use. Infer this from the users location.\",\n                },\n            },\n            \"required\": [\"location\"],\n        },\n    }\n]\n```\n\n#### 2. Pass function definition(s) into chat completions API\n\nNow we can pass the function into the chat completions API. If the model determines it should call the function, a `finish_reason` of \"function_call\" will be populated on the choice and the details of which function to call and its arguments will be present in the `message`. Optionally, you can set the `function_call` keyword argument to force the model to call a particular function (e.g. `function_call={\"name\": get_current_weather}`). By default, this is set to `auto`, allowing the model to choose whether to call the function or not. \n\n\n```python\nmessages = [\n    {\"role\": \"system\", \"content\": \"Don't make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous.\"},\n    {\"role\": \"user\", \"content\": \"What's the weather like today in Seattle?\"}\n]\n\nchat_completion = openai.ChatCompletion.create(\n    deployment_id=\"gpt-35-turbo-0613\",\n    messages=messages,\n    functions=functions,\n)\nprint(chat_completion)\n```\n\n    {\n      \"choices\": [\n        {\n          \"content_filter_results\": {},\n          \"finish_reason\": \"function_call\",\n          \"index\": 0,\n          \"message\": {\n            \"function_call\": {\n              \"arguments\": \"{\\n  \\\"location\\\": \\\"Seattle, WA\\\"\\n}\",\n              \"name\": \"get_current_weather\"\n            },\n            \"role\": \"assistant\"\n          }\n        }\n      ],\n      \"created\": 1689702512,\n      \"id\": \"chatcmpl-7dj6GkYdM7Vw9eGn02bc2qqjN70Ps\",\n      \"model\": \"gpt-4\",\n      \"object\": \"chat.completion\",\n      \"prompt_annotations\": [\n        {\n          \"content_filter_results\": {\n            \"hate\": {\n              \"filtered\": false,\n              \"severity\": \"safe\"\n            },\n            \"self_harm\": {\n              \"filtered\": false,\n              \"severity\": \"safe\"\n            },\n            \"sexual\": {\n              \"filtered\": false,\n              \"severity\": \"safe\"\n            },\n            \"violence\": {\n              \"filtered\": false,\n              \"severity\": \"safe\"\n            }\n          },\n          \"prompt_index\": 0\n        }\n      ],\n      \"usage\": {\n        \"completion_tokens\": 18,\n        \"prompt_tokens\": 115,\n        \"total_tokens\": 133\n      }\n    }\n\n\n#### 3. Call function with arguments from the response\n\nThe name of the function call will be one that was provided initially and the arguments will include JSON matching the schema included in the function definition."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 835c1fbb-2ed5-420f-b5f2-cc846cd6492c
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb", "title": "Azure functions example", "tokens": 2044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"835c1fbb-2ed5-420f-b5f2-cc846cd6492c\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"0144e318-f9a2-4892-a9c6-d7ac70248c24\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"3daba2c07f7a4cefdf7c224d1382f1fa9245d1f7c2c735e2c0343f8ab96cb2bd\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"aceedff4-866a-4bd4-b437-93411baf63ba\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/functions.ipynb\", \"title\": \"Azure functions example\", \"tokens\": 2044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"a3a1e9a4e6efdcfc48fca5688e87d6c286007fe4eecd64e4886d9a9770758d0b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 7559, \"end_char_idx\": 9153, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "doc_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "ref_doc_id": "0144e318-f9a2-4892-a9c6-d7ac70248c24", "chroma:document": "#### 3. Call function with arguments from the response\n\nThe name of the function call will be one that was provided initially and the arguments will include JSON matching the schema included in the function definition.\n\n\n```python\nimport json\n\ndef get_current_weather(request):\n    \"\"\"\n    This function is for illustrative purposes.\n    The location and unit should be used to determine weather\n    instead of returning a hardcoded response.\n    \"\"\"\n    location = request.get(\"location\")\n    unit = request.get(\"unit\")\n    return {\"temperature\": \"22\", \"unit\": \"celsius\", \"description\": \"Sunny\"}\n\nfunction_call =  chat_completion.choices[0].message.function_call\nprint(function_call.name)\nprint(function_call.arguments)\n\nif function_call.name == \"get_current_weather\":\n    response = get_current_weather(json.loads(function_call.arguments))\n```\n\n    get_current_weather\n    {\n      \"location\": \"Seattle, WA\"\n    }\n\n\n#### 4. Feed function response back into chat completions API\n\nThe response from the function should be serialized into a new message with the role set to \"function\". Now the model will use the response data to formulate its answer.\n\n\n```python\nmessages.append(\n    {\n        \"role\": \"function\",\n        \"name\": \"get_current_weather\",\n        \"content\": json.dumps(response)\n    }\n)\n\nfunction_completion = openai.ChatCompletion.create(\n    deployment_id=\"gpt-35-turbo-0613\",\n    messages=messages,\n    functions=functions,\n)\n\nprint(function_completion.choices[0].message.content.strip())\n```\n\n    Today in Seattle, the weather is sunny with a temperature of 22 degrees celsius."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 67f57ff9-0dce-4491-b701-7ae5f470ea56
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"67f57ff9-0dce-4491-b701-7ae5f470ea56\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"092edb18-2f9c-4237-9f0b-27d303ee6364\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"586b3250940add4ad34517f4615bf1d91659742f1862071264163349fce76328\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3277, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "# Azure chat completion models with your own data (preview)\n\n> Note: There is a newer version of the openai library available. See https://github.com/openai/openai-python/discussions/742\n\nThis example shows how to use Azure OpenAI service models with your own data. The feature is currently in preview. \n\nAzure OpenAI on your data enables you to run supported chat models such as GPT-3.5-Turbo and GPT-4 on your data without needing to train or fine-tune models. Running models on your data enables you to chat on top of, and analyze your data with greater accuracy and speed. One of the key benefits of Azure OpenAI on your data is its ability to tailor the content of conversational AI. Because the model has access to, and can reference specific sources to support its responses, answers are not only based on its pretrained knowledge but also on the latest information available in the designated data source. This grounding data also helps the model avoid generating responses based on outdated or incorrect information.\n\nAzure OpenAI on your own data with Azure Cognitive Search provides a customizable, pre-built solution for knowledge retrieval, from which a conversational AI application can be built. To see alternative methods for knowledge retrieval and semantic search, check out the cookbook examples for [vector databases](https://github.com/openai/openai-cookbook/tree/main/examples/vector_databases).\n\n## How it works\n\n[Azure OpenAI on your own data](https://learn.microsoft.com/azure/ai-services/openai/concepts/use-your-data) connects the model with your data, giving it the ability to retrieve and utilize data in a way that enhances the model's output. Together with Azure Cognitive Search, data is retrieved from designated data sources based on the user input and provided conversation history. The data is then augmented and resubmitted as a prompt to the model, giving the model contextual information it can use to generate a response.\n\nSee the [Data, privacy, and security for Azure OpenAI Service](https://learn.microsoft.com/legal/cognitive-services/openai/data-privacy?context=%2Fazure%2Fai-services%2Fopenai%2Fcontext%2Fcontext) for more information.\n\n## Prerequisites\nTo get started, we'll cover a few prequisites. \n\nTo properly access the Azure OpenAI Service, we need to create the proper resources at the [Azure Portal](https://portal.azure.com) (you can check a detailed guide on how to do this in the [Microsoft Docs](https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal))\n\nTo use your own data with Azure OpenAI models, you will need:\n\n1. Azure OpenAI access and a resource with a chat model deployed (for example, GPT-3 or GPT-4)\n2. Azure Cognitive Search resource\n3. Azure Blob Storage resource\n4. Your documents to be used as data (See [data source options](https://learn.microsoft.com/azure/ai-services/openai/concepts/use-your-data#data-source-options))\n\n\nFor a full walk-through on how to upload your documents to blob storage and create an index using the Azure AI Studio, see this [Quickstart](https://learn.microsoft.com/azure/ai-services/openai/use-your-data-quickstart?pivots=programming-language-studio&tabs=command-line).\n\n## Setup\n\nFirst, we install the necessary dependencies."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 092edb18-2f9c-4237-9f0b-27d303ee6364
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"092edb18-2f9c-4237-9f0b-27d303ee6364\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"67f57ff9-0dce-4491-b701-7ae5f470ea56\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"b95c8bdcbf7bbe6003ff7b41e9fb44a8457656702b79aa730a7966023c033123\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"324ff2c0-d01b-46de-80f1-d41d9938f82d\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"60c229b8b541dde9853e94bab547a578d8beb322acc34debe6fc771c0c7d4e93\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2947, \"end_char_idx\": 6078, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "For a full walk-through on how to upload your documents to blob storage and create an index using the Azure AI Studio, see this [Quickstart](https://learn.microsoft.com/azure/ai-services/openai/use-your-data-quickstart?pivots=programming-language-studio&tabs=command-line).\n\n## Setup\n\nFirst, we install the necessary dependencies.\n\n\n```python\n! pip install \"openai>=0.28.1,<1.0.0\"\n! pip install python-dotenv\n```\n\nIn this example, we'll use `dotenv` to load our environment variables. To connect with Azure OpenAI and the Search index, the following variables should be added to a `.env` file in `KEY=VALUE` format:\n\n* `OPENAI_API_BASE` - the Azure OpenAI endpoint. This can be found under \"Keys and Endpoints\" for your Azure OpenAI resource in the Azure Portal.\n* `OPENAI_API_KEY` - the Azure OpenAI API key. This can be found under \"Keys and Endpoints\" for your Azure OpenAI resource in the Azure Portal. Omit if using Azure Active Directory authentication (see below `Authentication using Microsoft Active Directory`)\n* `SEARCH_ENDPOINT` - the Cognitive Search endpoint. This URL be found on the \"Overview\" of your Search resource on the Azure Portal.\n* `SEARCH_KEY` - the Cognitive Search API key. Found under \"Keys\" for your Search resource in the Azure Portal.\n* `SEARCH_INDEX_NAME` - the name of the index you created with your own data.\n\n\n```python\nimport os\nimport openai\nimport dotenv\n\ndotenv.load_dotenv()\n```\n\n\n```python\nopenai.api_base = os.environ[\"OPENAI_API_BASE\"]\n\n# Azure OpenAI on your own data is only supported by the 2023-08-01-preview API version\nopenai.api_version = \"2023-08-01-preview\"\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure credentials.\n\n\n```python\nuse_azure_active_directory = False  # Set this flag to True if you are using Azure Active Directory\n```\n\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set up the `api_type` to `azure` and set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com))\n\n\n```python\nif not use_azure_active_directory:\n    openai.api_type = 'azure'\n    openai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n#### Authentication using Microsoft Active Directory\nLet's now see how we can get a key via Microsoft Active Directory Authentication. See the [documentation](https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity) for more information on how to set this up.\n\n\n```python\n! pip install azure-identity\n```\n\n\n```python\nfrom azure.identity import DefaultAzureCredential\n\nif use_azure_active_directory:\n    default_credential = DefaultAzureCredential()\n    token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n    openai.api_type = \"azure_ad\"\n    openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 324ff2c0-d01b-46de-80f1-d41d9938f82d
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"324ff2c0-d01b-46de-80f1-d41d9938f82d\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"092edb18-2f9c-4237-9f0b-27d303ee6364\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"eaec4563b883108b463351230ecab9735e843d15a53ac91d01f364b9080b5821\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"e20cb4a2-1faa-45ef-8605-b0b2708f32da\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8ebbd22a3e245485bf782c9cb56f7d1d42cf55e080354e847069f1f66e6e6ec1\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 4370, \"end_char_idx\": 7910, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "```python\nopenai.api_base = os.environ[\"OPENAI_API_BASE\"]\n\n# Azure OpenAI on your own data is only supported by the 2023-08-01-preview API version\nopenai.api_version = \"2023-08-01-preview\"\n```\n\n### Authentication\n\nThe Azure OpenAI service supports multiple authentication mechanisms that include API keys and Azure credentials.\n\n\n```python\nuse_azure_active_directory = False  # Set this flag to True if you are using Azure Active Directory\n```\n\n\n#### Authentication using API key\n\nTo set up the OpenAI SDK to use an *Azure API Key*, we need to set up the `api_type` to `azure` and set `api_key` to a key associated with your endpoint (you can find this key in *\"Keys and Endpoints\"* under *\"Resource Management\"* in the [Azure Portal](https://portal.azure.com))\n\n\n```python\nif not use_azure_active_directory:\n    openai.api_type = 'azure'\n    openai.api_key = os.environ[\"OPENAI_API_KEY\"]\n```\n\n#### Authentication using Microsoft Active Directory\nLet's now see how we can get a key via Microsoft Active Directory Authentication. See the [documentation](https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity) for more information on how to set this up.\n\n\n```python\n! pip install azure-identity\n```\n\n\n```python\nfrom azure.identity import DefaultAzureCredential\n\nif use_azure_active_directory:\n    default_credential = DefaultAzureCredential()\n    token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n\n    openai.api_type = \"azure_ad\"\n    openai.api_key = token.token\n```\n\nA token is valid for a period of time, after which it will expire. To ensure a valid token is sent with every request, you can refresh an expiring token by hooking into requests.auth:\n\n\n```python\nimport typing\nimport time\nimport requests\n\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\n```\n\n## Chat completion model with your own data\n\n### Setting the context\n\nIn this example, we want our model to base its responses on Azure AI services documentation data. Following the [Quickstart](https://learn.microsoft.com/azure/ai-services/openai/use-your-data-quickstart?tabs=command-line&pivots=programming-language-studio) shared previously, we have added the [markdown](https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/ai-services/cognitive-services-and-machine-learning.md) file for the [Azure AI services and machine learning](https://learn.microsoft.com/azure/ai-services/cognitive-services-and-machine-learning) documentation page to our search index. The model is now ready to answer questions about Azure AI services and machine learning.\n\n### Code\n\nTo chat with Azure OpenAI models using your own data with the Python SDK, we must first set up the code to target the chat completions extensions endpoint which is designed to work with your own data. To do this, we've created a convenience function that can be called to set a custom adapter for the library which will target the extensions endpoint for a given deployment ID."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: e20cb4a2-1faa-45ef-8605-b0b2708f32da
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"e20cb4a2-1faa-45ef-8605-b0b2708f32da\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"324ff2c0-d01b-46de-80f1-d41d9938f82d\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"b9821f1a7388303c7318a9ed0341deacda50152ea98b332a80711b70adfec6a1\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"1bfe9652-22d3-40fc-83ae-5eb8bde1e1c9\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"bf79c03abacc8b2efda34e208cf91abda3608fc16bc4cc6b98c1db63f102f67a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 6081, \"end_char_idx\": 9618, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "```python\nimport typing\nimport time\nimport requests\n\nif typing.TYPE_CHECKING:\n    from azure.core.credentials import TokenCredential\n\nclass TokenRefresh(requests.auth.AuthBase):\n\n    def __init__(self, credential: \"TokenCredential\", scopes: typing.List[str]) -> None:\n        self.credential = credential\n        self.scopes = scopes\n        self.cached_token: typing.Optional[str] = None\n\n    def __call__(self, req):\n        if not self.cached_token or self.cached_token.expires_on - time.time() < 300:\n            self.cached_token = self.credential.get_token(*self.scopes)\n        req.headers[\"Authorization\"] = f\"Bearer {self.cached_token.token}\"\n        return req\n\n```\n\n## Chat completion model with your own data\n\n### Setting the context\n\nIn this example, we want our model to base its responses on Azure AI services documentation data. Following the [Quickstart](https://learn.microsoft.com/azure/ai-services/openai/use-your-data-quickstart?tabs=command-line&pivots=programming-language-studio) shared previously, we have added the [markdown](https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/ai-services/cognitive-services-and-machine-learning.md) file for the [Azure AI services and machine learning](https://learn.microsoft.com/azure/ai-services/cognitive-services-and-machine-learning) documentation page to our search index. The model is now ready to answer questions about Azure AI services and machine learning.\n\n### Code\n\nTo chat with Azure OpenAI models using your own data with the Python SDK, we must first set up the code to target the chat completions extensions endpoint which is designed to work with your own data. To do this, we've created a convenience function that can be called to set a custom adapter for the library which will target the extensions endpoint for a given deployment ID.\n\n\n```python\nimport requests\n\ndef setup_byod(deployment_id: str) -> None:\n    \"\"\"Sets up the OpenAI Python SDK to use your own data for the chat endpoint.\n    \n    :param deployment_id: The deployment ID for the model to use with your own data.\n\n    To remove this configuration, simply set openai.requestssession to None.\n    \"\"\"\n\n    class BringYourOwnDataAdapter(requests.adapters.HTTPAdapter):\n\n        def send(self, request, **kwargs):\n            request.url = f\"{openai.api_base}/openai/deployments/{deployment_id}/extensions/chat/completions?api-version={openai.api_version}\"\n            return super().send(request, **kwargs)\n\n    session = requests.Session()\n\n    # Mount a custom adapter which will use the extensions endpoint for any call using the given `deployment_id`\n    session.mount(\n        prefix=f\"{openai.api_base}/openai/deployments/{deployment_id}\",\n        adapter=BringYourOwnDataAdapter()\n    )\n\n    if use_azure_active_directory:\n        session.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\n    openai.requestssession = session\n\n```\n\nNow we can call the convenience function to configure the SDK with the model we plan to use for our own data.\n\n\n```python\nsetup_byod(\"gpt-4\")\n```\n\nProviding our search endpoint, key, and index name for the `dataSources` keyword argument, any questions posed to the model will now be grounded in our own data. An additional property, `context`, will be provided to show the data the model referenced to answer the question.\n\n\n```python\ncompletion = openai.ChatCompletion.create(\n    messages=[{\"role\": \"user\", \"content\": \"What are the differences between Azure Machine Learning and Azure AI services?"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 1bfe9652-22d3-40fc-83ae-5eb8bde1e1c9
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"1bfe9652-22d3-40fc-83ae-5eb8bde1e1c9\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e20cb4a2-1faa-45ef-8605-b0b2708f32da\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"3c367687fc3fb1a29771b6798e0eb310f778cf5d8873ba04446870dde71b2a75\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"eea60462-a745-43af-9aea-0a22becdd8da\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b8d61ef0c1cb5187e0080b64927a23c58fad5d58d7588785081657fba1783888\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 7913, \"end_char_idx\": 11185, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "```python\nimport requests\n\ndef setup_byod(deployment_id: str) -> None:\n    \"\"\"Sets up the OpenAI Python SDK to use your own data for the chat endpoint.\n    \n    :param deployment_id: The deployment ID for the model to use with your own data.\n\n    To remove this configuration, simply set openai.requestssession to None.\n    \"\"\"\n\n    class BringYourOwnDataAdapter(requests.adapters.HTTPAdapter):\n\n        def send(self, request, **kwargs):\n            request.url = f\"{openai.api_base}/openai/deployments/{deployment_id}/extensions/chat/completions?api-version={openai.api_version}\"\n            return super().send(request, **kwargs)\n\n    session = requests.Session()\n\n    # Mount a custom adapter which will use the extensions endpoint for any call using the given `deployment_id`\n    session.mount(\n        prefix=f\"{openai.api_base}/openai/deployments/{deployment_id}\",\n        adapter=BringYourOwnDataAdapter()\n    )\n\n    if use_azure_active_directory:\n        session.auth = TokenRefresh(default_credential, [\"https://cognitiveservices.azure.com/.default\"])\n\n    openai.requestssession = session\n\n```\n\nNow we can call the convenience function to configure the SDK with the model we plan to use for our own data.\n\n\n```python\nsetup_byod(\"gpt-4\")\n```\n\nProviding our search endpoint, key, and index name for the `dataSources` keyword argument, any questions posed to the model will now be grounded in our own data. An additional property, `context`, will be provided to show the data the model referenced to answer the question.\n\n\n```python\ncompletion = openai.ChatCompletion.create(\n    messages=[{\"role\": \"user\", \"content\": \"What are the differences between Azure Machine Learning and Azure AI services?\"}],\n    deployment_id=\"gpt-4\",\n    dataSources=[  # camelCase is intentional, as this is the format the API expects\n        {\n            \"type\": \"AzureCognitiveSearch\",\n            \"parameters\": {\n                \"endpoint\": os.environ[\"SEARCH_ENDPOINT\"],\n                \"key\": os.environ[\"SEARCH_KEY\"],\n                \"indexName\": os.environ[\"SEARCH_INDEX_NAME\"],\n            }\n        }\n    ]\n)\nprint(completion)\n```\n\n    {\n      \"id\": \"65b485bb-b3c9-48da-8b6f-7d3a219f0b40\",\n      \"model\": \"gpt-4\",\n      \"created\": 1693338769,\n      \"object\": \"extensions.chat.completion\",\n      \"choices\": [\n        {\n          \"index\": 0,\n          \"finish_reason\": \"stop\",\n          \"message\": {\n            \"role\": \"assistant\",\n            \"content\": \"Azure AI services and Azure Machine Learning (AML) both aim to apply artificial intelligence (AI) to enhance business operations, but they target different audiences and offer different capabilities [doc1]. \\n\\nAzure AI services are designed for developers without machine learning experience and provide pre-trained models to solve general problems such as text analysis, image recognition, and natural language processing [doc5]. These services require general knowledge about your data without needing experience with machine learning or data science and provide REST APIs and language-based SDKs [doc2].\\n\\nOn the other hand, Azure Machine Learning is tailored for data scientists and involves a longer process of data collection, cleaning, transformation, algorithm selection, model training, and deployment [doc5]."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: eea60462-a745-43af-9aea-0a22becdd8da
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"eea60462-a745-43af-9aea-0a22becdd8da\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"1bfe9652-22d3-40fc-83ae-5eb8bde1e1c9\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"723fb1040b7acfd33860ac1d158e58480cffce937d5b5d2b507150eccc6061a9\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"c69de95c-b22d-46e6-ba76-850d5fc5b4ad\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"63046365a9134e4d1c9a9407f30b33e3057df13080bbcd1652981f2397624258\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 9444, \"end_char_idx\": 12706, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "```python\ncompletion = openai.ChatCompletion.create(\n    messages=[{\"role\": \"user\", \"content\": \"What are the differences between Azure Machine Learning and Azure AI services?\"}],\n    deployment_id=\"gpt-4\",\n    dataSources=[  # camelCase is intentional, as this is the format the API expects\n        {\n            \"type\": \"AzureCognitiveSearch\",\n            \"parameters\": {\n                \"endpoint\": os.environ[\"SEARCH_ENDPOINT\"],\n                \"key\": os.environ[\"SEARCH_KEY\"],\n                \"indexName\": os.environ[\"SEARCH_INDEX_NAME\"],\n            }\n        }\n    ]\n)\nprint(completion)\n```\n\n    {\n      \"id\": \"65b485bb-b3c9-48da-8b6f-7d3a219f0b40\",\n      \"model\": \"gpt-4\",\n      \"created\": 1693338769,\n      \"object\": \"extensions.chat.completion\",\n      \"choices\": [\n        {\n          \"index\": 0,\n          \"finish_reason\": \"stop\",\n          \"message\": {\n            \"role\": \"assistant\",\n            \"content\": \"Azure AI services and Azure Machine Learning (AML) both aim to apply artificial intelligence (AI) to enhance business operations, but they target different audiences and offer different capabilities [doc1]. \\n\\nAzure AI services are designed for developers without machine learning experience and provide pre-trained models to solve general problems such as text analysis, image recognition, and natural language processing [doc5]. These services require general knowledge about your data without needing experience with machine learning or data science and provide REST APIs and language-based SDKs [doc2].\\n\\nOn the other hand, Azure Machine Learning is tailored for data scientists and involves a longer process of data collection, cleaning, transformation, algorithm selection, model training, and deployment [doc5]. It allows users to create custom solutions for highly specialized and specific problems, requiring familiarity with the subject matter, data, and expertise in data science [doc5].\\n\\nIn summary, Azure AI services offer pre-trained models for developers without machine learning experience, while Azure Machine Learning is designed for data scientists to create custom solutions for specific problems.\",\n            \"end_turn\": true,\n            \"context\": {\n              \"messages\": [\n                {\n                  \"role\": \"tool\",\n                  \"content\": \"{\\\"citations\\\": [{\\\"content\\\": \\\"<h2 id=\\\\\\\"how-are-azure-ai-services-and-azure-machine-learning-aml-similar\\\\\\\">How are Azure AI services and Azure Machine Learning (AML) similar?.</h2>\\\\n<p>Both have the end-goal of applying artificial intelligence (AI) to enhance business operations, though how each provides this in the respective offerings is different..</p>\\\\n<p>Generally, the audiences are different:</p>\\\\n<ul>\\\\n<li>Azure AI services are for developers without machine-learning experience..</li>\\\\n<li>Azure Machine Learning is tailored for data scientists.\\\", \\\"id\\\": null, \\\"title\\\": \\\"Azure AI services and machine learning\\\", \\\"filepath\\\": \\\"cognitive-services-and-machine-learning.md\\\", \\\"url\\\": \\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\", \\\"metadata\\\": {\\\"chunking\\\": \\\"orignal document size=1188. Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: c69de95c-b22d-46e6-ba76-850d5fc5b4ad
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"c69de95c-b22d-46e6-ba76-850d5fc5b4ad\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"eea60462-a745-43af-9aea-0a22becdd8da\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"267fd8556672d5d487d9b342d59bbc42d1e88e4a7c008d5a94a5b09684d2369c\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"ba57447e-5f21-42d9-b5c1-048789570060\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8979ad9c3242d54ffe7da0c085ba892f222e6254642de2eb126c9a64ae38fe8d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 11186, \"end_char_idx\": 15018, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "It allows users to create custom solutions for highly specialized and specific problems, requiring familiarity with the subject matter, data, and expertise in data science [doc5].\\n\\nIn summary, Azure AI services offer pre-trained models for developers without machine learning experience, while Azure Machine Learning is designed for data scientists to create custom solutions for specific problems.\",\n            \"end_turn\": true,\n            \"context\": {\n              \"messages\": [\n                {\n                  \"role\": \"tool\",\n                  \"content\": \"{\\\"citations\\\": [{\\\"content\\\": \\\"<h2 id=\\\\\\\"how-are-azure-ai-services-and-azure-machine-learning-aml-similar\\\\\\\">How are Azure AI services and Azure Machine Learning (AML) similar?.</h2>\\\\n<p>Both have the end-goal of applying artificial intelligence (AI) to enhance business operations, though how each provides this in the respective offerings is different..</p>\\\\n<p>Generally, the audiences are different:</p>\\\\n<ul>\\\\n<li>Azure AI services are for developers without machine-learning experience..</li>\\\\n<li>Azure Machine Learning is tailored for data scientists.\\\", \\\"id\\\": null, \\\"title\\\": \\\"Azure AI services and machine learning\\\", \\\"filepath\\\": \\\"cognitive-services-and-machine-learning.md\\\", \\\"url\\\": \\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\", \\\"metadata\\\": {\\\"chunking\\\": \\\"orignal document size=1188. Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 2/Highlights=30 of size=137\\\"}, \\\"chunk_id\\\": \\\"2\\\"}, {\\\"content\\\": \\\"<td>Convert speech into text and text into natural-sounding speech..Translate from one language to another and enable speaker verification and recognition..</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"https://azure.microsoft.com/services/cognitive-services/directory/vision/\\\\\\\">Vision</a></td>\\\\n<td>Recognize, identify, caption, index, and moderate your pictures, videos, and digital ink content..</td>\\\\n</tr>\\\\n<p></tbody>\\\\n</table></p>\\\\n<p>Use Azure AI services when you:</p>\\\\n<ul>\\\\n<li>Can use a generalized solution..</li>\\\\n</ul>\\\\n<p>Use other machine-learning solutions when you:</p>\\\\n<ul>\\\\n<li>Need to choose the algorithm and need to train on very specific data..</li>\\\\n</ul>\\\\n<h2 id=\\\\\\\"what-is-machine-learning\\\\\\\">What is machine learning?.</h2>\\\\n<p>Machine learning is a concept where you bring together data and an algorithm to solve a specific need..Once the data and algorithm are trained, the output is a model that you can use again with different data..The trained model provides insights based on the new data..</p>\\\\n<p>The process of building a machine learning system requires some knowledge of machine learning or data science..</p>\\\\n<p>Machine learning is provided using <a href=\\\\\\\"/azure/architecture/data-guide/technology-choices/data-science-and-machine-learning?.context=azure%2fmachine-learning%2fstudio%2fcontext%2fml-context\\\\\\\">Azure Machine Learning (AML) products and services</a>..</p>\\\\n<h2 id=\\\\\\\"what-is-an-azure-ai-service\\\\\\\">What is an Azure AI service?.</h2>\\\\n<p>An Azure AI service provides part or all of the components in a machine learning solution: data, algorithm, and trained model..These services are meant to require general knowledge about your data without needing experience with machine learning or data science..These services provide both REST API(s) and language-based SDKs..As a result, you need to have programming language knowledge to use the services..</p>\\\", \\\"id\\\": null, \\\"title\\\": \\\"Azure AI services and machine learning\\\", \\\"filepath\\\": \\\"cognitive-services-and-machine-learning.md\\\", \\\"url\\\": \\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\", \\\"metadata\\\": {\\\"chunking\\\": \\\"orignal document size=1188."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: ba57447e-5f21-42d9-b5c1-048789570060
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"ba57447e-5f21-42d9-b5c1-048789570060\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"c69de95c-b22d-46e6-ba76-850d5fc5b4ad\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"05937b125aea81f5f7951ecfa41f00a09cfd2afd9571cc6e415b3f5378088c8f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4d6690b5-62b4-48a3-898f-dc513c35a534\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"7b49716a9ea6467ef0dd61a5fb6ae837adf9e75c4c59704c00af49d62d93feed\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 15019, \"end_char_idx\": 17882, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 1/Highlights=67 of size=506\\\"}, \\\"chunk_id\\\": \\\"1\\\"}, {\\\"content\\\": \\\"<hr />\\\\n<p>title: Azure AI services and Machine Learning\\\\ntitleSuffix: Azure AI services\\\\ndescription: Learn where Azure AI services fits in with other Azure offerings for machine learning.\\\\nservices: cognitive-services\\\\nmanager: nitinme\\\\nauthor: aahill\\\\nms.author: aahi\\\\nms.service: cognitive-services\\\\nms.topic: conceptual\\\\nms.date: 10/28/2021</p>\\\\n<hr />\\\\n<h1 id=\\\\\\\"azure-ai-services-and-machine-learning\\\\\\\">Azure AI services and machine learning</h1>\\\\n<p>Azure AI services provides machine learning capabilities to solve general problems such as analyzing text for emotional sentiment or analyzing images to recognize objects or faces..You don't need special machine learning or data science knowledge to use these services../what-are-ai-services.md\\\\\\\">Azure AI services</a> is a group of services, each supporting different, generalized prediction capabilities..The services are divided into different categories to help you find the right service..</p>\\\\n<table>\\\\n<thead>\\\\n<tr>\\\\n<th>Service category</th>\\\\n<th>Purpose</th>\\\\n</tr>\\\\n</thead>\\\\n<tbody>\\\\n<tr>\\\\n<td><a href=\\\\\\\"https://azure.microsoft.com/services/cognitive-services/directory/decision/\\\\\\\">Decision</a></td>\\\\n<td>Build apps that surface recommendations for informed and efficient decision-making..</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"https://azure.microsoft.com/services/cognitive-services/directory/lang/\\\\\\\">Language</a></td>\\\\n<td>Allow your apps to process natural language with pre-built scripts, evaluate sentiment and learn how to recognize what users want..</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"https://azure.microsoft.com/services/cognitive-services/directory/search/\\\\\\\">Search</a></td>\\\\n<td>Add Bing Search APIs to your apps and harness the ability to comb billions of webpages, images, videos, and news with a single API call..</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"https://azure.microsoft.com/services/cognitive-services/directory/speech/\\\\\\\">Speech</a></td>\\\", \\\"id\\\": null, \\\"title\\\": \\\"Azure AI services and machine learning\\\", \\\"filepath\\\": \\\"cognitive-services-and-machine-learning.md\\\", \\\"url\\\": \\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\", \\\"metadata\\\": {\\\"chunking\\\": \\\"orignal document size=1188. Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 0/Highlights=63 of size=526\\\"}, \\\"chunk_id\\\": \\\"0\\\"}, {\\\"content\\\": \\\"<p>How is Azure Cognitive Search related to Azure AI services?</p>\\\\n<p><a href=\\\\\\\"../search/search-what-is-azure-search.md\\\\\\\">Azure Cognitive Search</a> is a separate cloud search service that optionally uses Azure AI services to add image and natural language processing to indexing workloads."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 4d6690b5-62b4-48a3-898f-dc513c35a534
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"4d6690b5-62b4-48a3-898f-dc513c35a534\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"ba57447e-5f21-42d9-b5c1-048789570060\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"40a8b5d2ec9f7babf8c0ef6e5fcf94525316a6acae251b83d030b4702b4eefe3\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"dda81d12-c37c-466f-a7de-d82d6b89da4f\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"31d0fc2d74f195d246d675dcf9a658ff9d584c8e090e32185482394725b7e5c9\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 17443, \"end_char_idx\": 20195, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 0/Highlights=63 of size=526\\\"}, \\\"chunk_id\\\": \\\"0\\\"}, {\\\"content\\\": \\\"<p>How is Azure Cognitive Search related to Azure AI services?</p>\\\\n<p><a href=\\\\\\\"../search/search-what-is-azure-search.md\\\\\\\">Azure Cognitive Search</a> is a separate cloud search service that optionally uses Azure AI services to add image and natural language processing to indexing workloads. Azure AI services is exposed in Azure Cognitive Search through <a href=\\\\\\\"../search/cognitive-search-predefined-skills.md\\\\\\\">built-in skills</a> that wrap individual APIs. You can use a free resource for walkthroughs, but plan on creating and attaching a <a href=\\\\\\\"../search/cognitive-search-attach-cognitive-services.md\\\\\\\">billable resource</a> for larger volumes.</p>\\\\n<h2 id=\\\\\\\"how-can-you-use-azure-ai-services\\\\\\\">How can you use Azure AI services?</h2>\\\\n<p>Each service provides information about your data. You can combine services together to chain solutions such as converting speech (audio) to text, translating the text into many languages, then using the translated languages to get answers from a knowledge base. While Azure AI services can be used to create intelligent solutions on their own, they can also be combined with traditional machine learning projects to supplement models or accelerate the development process. </p>\\\\n<p>Azure AI services that provide exported models for other machine learning tools:</p>\\\\n<table>\\\\n<thead>\\\\n<tr>\\\\n<th>Azure AI service</th>\\\\n<th>Model information</th>\\\\n</tr>\\\\n</thead>\\\\n<tbody>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./custom-vision-service/overview.md\\\\\\\">Custom Vision</a></td>\\\\n<td><a href=\\\\\\\"./custom-vision-service/export-model-python.md\\\\\\\">Export</a> for Tensorflow for Android, CoreML for iOS11, ONNX for Windows ML</td>\\\\n</tr>\\\\n</tbody>\\\\n</table>\\\\n<h2 id=\\\\\\\"learn-more\\\\\\\">Learn more</h2>\\\\n<ul>\\\\n<li><a href=\\\\\\\"/azure/architecture/data-guide/technology-choices/data-science-and-machine-learning\\\\\\\">Architecture Guide - What are the machine learning products at Microsoft?</a></li>\\\\n<li><a href=\\\\\\\"../machine-learning/concept-deep-learning-vs-machine-learning.md\\\\\\\">Machine learning - Introduction to deep learning vs. machine learning</a></li>\\\\n</ul>\\\\n<h2 id=\\\\\\\"next-steps\\\\\\\">Next steps</h2>\\\\n<ul>\\\\n<li>Create your Azure AI services resource in the <a href=\\\\\\\"multi-service-resource.md?pivots=azportal\\\\\\\">Azure portal</a> or with <a href=\\\\\\\"./multi-service-resource.md?pivots=azcli\\\\\\\">Azure CLI</a>.</li>\\\\n<li>Learn how to <a href=\\\\\\\"authentication.md\\\\\\\">authenticate</a> with your Azure AI service.</li>\\\\n<li>Use <a href=\\\\\\\"diagnostic-logging.md\\\\\\\">diagnostic logging</a> for issue identification and debugging."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: dda81d12-c37c-466f-a7de-d82d6b89da4f
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"dda81d12-c37c-466f-a7de-d82d6b89da4f\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"4d6690b5-62b4-48a3-898f-dc513c35a534\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a2dcab5bab5c1c2dd8edf37479a56f5e04f58c4959b103a936a08b325891e96e\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"fc5558df-59c3-4d32-8126-0d63330492ab\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b02ac08f4030b5348b2e9c7324f9b74bb33e58ac25ceebe006c9abf92dd1bf7a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": null, \"end_char_idx\": null, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "machine learning</a></li>\\\\n</ul>\\\\n<h2 id=\\\\\\\"next-steps\\\\\\\">Next steps</h2>\\\\n<ul>\\\\n<li>Create your Azure AI services resource in the <a href=\\\\\\\"multi-service-resource.md?pivots=azportal\\\\\\\">Azure portal</a> or with <a href=\\\\\\\"./multi-service-resource.md?pivots=azcli\\\\\\\">Azure CLI</a>.</li>\\\\n<li>Learn how to <a href=\\\\\\\"authentication.md\\\\\\\">authenticate</a> with your Azure AI service.</li>\\\\n<li>Use <a href=\\\\\\\"diagnostic-logging.md\\\\\\\">diagnostic logging</a> for issue identification and debugging. </li>\\\\n<li>Deploy an Azure AI service in a Docker <a href=\\\\\\\"cognitive-services-container-support.md\\\\\\\">container</a>.</li>\\\\n<li>Keep up to date with <a href=\\\\\\\"https://azure.microsoft.com/updates/?product=cognitive-services\\\\\\\">service updates</a>.</li>\\\\n</ul>\\\", \\\"id\\\": null, \\\"title\\\": \\\"Azure AI services and machine learning\\\", \\\"filepath\\\": \\\"cognitive-services-and-machine-learning.md\\\", \\\"url\\\": \\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\", \\\"metadata\\\": {\\\"chunking\\\": \\\"orignal document size=793. Scores=3.3767838 and None.Org Highlight count=69.\\\"}, \\\"chunk_id\\\": \\\"3\\\"}, {\\\"content\\\": \\\"<p>How are Azure AI services different from machine learning?.</p>\\\\n<p>Azure AI services provide a trained model for you.This brings data and an algorithm together, available from a REST API(s) or SDK.An Azure AI service provides answers to general problems such as key phrases in text or item identification in images.</p>\\\\n<p>Machine learning is a process that generally requires a longer period of time to implement successfully.This time is spent on data collection, cleaning, transformation, algorithm selection, model training, and deployment to get to the same level of functionality provided by an Azure AI service.With machine learning, it is possible to provide answers to highly specialized and/or specific problems.Machine learning problems require familiarity with the specific subject matter and data of the problem under consideration, as well as expertise in data science.</p>\\\\n<h2 id=\\\\\\\"what-kind-of-data-do-you-have\\\\\\\">What kind of data do you have?.</h2>\\\\n<p>Azure AI services, as a group of services, can require none, some, or all custom data for the trained model.</p>\\\\n<h3 id=\\\\\\\"no-additional-training-data-required\\\\\\\">No additional training data required</h3>\\\\n<p>Services that provide a fully-trained model can be treated as a <em>opaque box</em>.You don't need to know how they work or what data was used to train them.</p>\\\\n<h3 id=\\\\\\\"some-or-all-training-data-required\\\\\\\">Some or all training data required</h3>\\\\n<p>Some services allow you to bring your own data, then train a model.This allows you to extend the model using the Service's data and algorithm with your own data.The output matches your needs.When you bring your own data, you may need to tag the data in a way specific to the service.For example, if you are training a model to identify flowers, you can provide a catalog of flower images along with the location of the flower in each image to train the model."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: fc5558df-59c3-4d32-8126-0d63330492ab
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"fc5558df-59c3-4d32-8126-0d63330492ab\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"dda81d12-c37c-466f-a7de-d82d6b89da4f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"b4f99c8a9dbf8f52199fa196eeca5a298d7e018bb3f69faf387f2477be468dea\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"82886a20-529b-414e-8b80-93b808ce01c1\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"a7bddc70942f09041900a29c8bcf0ae998ed248bbbd88d5bbda50751604565a3\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": null, \"end_char_idx\": null, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "available from a REST API(s) or SDK.An Azure AI service provides answers to general problems such as key phrases in text or item identification in images.</p>\\\\n<p>Machine learning is a process that generally requires a longer period of time to implement successfully.This time is spent on data collection, cleaning, transformation, algorithm selection, model training, and deployment to get to the same level of functionality provided by an Azure AI service.With machine learning, it is possible to provide answers to highly specialized and/or specific problems.Machine learning problems require familiarity with the specific subject matter and data of the problem under consideration, as well as expertise in data science.</p>\\\\n<h2 id=\\\\\\\"what-kind-of-data-do-you-have\\\\\\\">What kind of data do you have?.</h2>\\\\n<p>Azure AI services, as a group of services, can require none, some, or all custom data for the trained model.</p>\\\\n<h3 id=\\\\\\\"no-additional-training-data-required\\\\\\\">No additional training data required</h3>\\\\n<p>Services that provide a fully-trained model can be treated as a <em>opaque box</em>.You don't need to know how they work or what data was used to train them.</p>\\\\n<h3 id=\\\\\\\"some-or-all-training-data-required\\\\\\\">Some or all training data required</h3>\\\\n<p>Some services allow you to bring your own data, then train a model.This allows you to extend the model using the Service's data and algorithm with your own data.The output matches your needs.When you bring your own data, you may need to tag the data in a way specific to the service.For example, if you are training a model to identify flowers, you can provide a catalog of flower images along with the location of the flower in each image to train the model.These services process significant amounts of model data.</p>\\\\n<h2 id=\\\\\\\"service-requirements-for-the-data-model\\\\\\\">Service requirements for the data model</h2>\\\\n<p>The following data categorizes each service by which kind of data it allows or requires.</p>\\\\n<table>\\\\n<thead>\\\\n<tr>\\\\n<th>Azure AI service</th>\\\\n<th>No training data required</th>\\\\n<th>You provide some or all training data</th>\\\\n<th>Real-time or near real-time data collection</th>\\\\n</tr>\\\\n</thead>\\\\n<tbody>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./LUIS/what-is-luis.md\\\\\\\">Language Understanding (LUIS)</a></td>\\\\n<td></td>\\\\n<td>x</td>\\\\n<td></td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./personalizer/what-is-personalizer.md\\\\\\\">Personalizer</a><sup>1</sup></sup></td>\\\\n<td>x</td>\\\\n<td>x</td>\\\\n<td>x</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./computer-vision/overview.md\\\\\\\">Vision</a></td>\\\\n<td>x</td>\\\\n<td></td>\\\\n<td></td>\\\\n</tr>\\\\n</tbody>\\\\n</table>\\\\n<p><sup>1</sup> Personalizer only needs training data collected by the service (as it operates in real-time) to evaluate your policy and data."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 82886a20-529b-414e-8b80-93b808ce01c1
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"82886a20-529b-414e-8b80-93b808ce01c1\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"fc5558df-59c3-4d32-8126-0d63330492ab\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a0f8be72c38895c4a5440e6d3fb443b235310589ea9f09881251cb3e536a4a9\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"2cceedc1-f15a-4bcd-9525-7f7c3e67dec2\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"7a14c3c2c76b52835756cd93ed995e5c5cfa322049edf65214ed8fb60705fa50\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": null, \"end_char_idx\": null, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "For example, if you are training a model to identify flowers, you can provide a catalog of flower images along with the location of the flower in each image to train the model.These services process significant amounts of model data.</p>\\\\n<h2 id=\\\\\\\"service-requirements-for-the-data-model\\\\\\\">Service requirements for the data model</h2>\\\\n<p>The following data categorizes each service by which kind of data it allows or requires.</p>\\\\n<table>\\\\n<thead>\\\\n<tr>\\\\n<th>Azure AI service</th>\\\\n<th>No training data required</th>\\\\n<th>You provide some or all training data</th>\\\\n<th>Real-time or near real-time data collection</th>\\\\n</tr>\\\\n</thead>\\\\n<tbody>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./LUIS/what-is-luis.md\\\\\\\">Language Understanding (LUIS)</a></td>\\\\n<td></td>\\\\n<td>x</td>\\\\n<td></td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./personalizer/what-is-personalizer.md\\\\\\\">Personalizer</a><sup>1</sup></sup></td>\\\\n<td>x</td>\\\\n<td>x</td>\\\\n<td>x</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./computer-vision/overview.md\\\\\\\">Vision</a></td>\\\\n<td>x</td>\\\\n<td></td>\\\\n<td></td>\\\\n</tr>\\\\n</tbody>\\\\n</table>\\\\n<p><sup>1</sup> Personalizer only needs training data collected by the service (as it operates in real-time) to evaluate your policy and data.</p>\\\\n<h2 id=\\\\\\\"where-can-you-use-azure-ai-services\\\\\\\">Where can you use Azure AI services?.</h2>\\\\n<p>The services are used in any application that can make REST API(s) or SDK calls.Examples of applications include web sites, bots, virtual or mixed reality, desktop and mobile applications.\\\", \\\"id\\\": null, \\\"title\\\": \\\"Azure AI services and machine learning\\\", \\\"filepath\\\": \\\"cognitive-services-and-machine-learning.md\\\", \\\"url\\\": \\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\", \\\"metadata\\\": {\\\"chunking\\\": \\\"orignal document size=1734. Scores=3.1447978 and None.Org Highlight count=66.Filtering to highlight size=891\\\"}, \\\"chunk_id\\\": \\\"4\\\"}], \\\"intent\\\": \\\"[\\\\\\\"What are the differences between Azure Machine Learning and Azure AI services?\\\\\\\"]\\\"}\",\n                  \"end_turn\": false\n                }\n              ]\n            }\n          }\n        }\n      ]\n    }\n\n\nIf you would prefer to stream the response from the model, you can pass the `stream=True` keyword argument:\n\n\n```python\nresponse = openai.ChatCompletion.create(\n    messages=[{\"role\": \"user\", \"content\": \"What are the differences between Azure Machine Learning and Azure AI services?"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 2cceedc1-f15a-4bcd-9525-7f7c3e67dec2
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"2cceedc1-f15a-4bcd-9525-7f7c3e67dec2\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"82886a20-529b-414e-8b80-93b808ce01c1\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"93f17dfee91c6579a3ae0420953ce25c45e772ffacc06dbf1fb0be450ae4f1df\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"00e620df-4936-4cf9-8a95-0ff37532ad92\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b1e286223839899cbd0ebf0b0c77aca33be11af8988cdba56fab51b0a4bf2c91\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": null, \"end_char_idx\": null, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "/computer-vision/overview.md\\\\\\\">Vision</a></td>\\\\n<td>x</td>\\\\n<td></td>\\\\n<td></td>\\\\n</tr>\\\\n</tbody>\\\\n</table>\\\\n<p><sup>1</sup> Personalizer only needs training data collected by the service (as it operates in real-time) to evaluate your policy and data.</p>\\\\n<h2 id=\\\\\\\"where-can-you-use-azure-ai-services\\\\\\\">Where can you use Azure AI services?.</h2>\\\\n<p>The services are used in any application that can make REST API(s) or SDK calls.Examples of applications include web sites, bots, virtual or mixed reality, desktop and mobile applications.\\\", \\\"id\\\": null, \\\"title\\\": \\\"Azure AI services and machine learning\\\", \\\"filepath\\\": \\\"cognitive-services-and-machine-learning.md\\\", \\\"url\\\": \\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\", \\\"metadata\\\": {\\\"chunking\\\": \\\"orignal document size=1734. Scores=3.1447978 and None.Org Highlight count=66.Filtering to highlight size=891\\\"}, \\\"chunk_id\\\": \\\"4\\\"}], \\\"intent\\\": \\\"[\\\\\\\"What are the differences between Azure Machine Learning and Azure AI services?\\\\\\\"]\\\"}\",\n                  \"end_turn\": false\n                }\n              ]\n            }\n          }\n        }\n      ]\n    }\n\n\nIf you would prefer to stream the response from the model, you can pass the `stream=True` keyword argument:\n\n\n```python\nresponse = openai.ChatCompletion.create(\n    messages=[{\"role\": \"user\", \"content\": \"What are the differences between Azure Machine Learning and Azure AI services?\"}],\n    deployment_id=\"gpt-4\",\n    dataSources=[\n        {\n            \"type\": \"AzureCognitiveSearch\",\n            \"parameters\": {\n                \"endpoint\": os.environ[\"SEARCH_ENDPOINT\"],\n                \"key\": os.environ[\"SEARCH_KEY\"],\n                \"indexName\": os.environ[\"SEARCH_INDEX_NAME\"],\n            }\n        }\n    ],\n    stream=True,\n)\n\nfor chunk in response:\n    delta = chunk.choices[0].delta\n\n    if \"role\" in delta:\n        print(\"\\n\"+ delta.role + \": \", end=\"\", flush=True)\n    if \"content\" in delta:\n        print(delta.content, end=\"\", flush=True)\n    if \"context\" in delta:\n        print(f\"Context: {delta.context}\", end=\"\", flush=True)\n```\n\n    Context: {\n      \"messages\": [\n        {\n          \"role\": \"tool\",\n          \"content\": \"{\\\"citations\\\":[{\\\"content\\\":\\\"<h2 id=\\\\\\\"how-are-azure-ai-services-and-azure-machine-learning-aml-similar\\\\\\\">How are Azure AI services and Azure Machine Learning (AML) similar?.</h2>\\\\n<p>Both have the end-goal of applying artificial intelligence (AI) to enhance business operations, though how each provides this in the respective offerings is different..</p>\\\\n<p>Generally, the audiences are different:</p>\\\\n<ul>\\\\n<li>Azure AI services are for developers without machine-learning experience..</li>\\\\n<li>Azure Machine Learning is tailored for data scientists.\\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=1188."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 00e620df-4936-4cf9-8a95-0ff37532ad92
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"00e620df-4936-4cf9-8a95-0ff37532ad92\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"2cceedc1-f15a-4bcd-9525-7f7c3e67dec2\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"4cb991890dd99a0d4115661b6571a1e6755292cb1d4e6c24e0a46add288d85d7\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"6eaf3ffb-abdf-44c8-87dc-14883711fb58\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"bec797742cb75a79d4750cd29ec7a8037baf43a3447d2686de3960ad066a4ac5\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 25096, \"end_char_idx\": 26794, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "\"}],\n    deployment_id=\"gpt-4\",\n    dataSources=[\n        {\n            \"type\": \"AzureCognitiveSearch\",\n            \"parameters\": {\n                \"endpoint\": os.environ[\"SEARCH_ENDPOINT\"],\n                \"key\": os.environ[\"SEARCH_KEY\"],\n                \"indexName\": os.environ[\"SEARCH_INDEX_NAME\"],\n            }\n        }\n    ],\n    stream=True,\n)\n\nfor chunk in response:\n    delta = chunk.choices[0].delta\n\n    if \"role\" in delta:\n        print(\"\\n\"+ delta.role + \": \", end=\"\", flush=True)\n    if \"content\" in delta:\n        print(delta.content, end=\"\", flush=True)\n    if \"context\" in delta:\n        print(f\"Context: {delta.context}\", end=\"\", flush=True)\n```\n\n    Context: {\n      \"messages\": [\n        {\n          \"role\": \"tool\",\n          \"content\": \"{\\\"citations\\\":[{\\\"content\\\":\\\"<h2 id=\\\\\\\"how-are-azure-ai-services-and-azure-machine-learning-aml-similar\\\\\\\">How are Azure AI services and Azure Machine Learning (AML) similar?.</h2>\\\\n<p>Both have the end-goal of applying artificial intelligence (AI) to enhance business operations, though how each provides this in the respective offerings is different..</p>\\\\n<p>Generally, the audiences are different:</p>\\\\n<ul>\\\\n<li>Azure AI services are for developers without machine-learning experience..</li>\\\\n<li>Azure Machine Learning is tailored for data scientists.\\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=1188. Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 6eaf3ffb-abdf-44c8-87dc-14883711fb58
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"6eaf3ffb-abdf-44c8-87dc-14883711fb58\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"00e620df-4936-4cf9-8a95-0ff37532ad92\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"c87ed3e34552bc01a26877f354d12af5559f8e43772af728733acdaead5d029a\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"cb6c8f3e-de6c-41da-8869-32c38e01c3b3\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"2997ab36c5192865ad0730b8e6b6302c062324ee8c8dd511a6034c7ff7948e41\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 25096, \"end_char_idx\": 29091, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "\"}],\n    deployment_id=\"gpt-4\",\n    dataSources=[\n        {\n            \"type\": \"AzureCognitiveSearch\",\n            \"parameters\": {\n                \"endpoint\": os.environ[\"SEARCH_ENDPOINT\"],\n                \"key\": os.environ[\"SEARCH_KEY\"],\n                \"indexName\": os.environ[\"SEARCH_INDEX_NAME\"],\n            }\n        }\n    ],\n    stream=True,\n)\n\nfor chunk in response:\n    delta = chunk.choices[0].delta\n\n    if \"role\" in delta:\n        print(\"\\n\"+ delta.role + \": \", end=\"\", flush=True)\n    if \"content\" in delta:\n        print(delta.content, end=\"\", flush=True)\n    if \"context\" in delta:\n        print(f\"Context: {delta.context}\", end=\"\", flush=True)\n```\n\n    Context: {\n      \"messages\": [\n        {\n          \"role\": \"tool\",\n          \"content\": \"{\\\"citations\\\":[{\\\"content\\\":\\\"<h2 id=\\\\\\\"how-are-azure-ai-services-and-azure-machine-learning-aml-similar\\\\\\\">How are Azure AI services and Azure Machine Learning (AML) similar?.</h2>\\\\n<p>Both have the end-goal of applying artificial intelligence (AI) to enhance business operations, though how each provides this in the respective offerings is different..</p>\\\\n<p>Generally, the audiences are different:</p>\\\\n<ul>\\\\n<li>Azure AI services are for developers without machine-learning experience..</li>\\\\n<li>Azure Machine Learning is tailored for data scientists.\\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=1188. Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 2/Highlights=30 of size=137\\\"},\\\"chunk_id\\\":\\\"2\\\"},{\\\"content\\\":\\\"<td>Convert speech into text and text into natural-sounding speech..Translate from one language to another and enable speaker verification and recognition..</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"https://azure.microsoft.com/services/cognitive-services/directory/vision/\\\\\\\">Vision</a></td>\\\\n<td>Recognize, identify, caption, index, and moderate your pictures, videos, and digital ink content..</td>\\\\n</tr>\\\\n<p></tbody>\\\\n</table></p>\\\\n<p>Use Azure AI services when you:</p>\\\\n<ul>\\\\n<li>Can use a generalized solution..</li>\\\\n</ul>\\\\n<p>Use other machine-learning solutions when you:</p>\\\\n<ul>\\\\n<li>Need to choose the algorithm and need to train on very specific data..</li>\\\\n</ul>\\\\n<h2 id=\\\\\\\"what-is-machine-learning\\\\\\\">What is machine learning?.</h2>\\\\n<p>Machine learning is a concept where you bring together data and an algorithm to solve a specific need..Once the data and algorithm are trained, the output is a model that you can use again with different data..The trained model provides insights based on the new data..</p>\\\\n<p>The process of building a machine learning system requires some knowledge of machine learning or data science..</p>\\\\n<p>Machine learning is provided using <a href=\\\\\\\"/azure/architecture/data-guide/technology-choices/data-science-and-machine-learning?.context=azure%2fmachine-learning%2fstudio%2fcontext%2fml-context\\\\\\\">Azure Machine Learning (AML) products and services</a>..</p>\\\\n<h2 id=\\\\\\\"what-is-an-azure-ai-service\\\\\\\">What is an Azure AI service?.</h2>\\\\n<p>An Azure AI service provides part or all of the components in a machine learning solution: data, algorithm, and trained model..These services are meant to require general knowledge about your data without needing experience with machine learning or data science..These services provide both REST API(s) and language-based SDKs..As a result, you need to have programming language knowledge to use the services..</p>\\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=1188."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: cb6c8f3e-de6c-41da-8869-32c38e01c3b3
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"cb6c8f3e-de6c-41da-8869-32c38e01c3b3\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6eaf3ffb-abdf-44c8-87dc-14883711fb58\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"6bf7385ccef1d9e38231303451f27cdecc05b49285028500bb9b8d3bd7fadf70\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"d7ed90ed-9f51-4649-8b15-d5750d90e108\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"7de260f6d4ca30c8bfb0319281dc8fa16250ea079e43db30af7ed6480cba6a43\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 29092, \"end_char_idx\": 32110, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 1/Highlights=67 of size=506\\\"},\\\"chunk_id\\\":\\\"1\\\"},{\\\"content\\\":\\\"<hr />\\\\n<p>title: Azure AI services and Machine Learning\\\\ntitleSuffix: Azure AI services\\\\ndescription: Learn where Azure AI services fits in with other Azure offerings for machine learning.\\\\nservices: cognitive-services\\\\nmanager: nitinme\\\\nauthor: aahill\\\\nms.author: aahi\\\\nms.service: cognitive-services\\\\nms.topic: conceptual\\\\nms.date: 10/28/2021</p>\\\\n<hr />\\\\n<h1 id=\\\\\\\"azure-ai-services-and-machine-learning\\\\\\\">Azure AI services and machine learning</h1>\\\\n<p>Azure AI services provides machine learning capabilities to solve general problems such as analyzing text for emotional sentiment or analyzing images to recognize objects or faces..You don't need special machine learning or data science knowledge to use these services../what-are-ai-services.md\\\\\\\">Azure AI services</a> is a group of services, each supporting different, generalized prediction capabilities..The services are divided into different categories to help you find the right service..</p>\\\\n<table>\\\\n<thead>\\\\n<tr>\\\\n<th>Service category</th>\\\\n<th>Purpose</th>\\\\n</tr>\\\\n</thead>\\\\n<tbody>\\\\n<tr>\\\\n<td><a href=\\\\\\\"https://azure.microsoft.com/services/cognitive-services/directory/decision/\\\\\\\">Decision</a></td>\\\\n<td>Build apps that surface recommendations for informed and efficient decision-making..</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"https://azure.microsoft.com/services/cognitive-services/directory/lang/\\\\\\\">Language</a></td>\\\\n<td>Allow your apps to process natural language with pre-built scripts, evaluate sentiment and learn how to recognize what users want..</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"https://azure.microsoft.com/services/cognitive-services/directory/search/\\\\\\\">Search</a></td>\\\\n<td>Add Bing Search APIs to your apps and harness the ability to comb billions of webpages, images, videos, and news with a single API call..</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"https://azure.microsoft.com/services/cognitive-services/directory/speech/\\\\\\\">Speech</a></td>\\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=1188. Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 0/Highlights=63 of size=526\\\"},\\\"chunk_id\\\":\\\"0\\\"},{\\\"content\\\":\\\"<p>How is Azure Cognitive Search related to Azure AI services?</p>\\\\n<p><a href=\\\\\\\"../search/search-what-is-azure-search.md\\\\\\\">Azure Cognitive Search</a> is a separate cloud search service that optionally uses Azure AI services to add image and natural language processing to indexing workloads. Azure AI services is exposed in Azure Cognitive Search through <a href=\\\\\\\"../search/cognitive-search-predefined-skills.md\\\\\\\">built-in skills</a> that wrap individual APIs."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: d7ed90ed-9f51-4649-8b15-d5750d90e108
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"d7ed90ed-9f51-4649-8b15-d5750d90e108\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"cb6c8f3e-de6c-41da-8869-32c38e01c3b3\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"73ff500412b2119bc538b08aef94950f338b00c098ae69c2d93cfea4c1e4fd99\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"cab96b85-c858-45dd-bbf1-63e61987e2d4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"0c0bed4ea213b8c8400bf976b61ab85104fbec0dd50ac4804fc9a3988b7b957c\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 31501, \"end_char_idx\": 34249, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "Scores=5.689296 and None.Org Highlight count=160.Filtering to chunk no. 0/Highlights=63 of size=526\\\"},\\\"chunk_id\\\":\\\"0\\\"},{\\\"content\\\":\\\"<p>How is Azure Cognitive Search related to Azure AI services?</p>\\\\n<p><a href=\\\\\\\"../search/search-what-is-azure-search.md\\\\\\\">Azure Cognitive Search</a> is a separate cloud search service that optionally uses Azure AI services to add image and natural language processing to indexing workloads. Azure AI services is exposed in Azure Cognitive Search through <a href=\\\\\\\"../search/cognitive-search-predefined-skills.md\\\\\\\">built-in skills</a> that wrap individual APIs. You can use a free resource for walkthroughs, but plan on creating and attaching a <a href=\\\\\\\"../search/cognitive-search-attach-cognitive-services.md\\\\\\\">billable resource</a> for larger volumes.</p>\\\\n<h2 id=\\\\\\\"how-can-you-use-azure-ai-services\\\\\\\">How can you use Azure AI services?</h2>\\\\n<p>Each service provides information about your data. You can combine services together to chain solutions such as converting speech (audio) to text, translating the text into many languages, then using the translated languages to get answers from a knowledge base. While Azure AI services can be used to create intelligent solutions on their own, they can also be combined with traditional machine learning projects to supplement models or accelerate the development process. </p>\\\\n<p>Azure AI services that provide exported models for other machine learning tools:</p>\\\\n<table>\\\\n<thead>\\\\n<tr>\\\\n<th>Azure AI service</th>\\\\n<th>Model information</th>\\\\n</tr>\\\\n</thead>\\\\n<tbody>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./custom-vision-service/overview.md\\\\\\\">Custom Vision</a></td>\\\\n<td><a href=\\\\\\\"./custom-vision-service/export-model-python.md\\\\\\\">Export</a> for Tensorflow for Android, CoreML for iOS11, ONNX for Windows ML</td>\\\\n</tr>\\\\n</tbody>\\\\n</table>\\\\n<h2 id=\\\\\\\"learn-more\\\\\\\">Learn more</h2>\\\\n<ul>\\\\n<li><a href=\\\\\\\"/azure/architecture/data-guide/technology-choices/data-science-and-machine-learning\\\\\\\">Architecture Guide - What are the machine learning products at Microsoft?</a></li>\\\\n<li><a href=\\\\\\\"../machine-learning/concept-deep-learning-vs-machine-learning.md\\\\\\\">Machine learning - Introduction to deep learning vs. machine learning</a></li>\\\\n</ul>\\\\n<h2 id=\\\\\\\"next-steps\\\\\\\">Next steps</h2>\\\\n<ul>\\\\n<li>Create your Azure AI services resource in the <a href=\\\\\\\"multi-service-resource.md?pivots=azportal\\\\\\\">Azure portal</a> or with <a href=\\\\\\\"./multi-service-resource.md?pivots=azcli\\\\\\\">Azure CLI</a>.</li>\\\\n<li>Learn how to <a href=\\\\\\\"authentication.md\\\\\\\">authenticate</a> with your Azure AI service.</li>\\\\n<li>Use <a href=\\\\\\\"diagnostic-logging.md\\\\\\\">diagnostic logging</a> for issue identification and debugging."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: cab96b85-c858-45dd-bbf1-63e61987e2d4
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"cab96b85-c858-45dd-bbf1-63e61987e2d4\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"d7ed90ed-9f51-4649-8b15-d5750d90e108\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"acc67ba8c453876bb1ad35d24a0f617f6426246ebd809ff0ec1a6a9d2497537f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"356ace9b-8a30-47b4-bbc4-7abcb64d63b0\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"940890d952c47ce6d0e48b62dc26ee5212972543e8268b96044848cd079b2fa8\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": null, \"end_char_idx\": null, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "machine learning</a></li>\\\\n</ul>\\\\n<h2 id=\\\\\\\"next-steps\\\\\\\">Next steps</h2>\\\\n<ul>\\\\n<li>Create your Azure AI services resource in the <a href=\\\\\\\"multi-service-resource.md?pivots=azportal\\\\\\\">Azure portal</a> or with <a href=\\\\\\\"./multi-service-resource.md?pivots=azcli\\\\\\\">Azure CLI</a>.</li>\\\\n<li>Learn how to <a href=\\\\\\\"authentication.md\\\\\\\">authenticate</a> with your Azure AI service.</li>\\\\n<li>Use <a href=\\\\\\\"diagnostic-logging.md\\\\\\\">diagnostic logging</a> for issue identification and debugging. </li>\\\\n<li>Deploy an Azure AI service in a Docker <a href=\\\\\\\"cognitive-services-container-support.md\\\\\\\">container</a>.</li>\\\\n<li>Keep up to date with <a href=\\\\\\\"https://azure.microsoft.com/updates/?product=cognitive-services\\\\\\\">service updates</a>.</li>\\\\n</ul>\\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=793. Scores=3.3767838 and None.Org Highlight count=69.\\\"},\\\"chunk_id\\\":\\\"3\\\"},{\\\"content\\\":\\\"<p>How are Azure AI services different from machine learning?.</p>\\\\n<p>Azure AI services provide a trained model for you.This brings data and an algorithm together, available from a REST API(s) or SDK.An Azure AI service provides answers to general problems such as key phrases in text or item identification in images.</p>\\\\n<p>Machine learning is a process that generally requires a longer period of time to implement successfully.This time is spent on data collection, cleaning, transformation, algorithm selection, model training, and deployment to get to the same level of functionality provided by an Azure AI service.With machine learning, it is possible to provide answers to highly specialized and/or specific problems.Machine learning problems require familiarity with the specific subject matter and data of the problem under consideration, as well as expertise in data science.</p>\\\\n<h2 id=\\\\\\\"what-kind-of-data-do-you-have\\\\\\\">What kind of data do you have?.</h2>\\\\n<p>Azure AI services, as a group of services, can require none, some, or all custom data for the trained model.</p>\\\\n<h3 id=\\\\\\\"no-additional-training-data-required\\\\\\\">No additional training data required</h3>\\\\n<p>Services that provide a fully-trained model can be treated as a <em>opaque box</em>.You don't need to know how they work or what data was used to train them.</p>\\\\n<h3 id=\\\\\\\"some-or-all-training-data-required\\\\\\\">Some or all training data required</h3>\\\\n<p>Some services allow you to bring your own data, then train a model.This allows you to extend the model using the Service's data and algorithm with your own data.The output matches your needs.When you bring your own data, you may need to tag the data in a way specific to the service.For example, if you are training a model to identify flowers, you can provide a catalog of flower images along with the location of the flower in each image to train the model.These services process significant amounts of model data."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 356ace9b-8a30-47b4-bbc4-7abcb64d63b0
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"356ace9b-8a30-47b4-bbc4-7abcb64d63b0\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"cab96b85-c858-45dd-bbf1-63e61987e2d4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a05697a438657bd2c57656442438d5f29aa08dc626ceb745006d5063c467c345\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"3ae64bf2-643a-45d0-97a0-b11327b945c6\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"5ff41f842687bceef9d4ad461c29f6f4371a67c506b5cbaa530a3c88c8fb013b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": null, \"end_char_idx\": null, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "An Azure AI service provides answers to general problems such as key phrases in text or item identification in images.</p>\\\\n<p>Machine learning is a process that generally requires a longer period of time to implement successfully.This time is spent on data collection, cleaning, transformation, algorithm selection, model training, and deployment to get to the same level of functionality provided by an Azure AI service.With machine learning, it is possible to provide answers to highly specialized and/or specific problems.Machine learning problems require familiarity with the specific subject matter and data of the problem under consideration, as well as expertise in data science.</p>\\\\n<h2 id=\\\\\\\"what-kind-of-data-do-you-have\\\\\\\">What kind of data do you have?.</h2>\\\\n<p>Azure AI services, as a group of services, can require none, some, or all custom data for the trained model.</p>\\\\n<h3 id=\\\\\\\"no-additional-training-data-required\\\\\\\">No additional training data required</h3>\\\\n<p>Services that provide a fully-trained model can be treated as a <em>opaque box</em>.You don't need to know how they work or what data was used to train them.</p>\\\\n<h3 id=\\\\\\\"some-or-all-training-data-required\\\\\\\">Some or all training data required</h3>\\\\n<p>Some services allow you to bring your own data, then train a model.This allows you to extend the model using the Service's data and algorithm with your own data.The output matches your needs.When you bring your own data, you may need to tag the data in a way specific to the service.For example, if you are training a model to identify flowers, you can provide a catalog of flower images along with the location of the flower in each image to train the model.These services process significant amounts of model data.</p>\\\\n<h2 id=\\\\\\\"service-requirements-for-the-data-model\\\\\\\">Service requirements for the data model</h2>\\\\n<p>The following data categorizes each service by which kind of data it allows or requires.</p>\\\\n<table>\\\\n<thead>\\\\n<tr>\\\\n<th>Azure AI service</th>\\\\n<th>No training data required</th>\\\\n<th>You provide some or all training data</th>\\\\n<th>Real-time or near real-time data collection</th>\\\\n</tr>\\\\n</thead>\\\\n<tbody>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./LUIS/what-is-luis.md\\\\\\\">Language Understanding (LUIS)</a></td>\\\\n<td></td>\\\\n<td>x</td>\\\\n<td></td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./personalizer/what-is-personalizer.md\\\\\\\">Personalizer</a><sup>1</sup></sup></td>\\\\n<td>x</td>\\\\n<td>x</td>\\\\n<td>x</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./computer-vision/overview.md\\\\\\\">Vision</a></td>\\\\n<td>x</td>\\\\n<td></td>\\\\n<td></td>\\\\n</tr>\\\\n</tbody>\\\\n</table>\\\\n<p><sup>1</sup> Personalizer only needs training data collected by the service (as it operates in real-time) to evaluate your policy and data."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 3ae64bf2-643a-45d0-97a0-b11327b945c6
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"3ae64bf2-643a-45d0-97a0-b11327b945c6\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"356ace9b-8a30-47b4-bbc4-7abcb64d63b0\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"5bc9ad40533b9939bcd352739c7835afe03137699566cfbc6f9d47d1541ea98b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"f634e373-9529-4d54-b0f2-305290b6248e\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"3202515416a0079d3f930ddc20a4afa85dc352479a0af5454ed00aa5b16d4214\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": null, \"end_char_idx\": null, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "For example, if you are training a model to identify flowers, you can provide a catalog of flower images along with the location of the flower in each image to train the model.These services process significant amounts of model data.</p>\\\\n<h2 id=\\\\\\\"service-requirements-for-the-data-model\\\\\\\">Service requirements for the data model</h2>\\\\n<p>The following data categorizes each service by which kind of data it allows or requires.</p>\\\\n<table>\\\\n<thead>\\\\n<tr>\\\\n<th>Azure AI service</th>\\\\n<th>No training data required</th>\\\\n<th>You provide some or all training data</th>\\\\n<th>Real-time or near real-time data collection</th>\\\\n</tr>\\\\n</thead>\\\\n<tbody>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./LUIS/what-is-luis.md\\\\\\\">Language Understanding (LUIS)</a></td>\\\\n<td></td>\\\\n<td>x</td>\\\\n<td></td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./personalizer/what-is-personalizer.md\\\\\\\">Personalizer</a><sup>1</sup></sup></td>\\\\n<td>x</td>\\\\n<td>x</td>\\\\n<td>x</td>\\\\n</tr>\\\\n<tr>\\\\n<td><a href=\\\\\\\"./computer-vision/overview.md\\\\\\\">Vision</a></td>\\\\n<td>x</td>\\\\n<td></td>\\\\n<td></td>\\\\n</tr>\\\\n</tbody>\\\\n</table>\\\\n<p><sup>1</sup> Personalizer only needs training data collected by the service (as it operates in real-time) to evaluate your policy and data.</p>\\\\n<h2 id=\\\\\\\"where-can-you-use-azure-ai-services\\\\\\\">Where can you use Azure AI services?.</h2>\\\\n<p>The services are used in any application that can make REST API(s) or SDK calls.Examples of applications include web sites, bots, virtual or mixed reality, desktop and mobile applications.\\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=1734. Scores=3.1447978 and None.Org Highlight count=66.Filtering to highlight size=891\\\"},\\\"chunk_id\\\":\\\"4\\\"}],\\\"intent\\\":\\\"[\\\\\\\"What are the differences between Azure Machine Learning and Azure AI services?\\\\\\\"]\\\"}\",\n          \"end_turn\": false\n        }\n      ]\n    }\n    assistant: Azure AI services and Azure Machine Learning (AML) both aim to apply artificial intelligence (AI) to enhance business operations, but they target different audiences and offer different capabilities [doc1]. \n    \n    Azure AI services are designed for developers without machine learning experience and provide pre-trained models to solve general problems such as text analysis, image recognition, and natural language processing [doc5]. These services require general knowledge about your data without needing experience with machine learning or data science and provide REST APIs and language-based SDKs [doc2].\n    \n    On the other hand, Azure Machine Learning is tailored for data scientists and offers a platform to build, train, and deploy custom machine learning models [doc1]."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: f634e373-9529-4d54-b0f2-305290b6248e
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb", "title": "Azure chat completion models with your own data (preview)", "tokens": 9636, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"f634e373-9529-4d54-b0f2-305290b6248e\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"9b1f6272-7419-4aff-8f11-399ed5865b9e\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5ffcb818a44482890e35fbf75f880025cebadf69e3b2e423ff4951db64439ce\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"3ae64bf2-643a-45d0-97a0-b11327b945c6\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/azure/archive/chat_with_your_own_data.ipynb\", \"title\": \"Azure chat completion models with your own data (preview)\", \"tokens\": 9636, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0ecea6e855ae93ed8803211a1c1f24e4735051bf7412407a07ac5dfb897b9f91\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": null, \"end_char_idx\": null, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "ref_doc_id": "9b1f6272-7419-4aff-8f11-399ed5865b9e", "chroma:document": "</p>\\\\n<h2 id=\\\\\\\"where-can-you-use-azure-ai-services\\\\\\\">Where can you use Azure AI services?.</h2>\\\\n<p>The services are used in any application that can make REST API(s) or SDK calls.Examples of applications include web sites, bots, virtual or mixed reality, desktop and mobile applications.\\\",\\\"id\\\":null,\\\"title\\\":\\\"Azure AI services and machine learning\\\",\\\"filepath\\\":\\\"cognitive-services-and-machine-learning.md\\\",\\\"url\\\":\\\"https://krpraticstorageacc.blob.core.windows.net/azure-openai/cognitive-services-and-machine-learning.md\\\",\\\"metadata\\\":{\\\"chunking\\\":\\\"orignal document size=1734. Scores=3.1447978 and None.Org Highlight count=66.Filtering to highlight size=891\\\"},\\\"chunk_id\\\":\\\"4\\\"}],\\\"intent\\\":\\\"[\\\\\\\"What are the differences between Azure Machine Learning and Azure AI services?\\\\\\\"]\\\"}\",\n          \"end_turn\": false\n        }\n      ]\n    }\n    assistant: Azure AI services and Azure Machine Learning (AML) both aim to apply artificial intelligence (AI) to enhance business operations, but they target different audiences and offer different capabilities [doc1]. \n    \n    Azure AI services are designed for developers without machine learning experience and provide pre-trained models to solve general problems such as text analysis, image recognition, and natural language processing [doc5]. These services require general knowledge about your data without needing experience with machine learning or data science and provide REST APIs and language-based SDKs [doc2].\n    \n    On the other hand, Azure Machine Learning is tailored for data scientists and offers a platform to build, train, and deploy custom machine learning models [doc1]. It requires knowledge of machine learning or data science and allows users to choose the algorithm and train on very specific data [doc2].\n    \n    In summary, Azure AI services offer pre-trained models for developers without machine learning experience, while Azure Machine Learning is a platform for data scientists to build and deploy custom machine learning models."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 04df1968-31ec-450f-87bb-a2497d4ff02f
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"04df1968-31ec-450f-87bb-a2497d4ff02f\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"e8c53fc7-9710-4e1b-b20a-ee29f8736b8a\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"59b13ccba574a65fddad89c43e9ee813a49c482fc36db59b66e7352709d90877\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 2986, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "# Translate a book written in LaTeX from Slovenian into English\n\nWith permission of the author, we will demonstrate how to translate the book [Euclidean Plane Geometry](https://sites.google.com/site/projektivna/), written by Milan Mitrovi\u0107 from Slovenian into English, without modifying any of the LaTeX commands.\n\nTo achieve this, we will first split the book into chunks, each roughly a page long, then translate each chunk into English, and finally stitch them back together.\n\n## 1. Read in the data\n\n\n```python\nfrom openai import OpenAI\nimport os\nfrom transformers import GPT2Tokenizer\n\nclient = OpenAI(api_key=os.environ.get(\"OPENAI_API_KEY\", \"<your OpenAI API key if you didn't set as an env var>\"))\n\n# OpenAI GPT-2 tokenizer is the same as GPT-3 tokenizer\n# we use it to count the number of tokens in the text\ntokenizer = GPT2Tokenizer.from_pretrained(\"gpt2\")\n\nwith open(\"data/geometry_slovenian.tex\", \"r\") as f:\n    text = f.read()\n```\n\n\n\n\n    1485565\n\n\n\n### 1.1 Count the tokens in each chunk\n\n\n```python\nchunks = text.split('\\n\\n')\nntokens = []\nfor chunk in chunks:\n    ntokens.append(len(tokenizer.encode(chunk)))\nmax(ntokens)\n```\n\n    Token indices sequence length is longer than the specified maximum sequence length for this model (1327 > 1024). Running this sequence through the model will result in indexing errors\n\n\n\n\n\n    1473\n\n\n\nIt turns out that a double newline is a good separator in this case, in order not to break the flow of the text. Also no individual chunk is larger than 1500 tokens. The model we will use is text-davinci-002, which has a limit of 4096 tokens, so we don't need to worry about breaking the chunks down further.\n\nWe will group the shorter chunks into chunks of around 1000 tokens, to increase the coherence of the text, and decrease the frequency of breaks within the text.\n\n\n```python\ndef group_chunks(chunks, ntokens, max_len=1000, hard_max_len=3000):\n    \"\"\"\n    Group very short chunks, to form approximately page long chunks.\n    \"\"\"\n    batches = []\n    cur_batch = \"\"\n    cur_tokens = 0\n    \n    # iterate over chunks, and group the short ones together\n    for chunk, ntoken in zip(chunks, ntokens):\n        # discard chunks that exceed hard max length\n        if ntoken > hard_max_len:\n            print(f\"Warning: Chunk discarded for being too long ({ntoken} tokens > {hard_max_len} token limit). Preview: '{chunk[:50]}...'\")\n            continue\n\n        # if room in current batch, add new chunk\n        if cur_tokens + 1 + ntoken <= max_len:\n            cur_batch += \"\\n\\n\" + chunk\n            cur_tokens += 1 + ntoken  # adds 1 token for the two newlines\n        # otherwise, record the batch and start a new one\n        else:\n            batches.append(cur_batch)\n            cur_batch = chunk\n            cur_tokens = ntoken\n            \n    if cur_batch:  # add the last batch if it's not empty\n        batches.append(cur_batch)\n        \n    return batches\n\n\nchunks = group_chunks(chunks, ntokens)\nlen(chunks)\n```\n\n\n\n\n    869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: e8c53fc7-9710-4e1b-b20a-ee29f8736b8a
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"e8c53fc7-9710-4e1b-b20a-ee29f8736b8a\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"04df1968-31ec-450f-87bb-a2497d4ff02f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"766ea11fc00449d587ae7bc65e7cd92ad729fb4446a8138e4e083940a7821ed5\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"86e75fff-f450-4639-a0cc-ef93c00ac935\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"2b3ed6b41e06d266bd7e812e3757cc9c888fcc18fe5284eca22b8deccf844cac\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1340, \"end_char_idx\": 3987, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "1473\n\n\n\nIt turns out that a double newline is a good separator in this case, in order not to break the flow of the text. Also no individual chunk is larger than 1500 tokens. The model we will use is text-davinci-002, which has a limit of 4096 tokens, so we don't need to worry about breaking the chunks down further.\n\nWe will group the shorter chunks into chunks of around 1000 tokens, to increase the coherence of the text, and decrease the frequency of breaks within the text.\n\n\n```python\ndef group_chunks(chunks, ntokens, max_len=1000, hard_max_len=3000):\n    \"\"\"\n    Group very short chunks, to form approximately page long chunks.\n    \"\"\"\n    batches = []\n    cur_batch = \"\"\n    cur_tokens = 0\n    \n    # iterate over chunks, and group the short ones together\n    for chunk, ntoken in zip(chunks, ntokens):\n        # discard chunks that exceed hard max length\n        if ntoken > hard_max_len:\n            print(f\"Warning: Chunk discarded for being too long ({ntoken} tokens > {hard_max_len} token limit). Preview: '{chunk[:50]}...'\")\n            continue\n\n        # if room in current batch, add new chunk\n        if cur_tokens + 1 + ntoken <= max_len:\n            cur_batch += \"\\n\\n\" + chunk\n            cur_tokens += 1 + ntoken  # adds 1 token for the two newlines\n        # otherwise, record the batch and start a new one\n        else:\n            batches.append(cur_batch)\n            cur_batch = chunk\n            cur_tokens = ntoken\n            \n    if cur_batch:  # add the last batch if it's not empty\n        batches.append(cur_batch)\n        \n    return batches\n\n\nchunks = group_chunks(chunks, ntokens)\nlen(chunks)\n```\n\n\n\n\n    869\n\n\n\nNotice that adding a sample untranslated and translated first command, where only the content of the chapter name needs to be translated, helps to get more consistent results.\n\nThe format of the prompt sent to the model consists of:\n1. A high level instruction to translate only the text, but not commands into the desired language\n2. A sample untranslated command, where only the content of the chapter name needs to be translated\n3. The chunk of text to be translated\n4. The translated sample command from 2, which shows the model the beginning of the translation process\n\nThe expected output is the translated chunk of text.\n\n\n```python\ndef translate_chunk(chunk, model='gpt-3.5-turbo',\n                    dest_language='English',\n                    sample_translation=(\"\\poglavje{Osnove Geometrije} \\label{osn9Geom}\", \"\\poglavje{The basics of Geometry} \\label{osn9Geom}\")\n                    ):\n    prompt = f'''Translate only the text from the following LaTeX document into {dest_language}."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 86e75fff-f450-4639-a0cc-ef93c00ac935
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"86e75fff-f450-4639-a0cc-ef93c00ac935\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e8c53fc7-9710-4e1b-b20a-ee29f8736b8a\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"456a8284cf138f651522370e1fabaf9ec3a9bda636536b68355f2759cbcb4c7f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"3abb6cf8-a326-46db-b2df-8001ecec7e14\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"a782b2ad4c11a9f3d576071942f9dd0e0ff9b280b6d96d7e1d4d340c38a87c98\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2920, \"end_char_idx\": 5561, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "chunks = group_chunks(chunks, ntokens)\nlen(chunks)\n```\n\n\n\n\n    869\n\n\n\nNotice that adding a sample untranslated and translated first command, where only the content of the chapter name needs to be translated, helps to get more consistent results.\n\nThe format of the prompt sent to the model consists of:\n1. A high level instruction to translate only the text, but not commands into the desired language\n2. A sample untranslated command, where only the content of the chapter name needs to be translated\n3. The chunk of text to be translated\n4. The translated sample command from 2, which shows the model the beginning of the translation process\n\nThe expected output is the translated chunk of text.\n\n\n```python\ndef translate_chunk(chunk, model='gpt-3.5-turbo',\n                    dest_language='English',\n                    sample_translation=(\"\\poglavje{Osnove Geometrije} \\label{osn9Geom}\", \"\\poglavje{The basics of Geometry} \\label{osn9Geom}\")\n                    ):\n    prompt = f'''Translate only the text from the following LaTeX document into {dest_language}. Leave all LaTeX commands unchanged\n    \n\"\"\"\n{sample_translation[0]}\n{chunk}\"\"\"\n\n{sample_translation[1]}\n'''\n    response = client.chat.completions.create(\n        messages=[{\"role\": \"user\", \"content\":prompt}],\n        model=model,\n        temperature=0,\n        top_p=1,\n        max_tokens=1500,\n    )\n    result = response.choices[0].message.content.strip()\n    result = result.replace('\"\"\"', '') # remove the double quotes, as we used them to surround the text\n    return result\nprint(translate_chunk(chunks[800], model='gpt-3.5-turbo', dest_language='English'))\n```\n\n    Let $\\mathcal{I}=\\mathcal{S}_{AB} \\circ\\mathcal{S}_{CA}\n        \\circ\\mathcal{S}_{BC}$. By  \\ref{izoZrcdrsprq} is\n        $\\mathcal{I}$ a mirror reflection. Let $A_1$, $B_1$ and $C_1$ be in order the center points of the lines $BC$, $AC$ and $AB$ of the triangle $ABC$.\n        Because it is a right triangle is $\\mathcal{I}(A_1C_1)=A_1C_1$, which\n        means that the line $A_1C_1$ is of this mirror reflection. It is not\n        difficult to prove that for the point $A'_1=\\mathcal{I}(A_1)$ (both\n        lie on the axis $A_1C_1$) is\n        $\\overrightarrow{A_1A'_1}=3\\overrightarrow{A_1C_1}$, so\n        $\\mathcal{I}=\\mathcal{G}_{3\\overrightarrow{A_1C_1}}$.\n    \n    \\item  \\res{Given are the points $A$ and $B$ on the same side of the line\n    $p$.\n    Draw the line  $XY$, which lies on the line $p$ and is consistent\n    with the given line $l$, so that the sum\n    $|AX|+|XY|+|YB|$ is minimal.}\n    \n    Let $A'=\\mathcal{G}_{\\overrightarrow{MN}}(A)$ (where $M,N\\in\n    p$ and $MN\\cong l$)."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 3abb6cf8-a326-46db-b2df-8001ecec7e14
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"3abb6cf8-a326-46db-b2df-8001ecec7e14\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"86e75fff-f450-4639-a0cc-ef93c00ac935\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"8d89189298afddfcd4068a51523e5a9ec6f456ab0101fbc9bb6bdf1762234e36\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"814875e6-4de1-48f0-815d-fb321b8fd9db\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"2da577e8eb02dc10820083d09fc69187f372063153f894a604e6d30ca466bd8a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 4650, \"end_char_idx\": 6713, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "By  \\ref{izoZrcdrsprq} is\n        $\\mathcal{I}$ a mirror reflection. Let $A_1$, $B_1$ and $C_1$ be in order the center points of the lines $BC$, $AC$ and $AB$ of the triangle $ABC$.\n        Because it is a right triangle is $\\mathcal{I}(A_1C_1)=A_1C_1$, which\n        means that the line $A_1C_1$ is of this mirror reflection. It is not\n        difficult to prove that for the point $A'_1=\\mathcal{I}(A_1)$ (both\n        lie on the axis $A_1C_1$) is\n        $\\overrightarrow{A_1A'_1}=3\\overrightarrow{A_1C_1}$, so\n        $\\mathcal{I}=\\mathcal{G}_{3\\overrightarrow{A_1C_1}}$.\n    \n    \\item  \\res{Given are the points $A$ and $B$ on the same side of the line\n    $p$.\n    Draw the line  $XY$, which lies on the line $p$ and is consistent\n    with the given line $l$, so that the sum\n    $|AX|+|XY|+|YB|$ is minimal.}\n    \n    Let $A'=\\mathcal{G}_{\\overrightarrow{MN}}(A)$ (where $M,N\\in\n    p$ and $MN\\cong l$). The point $Y$ is obtained as the intersection of the lines $p$\n    and $X'Y$ (see also example \\ref{HeronProbl}).\n    \n    \\item  \\res{Let $ABC$ be an isosceles right triangle with a right angle at the vertex $A$. What does the composite\n    $\\mathcal{G}_{\\overrightarrow{AB}}\\circ \\mathcal{G}_{\\overrightarrow{CA}}$ represent?}\n    \n    Let $p$ and $q$ be the simetrali of the sides $CA$ and $AB$ of the triangle\n    $ABC$. By  \\ref{izoZrcDrsKompSrOsn} is:\n     $$\\mathcal{G}_{\\overrightarrow{AB}}\\circ\n     \\mathcal{G}_{\\overrightarrow{CA}}=\n     \\mathcal{S}_q\\circ\\mathcal{S}_A\\circ\\mathcal{S}_A\\circ\\mathcal{S}_p=\n     \\mathcal{S}_q\\circ\\mathcal{S}_p.$$ Because $ABC$ is an isosceles\n     right triangle with a right angle at the vertex $A$, the lines $p$ and $q$ are perpendicular and intersect at the center $S$\n     of the hypotenuse $BC$. Therefore\n     $\\mathcal{G}_{\\overrightarrow{AB}}\\circ\n     \\mathcal{G}_{\\overrightarrow{CA}}=\\mathcal{S}_q\n     \\circ\\mathcal{S}_p=\\mathcal{S}_S$.\n    \n    \\item \\res{In the same plane are given the lines\n    $a$, $b$ and $c$.\n    Draw the points $A\\in a$ and $B\\in b$\n    so that $\\mathcal{S}_c(A)=B$.}"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 814875e6-4de1-48f0-815d-fb321b8fd9db
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"814875e6-4de1-48f0-815d-fb321b8fd9db\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"3abb6cf8-a326-46db-b2df-8001ecec7e14\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"3390e3bf7ec5d91e658ff840f6b5949182495eb2653bf80b34d97b001d5dc0a8\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"137c14b3-aaee-4114-a639-02a3096f9f8c\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b16408b18cdb67d6c3acaa8c9af161f4b854c4e53fe8ad745d0096ee85e6b151\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 5685, \"end_char_idx\": 7712, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "\\item  \\res{Let $ABC$ be an isosceles right triangle with a right angle at the vertex $A$. What does the composite\n    $\\mathcal{G}_{\\overrightarrow{AB}}\\circ \\mathcal{G}_{\\overrightarrow{CA}}$ represent?}\n    \n    Let $p$ and $q$ be the simetrali of the sides $CA$ and $AB$ of the triangle\n    $ABC$. By  \\ref{izoZrcDrsKompSrOsn} is:\n     $$\\mathcal{G}_{\\overrightarrow{AB}}\\circ\n     \\mathcal{G}_{\\overrightarrow{CA}}=\n     \\mathcal{S}_q\\circ\\mathcal{S}_A\\circ\\mathcal{S}_A\\circ\\mathcal{S}_p=\n     \\mathcal{S}_q\\circ\\mathcal{S}_p.$$ Because $ABC$ is an isosceles\n     right triangle with a right angle at the vertex $A$, the lines $p$ and $q$ are perpendicular and intersect at the center $S$\n     of the hypotenuse $BC$. Therefore\n     $\\mathcal{G}_{\\overrightarrow{AB}}\\circ\n     \\mathcal{G}_{\\overrightarrow{CA}}=\\mathcal{S}_q\n     \\circ\\mathcal{S}_p=\\mathcal{S}_S$.\n    \n    \\item \\res{In the same plane are given the lines\n    $a$, $b$ and $c$.\n    Draw the points $A\\in a$ and $B\\in b$\n    so that $\\mathcal{S}_c(A)=B$.}\n\n\nWe can see here that this one chunk in particular translates only the text, but leaves LaTeX commands intact.\n\nLet's now translate all the chunks in the book - this will take 2-3 hours, as we're processing requests sequentially.\n\n\n```python\ndest_language = \"English\"\n\ntranslated_chunks = []\nfor i, chunk in enumerate(chunks):\n    print(str(i+1) + \" / \" + str(len(chunks)))\n    # translate each chunk\n    translated_chunks.append(translate_chunk(chunk, model='gpt-3.5-turbo', dest_language=dest_language))\n\n# join the chunks together\nresult = '\\n\\n'.join(translated_chunks)\n\n# save the final result\nwith open(f\"data/geometry_{dest_language}.tex\", \"w\") as f:\n    f.write(result)\n```\n\n    0 / 869\n    1 / 869\n    2 / 869\n    3 / 869\n    4 / 869\n    5 / 869\n    6 / 869\n    7 / 869\n    8 / 869\n    9 / 869\n    10 / 869\n    11 / 869\n    12 / 869\n    13 / 869\n    14 / 869\n    15 / 869\n    16 / 869\n    17 / 869\n    18 / 869\n    19 / 869\n    20 / 869\n    21 / 869\n    22 / 869\n    23 / 869\n    24 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 137c14b3-aaee-4114-a639-02a3096f9f8c
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"137c14b3-aaee-4114-a639-02a3096f9f8c\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"814875e6-4de1-48f0-815d-fb321b8fd9db\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a0be307b6461d667f0415f79dba3500b5b916b3f0921cc6b458a6fe2f43a9d19\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"2d49fda1-8e83-447b-99b7-806f61f56868\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"32968ffc0221049c9f4e367a9c884807c98e401297191d73c9752e6460221452\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 6716, \"end_char_idx\": 8254, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "We can see here that this one chunk in particular translates only the text, but leaves LaTeX commands intact.\n\nLet's now translate all the chunks in the book - this will take 2-3 hours, as we're processing requests sequentially.\n\n\n```python\ndest_language = \"English\"\n\ntranslated_chunks = []\nfor i, chunk in enumerate(chunks):\n    print(str(i+1) + \" / \" + str(len(chunks)))\n    # translate each chunk\n    translated_chunks.append(translate_chunk(chunk, model='gpt-3.5-turbo', dest_language=dest_language))\n\n# join the chunks together\nresult = '\\n\\n'.join(translated_chunks)\n\n# save the final result\nwith open(f\"data/geometry_{dest_language}.tex\", \"w\") as f:\n    f.write(result)\n```\n\n    0 / 869\n    1 / 869\n    2 / 869\n    3 / 869\n    4 / 869\n    5 / 869\n    6 / 869\n    7 / 869\n    8 / 869\n    9 / 869\n    10 / 869\n    11 / 869\n    12 / 869\n    13 / 869\n    14 / 869\n    15 / 869\n    16 / 869\n    17 / 869\n    18 / 869\n    19 / 869\n    20 / 869\n    21 / 869\n    22 / 869\n    23 / 869\n    24 / 869\n    25 / 869\n    26 / 869\n    27 / 869\n    28 / 869\n    29 / 869\n    30 / 869\n    31 / 869\n    32 / 869\n    33 / 869\n    34 / 869\n    35 / 869\n    36 / 869\n    37 / 869\n    38 / 869\n    39 / 869\n    40 / 869\n    41 / 869\n    42 / 869\n    43 / 869\n    44 / 869\n    45 / 869\n    46 / 869\n    47 / 869\n    48 / 869\n    49 / 869\n    50 / 869\n    51 / 869\n    52 / 869\n    53 / 869\n    54 / 869\n    55 / 869\n    56 / 869\n    57 / 869\n    58 / 869\n    59 / 869\n    60 / 869\n    61 / 869\n    62 / 869\n    63 / 869\n    64 / 869\n    65 / 869\n    66 /"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 2d49fda1-8e83-447b-99b7-806f61f56868
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"2d49fda1-8e83-447b-99b7-806f61f56868\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"137c14b3-aaee-4114-a639-02a3096f9f8c\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"8acbbb5c99d74a31967d58286d8dc93a2fa00c28d6fbecf4f94df04d41bc5fb4\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"5b4d301e-5598-4d10-a528-a191635c923f\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"e82aa04c62b0b5257c876b80baffb3a6786686c5d3071f0d97b117acf715a163\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 7678, \"end_char_idx\": 8799, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "22 / 869\n    23 / 869\n    24 / 869\n    25 / 869\n    26 / 869\n    27 / 869\n    28 / 869\n    29 / 869\n    30 / 869\n    31 / 869\n    32 / 869\n    33 / 869\n    34 / 869\n    35 / 869\n    36 / 869\n    37 / 869\n    38 / 869\n    39 / 869\n    40 / 869\n    41 / 869\n    42 / 869\n    43 / 869\n    44 / 869\n    45 / 869\n    46 / 869\n    47 / 869\n    48 / 869\n    49 / 869\n    50 / 869\n    51 / 869\n    52 / 869\n    53 / 869\n    54 / 869\n    55 / 869\n    56 / 869\n    57 / 869\n    58 / 869\n    59 / 869\n    60 / 869\n    61 / 869\n    62 / 869\n    63 / 869\n    64 / 869\n    65 / 869\n    66 / 869\n    67 / 869\n    68 / 869\n    69 / 869\n    70 / 869\n    71 / 869\n    72 / 869\n    73 / 869\n    74 / 869\n    75 / 869\n    76 / 869\n    77 / 869\n    78 / 869\n    79 / 869\n    80 / 869\n    81 / 869\n    82 / 869\n    83 / 869\n    84 / 869\n    85 / 869\n    86 / 869\n    87 / 869\n    88 / 869\n    89 / 869\n    90 / 869\n    91 / 869\n    92 / 869\n    93 / 869\n    94 / 869\n    95 / 869\n    96 / 869\n    97 / 869\n    98 / 869\n    99 / 869\n    100 / 869\n    101 / 869\n    102 / 869\n    103 / 869\n    104 / 869\n    105 / 869\n    106 / 869\n    107 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 5b4d301e-5598-4d10-a528-a191635c923f
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"5b4d301e-5598-4d10-a528-a191635c923f\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"2d49fda1-8e83-447b-99b7-806f61f56868\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"403ca836b4446c10e5a9f00dca6ce214bef0965b49d70e04c5dfa6544e6f98cf\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"5ee294c1-96aa-4310-8d98-228a7786f431\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"590cd9182bc4c9e79a95dc4f5d314ac10eccecaf6b88f6d7f57a86f8a67102f0\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 8224, \"end_char_idx\": 9387, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "64 / 869\n    65 / 869\n    66 / 869\n    67 / 869\n    68 / 869\n    69 / 869\n    70 / 869\n    71 / 869\n    72 / 869\n    73 / 869\n    74 / 869\n    75 / 869\n    76 / 869\n    77 / 869\n    78 / 869\n    79 / 869\n    80 / 869\n    81 / 869\n    82 / 869\n    83 / 869\n    84 / 869\n    85 / 869\n    86 / 869\n    87 / 869\n    88 / 869\n    89 / 869\n    90 / 869\n    91 / 869\n    92 / 869\n    93 / 869\n    94 / 869\n    95 / 869\n    96 / 869\n    97 / 869\n    98 / 869\n    99 / 869\n    100 / 869\n    101 / 869\n    102 / 869\n    103 / 869\n    104 / 869\n    105 / 869\n    106 / 869\n    107 / 869\n    108 / 869\n    109 / 869\n    110 / 869\n    111 / 869\n    112 / 869\n    113 / 869\n    114 / 869\n    115 / 869\n    116 / 869\n    117 / 869\n    118 / 869\n    119 / 869\n    120 / 869\n    121 / 869\n    122 / 869\n    123 / 869\n    124 / 869\n    125 / 869\n    126 / 869\n    127 / 869\n    128 / 869\n    129 / 869\n    130 / 869\n    131 / 869\n    132 / 869\n    133 / 869\n    134 / 869\n    135 / 869\n    136 / 869\n    137 / 869\n    138 / 869\n    139 / 869\n    140 / 869\n    141 / 869\n    142 / 869\n    143 / 869\n    144 / 869\n    145 / 869\n    146 / 869\n    147 / 869\n    148 / 869\n    149 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 5ee294c1-96aa-4310-8d98-228a7786f431
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"5ee294c1-96aa-4310-8d98-228a7786f431\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"5b4d301e-5598-4d10-a528-a191635c923f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"99f34557de3ed8c01ca3b21c248e8a179bc6225dd6b2864a3257a4a83999099b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"db3252a2-0044-4cb4-babd-cd5b1468c571\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"e8e23f1c0469c9cd462a8e0480d776ba2fccda1b1fd0e9b240e9ecc679e73072\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 8766, \"end_char_idx\": 9969, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "/ 869\n    106 / 869\n    107 / 869\n    108 / 869\n    109 / 869\n    110 / 869\n    111 / 869\n    112 / 869\n    113 / 869\n    114 / 869\n    115 / 869\n    116 / 869\n    117 / 869\n    118 / 869\n    119 / 869\n    120 / 869\n    121 / 869\n    122 / 869\n    123 / 869\n    124 / 869\n    125 / 869\n    126 / 869\n    127 / 869\n    128 / 869\n    129 / 869\n    130 / 869\n    131 / 869\n    132 / 869\n    133 / 869\n    134 / 869\n    135 / 869\n    136 / 869\n    137 / 869\n    138 / 869\n    139 / 869\n    140 / 869\n    141 / 869\n    142 / 869\n    143 / 869\n    144 / 869\n    145 / 869\n    146 / 869\n    147 / 869\n    148 / 869\n    149 / 869\n    150 / 869\n    151 / 869\n    152 / 869\n    153 / 869\n    154 / 869\n    155 / 869\n    156 / 869\n    157 / 869\n    158 / 869\n    159 / 869\n    160 / 869\n    161 / 869\n    162 / 869\n    163 / 869\n    164 / 869\n    165 / 869\n    166 / 869\n    167 / 869\n    168 / 869\n    169 / 869\n    170 / 869\n    171 / 869\n    172 / 869\n    173 / 869\n    174 / 869\n    175 / 869\n    176 / 869\n    177 / 869\n    178 / 869\n    179 / 869\n    180 / 869\n    181 / 869\n    182 / 869\n    183 / 869\n    184 / 869\n    185 / 869\n    186 / 869\n    187 / 869\n    188 / 869\n    189 / 869\n    190 / 869\n    191"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: db3252a2-0044-4cb4-babd-cd5b1468c571
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"db3252a2-0044-4cb4-babd-cd5b1468c571\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"5ee294c1-96aa-4310-8d98-228a7786f431\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"204e8139412faff9e686f995f1b979168f5224ecd6fb90297260d64e586eff9a\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"937793f2-8810-478c-b3a3-5741f28179ea\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"bcb271b8953ffa7b245f413f281c7091920ef5ba9d32f905079deae9208336cc\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 9350, \"end_char_idx\": 10549, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "147 / 869\n    148 / 869\n    149 / 869\n    150 / 869\n    151 / 869\n    152 / 869\n    153 / 869\n    154 / 869\n    155 / 869\n    156 / 869\n    157 / 869\n    158 / 869\n    159 / 869\n    160 / 869\n    161 / 869\n    162 / 869\n    163 / 869\n    164 / 869\n    165 / 869\n    166 / 869\n    167 / 869\n    168 / 869\n    169 / 869\n    170 / 869\n    171 / 869\n    172 / 869\n    173 / 869\n    174 / 869\n    175 / 869\n    176 / 869\n    177 / 869\n    178 / 869\n    179 / 869\n    180 / 869\n    181 / 869\n    182 / 869\n    183 / 869\n    184 / 869\n    185 / 869\n    186 / 869\n    187 / 869\n    188 / 869\n    189 / 869\n    190 / 869\n    191 / 869\n    192 / 869\n    193 / 869\n    194 / 869\n    195 / 869\n    196 / 869\n    197 / 869\n    198 / 869\n    199 / 869\n    200 / 869\n    201 / 869\n    202 / 869\n    203 / 869\n    204 / 869\n    205 / 869\n    206 / 869\n    207 / 869\n    208 / 869\n    209 / 869\n    210 / 869\n    211 / 869\n    212 / 869\n    213 / 869\n    214 / 869\n    215 / 869\n    216 / 869\n    217 / 869\n    218 / 869\n    219 / 869\n    220 / 869\n    221 / 869\n    222 / 869\n    223 / 869\n    224 / 869\n    225 / 869\n    226 / 869\n    227 / 869\n    228 / 869\n    229 / 869\n    230 / 869\n    231 / 869\n    232 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 937793f2-8810-478c-b3a3-5741f28179ea
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"937793f2-8810-478c-b3a3-5741f28179ea\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"db3252a2-0044-4cb4-babd-cd5b1468c571\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0646ef54ba569092a6dfd639935524e85e1bca515f37405f7379158e18228a44\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"79b9074e-6dde-4592-b712-25e3d80afc03\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"52555891ac5c03e6ca120301ba820d69a077cdfb20020b5509f70236fcb88660\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 9930, \"end_char_idx\": 11133, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "869\n    189 / 869\n    190 / 869\n    191 / 869\n    192 / 869\n    193 / 869\n    194 / 869\n    195 / 869\n    196 / 869\n    197 / 869\n    198 / 869\n    199 / 869\n    200 / 869\n    201 / 869\n    202 / 869\n    203 / 869\n    204 / 869\n    205 / 869\n    206 / 869\n    207 / 869\n    208 / 869\n    209 / 869\n    210 / 869\n    211 / 869\n    212 / 869\n    213 / 869\n    214 / 869\n    215 / 869\n    216 / 869\n    217 / 869\n    218 / 869\n    219 / 869\n    220 / 869\n    221 / 869\n    222 / 869\n    223 / 869\n    224 / 869\n    225 / 869\n    226 / 869\n    227 / 869\n    228 / 869\n    229 / 869\n    230 / 869\n    231 / 869\n    232 / 869\n    233 / 869\n    234 / 869\n    235 / 869\n    236 / 869\n    237 / 869\n    238 / 869\n    239 / 869\n    240 / 869\n    241 / 869\n    242 / 869\n    243 / 869\n    244 / 869\n    245 / 869\n    246 / 869\n    247 / 869\n    248 / 869\n    249 / 869\n    250 / 869\n    251 / 869\n    252 / 869\n    253 / 869\n    254 / 869\n    255 / 869\n    256 / 869\n    257 / 869\n    258 / 869\n    259 / 869\n    260 / 869\n    261 / 869\n    262 / 869\n    263 / 869\n    264 / 869\n    265 / 869\n    266 / 869\n    267 / 869\n    268 / 869\n    269 / 869\n    270 / 869\n    271 / 869\n    272 / 869\n    273 / 869\n    274 /"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 79b9074e-6dde-4592-b712-25e3d80afc03
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"79b9074e-6dde-4592-b712-25e3d80afc03\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"937793f2-8810-478c-b3a3-5741f28179ea\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"b9f85e575428fd4033a08fab5711093353545ad9a824fde62a8fc84caaf124ef\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4d1fcaa8-3cf4-4b4b-98db-13da55175d6a\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"0030700de747c928a235e445e2c41a386807de3cd66c8da5ca24a6a4b73e7aa3\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 10512, \"end_char_idx\": 11711, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "230 / 869\n    231 / 869\n    232 / 869\n    233 / 869\n    234 / 869\n    235 / 869\n    236 / 869\n    237 / 869\n    238 / 869\n    239 / 869\n    240 / 869\n    241 / 869\n    242 / 869\n    243 / 869\n    244 / 869\n    245 / 869\n    246 / 869\n    247 / 869\n    248 / 869\n    249 / 869\n    250 / 869\n    251 / 869\n    252 / 869\n    253 / 869\n    254 / 869\n    255 / 869\n    256 / 869\n    257 / 869\n    258 / 869\n    259 / 869\n    260 / 869\n    261 / 869\n    262 / 869\n    263 / 869\n    264 / 869\n    265 / 869\n    266 / 869\n    267 / 869\n    268 / 869\n    269 / 869\n    270 / 869\n    271 / 869\n    272 / 869\n    273 / 869\n    274 / 869\n    275 / 869\n    276 / 869\n    277 / 869\n    278 / 869\n    279 / 869\n    280 / 869\n    281 / 869\n    282 / 869\n    283 / 869\n    284 / 869\n    285 / 869\n    286 / 869\n    287 / 869\n    288 / 869\n    289 / 869\n    290 / 869\n    291 / 869\n    292 / 869\n    293 / 869\n    294 / 869\n    295 / 869\n    296 / 869\n    297 / 869\n    298 / 869\n    299 / 869\n    300 / 869\n    301 / 869\n    302 / 869\n    303 / 869\n    304 / 869\n    305 / 869\n    306 / 869\n    307 / 869\n    308 / 869\n    309 / 869\n    310 / 869\n    311 / 869\n    312 / 869\n    313 / 869\n    314 / 869\n    315 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 4d1fcaa8-3cf4-4b4b-98db-13da55175d6a
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"4d1fcaa8-3cf4-4b4b-98db-13da55175d6a\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"79b9074e-6dde-4592-b712-25e3d80afc03\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a118a4ac891d171cecc70db894b52b1fe555c0477b1fecbbe9d47e86b073a8c9\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"3968f983-18b6-480f-beb2-6ef9011363e9\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"93e9195bb4d496b16bc85965c34a26f2ce01e9105738f2e7bc9e1a90d339d5a1\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 11100, \"end_char_idx\": 12299, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "272 / 869\n    273 / 869\n    274 / 869\n    275 / 869\n    276 / 869\n    277 / 869\n    278 / 869\n    279 / 869\n    280 / 869\n    281 / 869\n    282 / 869\n    283 / 869\n    284 / 869\n    285 / 869\n    286 / 869\n    287 / 869\n    288 / 869\n    289 / 869\n    290 / 869\n    291 / 869\n    292 / 869\n    293 / 869\n    294 / 869\n    295 / 869\n    296 / 869\n    297 / 869\n    298 / 869\n    299 / 869\n    300 / 869\n    301 / 869\n    302 / 869\n    303 / 869\n    304 / 869\n    305 / 869\n    306 / 869\n    307 / 869\n    308 / 869\n    309 / 869\n    310 / 869\n    311 / 869\n    312 / 869\n    313 / 869\n    314 / 869\n    315 / 869\n    316 / 869\n    317 / 869\n    318 / 869\n    319 / 869\n    320 / 869\n    321 / 869\n    322 / 869\n    323 / 869\n    324 / 869\n    325 / 869\n    326 / 869\n    327 / 869\n    328 / 869\n    329 / 869\n    330 / 869\n    331 / 869\n    332 / 869\n    333 / 869\n    334 / 869\n    335 / 869\n    336 / 869\n    337 / 869\n    338 / 869\n    339 / 869\n    340 / 869\n    341 / 869\n    342 / 869\n    343 / 869\n    344 / 869\n    345 / 869\n    346 / 869\n    347 / 869\n    348 / 869\n    349 / 869\n    350 / 869\n    351 / 869\n    352 / 869\n    353 / 869\n    354 / 869\n    355 / 869\n    356 / 869\n    357 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 3968f983-18b6-480f-beb2-6ef9011363e9
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"3968f983-18b6-480f-beb2-6ef9011363e9\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"4d1fcaa8-3cf4-4b4b-98db-13da55175d6a\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"9f68ea04484fa0dfdfa074439ae5e5dcbb5a293d6ba480932fd43808c0305254\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"233cca2f-3155-4192-9377-03d0036a17dd\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"1fea04060b673970828412b09b51f969ea47a80ec20e7621126ec93111761c9a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 11678, \"end_char_idx\": 12881, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "/ 869\n    314 / 869\n    315 / 869\n    316 / 869\n    317 / 869\n    318 / 869\n    319 / 869\n    320 / 869\n    321 / 869\n    322 / 869\n    323 / 869\n    324 / 869\n    325 / 869\n    326 / 869\n    327 / 869\n    328 / 869\n    329 / 869\n    330 / 869\n    331 / 869\n    332 / 869\n    333 / 869\n    334 / 869\n    335 / 869\n    336 / 869\n    337 / 869\n    338 / 869\n    339 / 869\n    340 / 869\n    341 / 869\n    342 / 869\n    343 / 869\n    344 / 869\n    345 / 869\n    346 / 869\n    347 / 869\n    348 / 869\n    349 / 869\n    350 / 869\n    351 / 869\n    352 / 869\n    353 / 869\n    354 / 869\n    355 / 869\n    356 / 869\n    357 / 869\n    358 / 869\n    359 / 869\n    360 / 869\n    361 / 869\n    362 / 869\n    363 / 869\n    364 / 869\n    365 / 869\n    366 / 869\n    367 / 869\n    368 / 869\n    369 / 869\n    370 / 869\n    371 / 869\n    372 / 869\n    373 / 869\n    374 / 869\n    375 / 869\n    376 / 869\n    377 / 869\n    378 / 869\n    379 / 869\n    380 / 869\n    381 / 869\n    382 / 869\n    383 / 869\n    384 / 869\n    385 / 869\n    386 / 869\n    387 / 869\n    388 / 869\n    389 / 869\n    390 / 869\n    391 / 869\n    392 / 869\n    393 / 869\n    394 / 869\n    395 / 869\n    396 / 869\n    397 / 869\n    398 / 869\n    399"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 233cca2f-3155-4192-9377-03d0036a17dd
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"233cca2f-3155-4192-9377-03d0036a17dd\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"3968f983-18b6-480f-beb2-6ef9011363e9\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"7eee97a62b79bae58b281075185fd24115325026c8fe7183d7750b518c6d5064\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"1b5e9635-01ee-4435-b662-4c952243553a\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"5d9e63171bf1c3f17841ea92032f13fe24fe572bc35df5ffb2a8f706d9d7cdac\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 12262, \"end_char_idx\": 13461, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "355 / 869\n    356 / 869\n    357 / 869\n    358 / 869\n    359 / 869\n    360 / 869\n    361 / 869\n    362 / 869\n    363 / 869\n    364 / 869\n    365 / 869\n    366 / 869\n    367 / 869\n    368 / 869\n    369 / 869\n    370 / 869\n    371 / 869\n    372 / 869\n    373 / 869\n    374 / 869\n    375 / 869\n    376 / 869\n    377 / 869\n    378 / 869\n    379 / 869\n    380 / 869\n    381 / 869\n    382 / 869\n    383 / 869\n    384 / 869\n    385 / 869\n    386 / 869\n    387 / 869\n    388 / 869\n    389 / 869\n    390 / 869\n    391 / 869\n    392 / 869\n    393 / 869\n    394 / 869\n    395 / 869\n    396 / 869\n    397 / 869\n    398 / 869\n    399 / 869\n    400 / 869\n    401 / 869\n    402 / 869\n    403 / 869\n    404 / 869\n    405 / 869\n    406 / 869\n    407 / 869\n    408 / 869\n    409 / 869\n    410 / 869\n    411 / 869\n    412 / 869\n    413 / 869\n    414 / 869\n    415 / 869\n    416 / 869\n    417 / 869\n    418 / 869\n    419 / 869\n    420 / 869\n    421 / 869\n    422 / 869\n    423 / 869\n    424 / 869\n    425 / 869\n    426 / 869\n    427 / 869\n    428 / 869\n    429 / 869\n    430 / 869\n    431 / 869\n    432 / 869\n    433 / 869\n    434 / 869\n    435 / 869\n    436 / 869\n    437 / 869\n    438 / 869\n    439 / 869\n    440 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 1b5e9635-01ee-4435-b662-4c952243553a
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"1b5e9635-01ee-4435-b662-4c952243553a\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"233cca2f-3155-4192-9377-03d0036a17dd\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"bc06c8aa87f18b2c39a42ab8d2fba26c5eb523e8926b221d83c96fdf5a7fb748\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"b0c8a45d-a263-4dab-9b15-76a987826543\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"000d74d9da6416046430e2811bde2946efc54717907af290c76fbb2c11c8fcf7\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 12842, \"end_char_idx\": 14045, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "869\n    397 / 869\n    398 / 869\n    399 / 869\n    400 / 869\n    401 / 869\n    402 / 869\n    403 / 869\n    404 / 869\n    405 / 869\n    406 / 869\n    407 / 869\n    408 / 869\n    409 / 869\n    410 / 869\n    411 / 869\n    412 / 869\n    413 / 869\n    414 / 869\n    415 / 869\n    416 / 869\n    417 / 869\n    418 / 869\n    419 / 869\n    420 / 869\n    421 / 869\n    422 / 869\n    423 / 869\n    424 / 869\n    425 / 869\n    426 / 869\n    427 / 869\n    428 / 869\n    429 / 869\n    430 / 869\n    431 / 869\n    432 / 869\n    433 / 869\n    434 / 869\n    435 / 869\n    436 / 869\n    437 / 869\n    438 / 869\n    439 / 869\n    440 / 869\n    441 / 869\n    442 / 869\n    443 / 869\n    444 / 869\n    445 / 869\n    446 / 869\n    447 / 869\n    448 / 869\n    449 / 869\n    450 / 869\n    451 / 869\n    452 / 869\n    453 / 869\n    454 / 869\n    455 / 869\n    456 / 869\n    457 / 869\n    458 / 869\n    459 / 869\n    460 / 869\n    461 / 869\n    462 / 869\n    463 / 869\n    464 / 869\n    465 / 869\n    466 / 869\n    467 / 869\n    468 / 869\n    469 / 869\n    470 / 869\n    471 / 869\n    472 / 869\n    473 / 869\n    474 / 869\n    475 / 869\n    476 / 869\n    477 / 869\n    478 / 869\n    479 / 869\n    480 / 869\n    481 / 869\n    482 /"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: b0c8a45d-a263-4dab-9b15-76a987826543
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"b0c8a45d-a263-4dab-9b15-76a987826543\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"1b5e9635-01ee-4435-b662-4c952243553a\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"69399f15f4bab2fa7ba9500d545fa321085380f010ed63628da8040fd57a7183\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"3838a9a1-74ac-4e87-8396-0c3d858919ed\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8ea29681746367447db2c71acc820750c9092636630b7d6a0bdb5d1130e7c76f\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 13424, \"end_char_idx\": 14623, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "438 / 869\n    439 / 869\n    440 / 869\n    441 / 869\n    442 / 869\n    443 / 869\n    444 / 869\n    445 / 869\n    446 / 869\n    447 / 869\n    448 / 869\n    449 / 869\n    450 / 869\n    451 / 869\n    452 / 869\n    453 / 869\n    454 / 869\n    455 / 869\n    456 / 869\n    457 / 869\n    458 / 869\n    459 / 869\n    460 / 869\n    461 / 869\n    462 / 869\n    463 / 869\n    464 / 869\n    465 / 869\n    466 / 869\n    467 / 869\n    468 / 869\n    469 / 869\n    470 / 869\n    471 / 869\n    472 / 869\n    473 / 869\n    474 / 869\n    475 / 869\n    476 / 869\n    477 / 869\n    478 / 869\n    479 / 869\n    480 / 869\n    481 / 869\n    482 / 869\n    483 / 869\n    484 / 869\n    485 / 869\n    486 / 869\n    487 / 869\n    488 / 869\n    489 / 869\n    490 / 869\n    491 / 869\n    492 / 869\n    493 / 869\n    494 / 869\n    495 / 869\n    496 / 869\n    497 / 869\n    498 / 869\n    499 / 869\n    500 / 869\n    501 / 869\n    502 / 869\n    503 / 869\n    504 / 869\n    505 / 869\n    506 / 869\n    507 / 869\n    508 / 869\n    509 / 869\n    510 / 869\n    511 / 869\n    512 / 869\n    513 / 869\n    514 / 869\n    515 / 869\n    516 / 869\n    517 / 869\n    518 / 869\n    519 / 869\n    520 / 869\n    521 / 869\n    522 / 869\n    523 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 3838a9a1-74ac-4e87-8396-0c3d858919ed
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"3838a9a1-74ac-4e87-8396-0c3d858919ed\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"b0c8a45d-a263-4dab-9b15-76a987826543\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"fc7623f761e765577c34a263dd9355aa09c980c512dd49eaa30ab0562a8d1916\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"8c3e4294-d818-4ae3-b71a-e3c0b3beff9e\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"9f4656977b393ed03628a16d6698c146e6a43a6ef9cd3e738e7ed46c06ebafd8\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 14012, \"end_char_idx\": 15211, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "480 / 869\n    481 / 869\n    482 / 869\n    483 / 869\n    484 / 869\n    485 / 869\n    486 / 869\n    487 / 869\n    488 / 869\n    489 / 869\n    490 / 869\n    491 / 869\n    492 / 869\n    493 / 869\n    494 / 869\n    495 / 869\n    496 / 869\n    497 / 869\n    498 / 869\n    499 / 869\n    500 / 869\n    501 / 869\n    502 / 869\n    503 / 869\n    504 / 869\n    505 / 869\n    506 / 869\n    507 / 869\n    508 / 869\n    509 / 869\n    510 / 869\n    511 / 869\n    512 / 869\n    513 / 869\n    514 / 869\n    515 / 869\n    516 / 869\n    517 / 869\n    518 / 869\n    519 / 869\n    520 / 869\n    521 / 869\n    522 / 869\n    523 / 869\n    524 / 869\n    525 / 869\n    526 / 869\n    527 / 869\n    528 / 869\n    529 / 869\n    530 / 869\n    531 / 869\n    532 / 869\n    533 / 869\n    534 / 869\n    535 / 869\n    536 / 869\n    537 / 869\n    538 / 869\n    539 / 869\n    540 / 869\n    541 / 869\n    542 / 869\n    543 / 869\n    544 / 869\n    545 / 869\n    546 / 869\n    547 / 869\n    548 / 869\n    549 / 869\n    550 / 869\n    551 / 869\n    552 / 869\n    553 / 869\n    554 / 869\n    555 / 869\n    556 / 869\n    557 / 869\n    558 / 869\n    559 / 869\n    560 / 869\n    561 / 869\n    562 / 869\n    563 / 869\n    564 / 869\n    565 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 8c3e4294-d818-4ae3-b71a-e3c0b3beff9e
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"8c3e4294-d818-4ae3-b71a-e3c0b3beff9e\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"3838a9a1-74ac-4e87-8396-0c3d858919ed\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"24e8cd3a848b4aad666db9d9fd6033e524e4d0fb3585547912f1c6266e48fc6e\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4c34419c-511f-49e2-a559-a685a1e41128\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"3aef619707a5e237aae88f166547aa28e65b7f14ae9e3f88b88086cf3640d69a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 14590, \"end_char_idx\": 15793, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "/ 869\n    522 / 869\n    523 / 869\n    524 / 869\n    525 / 869\n    526 / 869\n    527 / 869\n    528 / 869\n    529 / 869\n    530 / 869\n    531 / 869\n    532 / 869\n    533 / 869\n    534 / 869\n    535 / 869\n    536 / 869\n    537 / 869\n    538 / 869\n    539 / 869\n    540 / 869\n    541 / 869\n    542 / 869\n    543 / 869\n    544 / 869\n    545 / 869\n    546 / 869\n    547 / 869\n    548 / 869\n    549 / 869\n    550 / 869\n    551 / 869\n    552 / 869\n    553 / 869\n    554 / 869\n    555 / 869\n    556 / 869\n    557 / 869\n    558 / 869\n    559 / 869\n    560 / 869\n    561 / 869\n    562 / 869\n    563 / 869\n    564 / 869\n    565 / 869\n    566 / 869\n    567 / 869\n    568 / 869\n    569 / 869\n    570 / 869\n    571 / 869\n    572 / 869\n    573 / 869\n    574 / 869\n    575 / 869\n    576 / 869\n    577 / 869\n    578 / 869\n    579 / 869\n    580 / 869\n    581 / 869\n    582 / 869\n    583 / 869\n    584 / 869\n    585 / 869\n    586 / 869\n    587 / 869\n    588 / 869\n    589 / 869\n    590 / 869\n    591 / 869\n    592 / 869\n    593 / 869\n    594 / 869\n    595 / 869\n    596 / 869\n    597 / 869\n    598 / 869\n    599 / 869\n    600 / 869\n    601 / 869\n    602 / 869\n    603 / 869\n    604 / 869\n    605 / 869\n    606 / 869\n    607"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 4c34419c-511f-49e2-a559-a685a1e41128
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"4c34419c-511f-49e2-a559-a685a1e41128\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"8c3e4294-d818-4ae3-b71a-e3c0b3beff9e\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"29097cb2430559fd85bc1e756a644f929251cda471ad3d0c96c941e8bb581c21\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"692b6302-9771-4577-a35a-9614c3229858\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"4eb7dc84d1966049a89dbd277efbc9735543079e342e3e7697f46ce9beb00042\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 15174, \"end_char_idx\": 16373, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "563 / 869\n    564 / 869\n    565 / 869\n    566 / 869\n    567 / 869\n    568 / 869\n    569 / 869\n    570 / 869\n    571 / 869\n    572 / 869\n    573 / 869\n    574 / 869\n    575 / 869\n    576 / 869\n    577 / 869\n    578 / 869\n    579 / 869\n    580 / 869\n    581 / 869\n    582 / 869\n    583 / 869\n    584 / 869\n    585 / 869\n    586 / 869\n    587 / 869\n    588 / 869\n    589 / 869\n    590 / 869\n    591 / 869\n    592 / 869\n    593 / 869\n    594 / 869\n    595 / 869\n    596 / 869\n    597 / 869\n    598 / 869\n    599 / 869\n    600 / 869\n    601 / 869\n    602 / 869\n    603 / 869\n    604 / 869\n    605 / 869\n    606 / 869\n    607 / 869\n    608 / 869\n    609 / 869\n    610 / 869\n    611 / 869\n    612 / 869\n    613 / 869\n    614 / 869\n    615 / 869\n    616 / 869\n    617 / 869\n    618 / 869\n    619 / 869\n    620 / 869\n    621 / 869\n    622 / 869\n    623 / 869\n    624 / 869\n    625 / 869\n    626 / 869\n    627 / 869\n    628 / 869\n    629 / 869\n    630 / 869\n    631 / 869\n    632 / 869\n    633 / 869\n    634 / 869\n    635 / 869\n    636 / 869\n    637 / 869\n    638 / 869\n    639 / 869\n    640 / 869\n    641 / 869\n    642 / 869\n    643 / 869\n    644 / 869\n    645 / 869\n    646 / 869\n    647 / 869\n    648 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 692b6302-9771-4577-a35a-9614c3229858
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"692b6302-9771-4577-a35a-9614c3229858\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"4c34419c-511f-49e2-a559-a685a1e41128\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"f8966e9d2b94cc8a9ad1c42bd4826537f1a1ae74906df419ed20f0bd82e07bb4\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"148580a6-4e09-4f10-9270-da6f86073cd4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"1c72a880bc404f2724a4e83a2118591fbae761d0802b59fea943537f2791cf1a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 15754, \"end_char_idx\": 16957, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "869\n    605 / 869\n    606 / 869\n    607 / 869\n    608 / 869\n    609 / 869\n    610 / 869\n    611 / 869\n    612 / 869\n    613 / 869\n    614 / 869\n    615 / 869\n    616 / 869\n    617 / 869\n    618 / 869\n    619 / 869\n    620 / 869\n    621 / 869\n    622 / 869\n    623 / 869\n    624 / 869\n    625 / 869\n    626 / 869\n    627 / 869\n    628 / 869\n    629 / 869\n    630 / 869\n    631 / 869\n    632 / 869\n    633 / 869\n    634 / 869\n    635 / 869\n    636 / 869\n    637 / 869\n    638 / 869\n    639 / 869\n    640 / 869\n    641 / 869\n    642 / 869\n    643 / 869\n    644 / 869\n    645 / 869\n    646 / 869\n    647 / 869\n    648 / 869\n    649 / 869\n    650 / 869\n    651 / 869\n    652 / 869\n    653 / 869\n    654 / 869\n    655 / 869\n    656 / 869\n    657 / 869\n    658 / 869\n    659 / 869\n    660 / 869\n    661 / 869\n    662 / 869\n    663 / 869\n    664 / 869\n    665 / 869\n    666 / 869\n    667 / 869\n    668 / 869\n    669 / 869\n    670 / 869\n    671 / 869\n    672 / 869\n    673 / 869\n    674 / 869\n    675 / 869\n    676 / 869\n    677 / 869\n    678 / 869\n    679 / 869\n    680 / 869\n    681 / 869\n    682 / 869\n    683 / 869\n    684 / 869\n    685 / 869\n    686 / 869\n    687 / 869\n    688 / 869\n    689 / 869\n    690 /"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 148580a6-4e09-4f10-9270-da6f86073cd4
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"148580a6-4e09-4f10-9270-da6f86073cd4\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"692b6302-9771-4577-a35a-9614c3229858\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a6e51f4774e700394d2cea9cb43f56cb482fc96663644bc5be34053375887df0\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"7305675d-5f53-4860-bda9-8fb3c369e1a7\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"a0b1434975fec54653bbbdafec9c1de685047f9e4f3b0bfc9f41c32f83c5fbef\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 16336, \"end_char_idx\": 17535, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "646 / 869\n    647 / 869\n    648 / 869\n    649 / 869\n    650 / 869\n    651 / 869\n    652 / 869\n    653 / 869\n    654 / 869\n    655 / 869\n    656 / 869\n    657 / 869\n    658 / 869\n    659 / 869\n    660 / 869\n    661 / 869\n    662 / 869\n    663 / 869\n    664 / 869\n    665 / 869\n    666 / 869\n    667 / 869\n    668 / 869\n    669 / 869\n    670 / 869\n    671 / 869\n    672 / 869\n    673 / 869\n    674 / 869\n    675 / 869\n    676 / 869\n    677 / 869\n    678 / 869\n    679 / 869\n    680 / 869\n    681 / 869\n    682 / 869\n    683 / 869\n    684 / 869\n    685 / 869\n    686 / 869\n    687 / 869\n    688 / 869\n    689 / 869\n    690 / 869\n    691 / 869\n    692 / 869\n    693 / 869\n    694 / 869\n    695 / 869\n    696 / 869\n    697 / 869\n    698 / 869\n    699 / 869\n    700 / 869\n    701 / 869\n    702 / 869\n    703 / 869\n    704 / 869\n    705 / 869\n    706 / 869\n    707 / 869\n    708 / 869\n    709 / 869\n    710 / 869\n    711 / 869\n    712 / 869\n    713 / 869\n    714 / 869\n    715 / 869\n    716 / 869\n    717 / 869\n    718 / 869\n    719 / 869\n    720 / 869\n    721 / 869\n    722 / 869\n    723 / 869\n    724 / 869\n    725 / 869\n    726 / 869\n    727 / 869\n    728 / 869\n    729 / 869\n    730 / 869\n    731 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 7305675d-5f53-4860-bda9-8fb3c369e1a7
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"7305675d-5f53-4860-bda9-8fb3c369e1a7\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"148580a6-4e09-4f10-9270-da6f86073cd4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"8f571feca8555788d5af0fc26774248a9c6e276e0844aa905b436316311b8cf7\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"f31b09f4-4086-47da-8207-c9e072e3f6ed\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"36e8e598e303b92e9180b4792018d84110ba0d7e356f5681466eddbadf0028eb\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 16924, \"end_char_idx\": 18123, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "688 / 869\n    689 / 869\n    690 / 869\n    691 / 869\n    692 / 869\n    693 / 869\n    694 / 869\n    695 / 869\n    696 / 869\n    697 / 869\n    698 / 869\n    699 / 869\n    700 / 869\n    701 / 869\n    702 / 869\n    703 / 869\n    704 / 869\n    705 / 869\n    706 / 869\n    707 / 869\n    708 / 869\n    709 / 869\n    710 / 869\n    711 / 869\n    712 / 869\n    713 / 869\n    714 / 869\n    715 / 869\n    716 / 869\n    717 / 869\n    718 / 869\n    719 / 869\n    720 / 869\n    721 / 869\n    722 / 869\n    723 / 869\n    724 / 869\n    725 / 869\n    726 / 869\n    727 / 869\n    728 / 869\n    729 / 869\n    730 / 869\n    731 / 869\n    732 / 869\n    733 / 869\n    734 / 869\n    735 / 869\n    736 / 869\n    737 / 869\n    738 / 869\n    739 / 869\n    740 / 869\n    741 / 869\n    742 / 869\n    743 / 869\n    744 / 869\n    745 / 869\n    746 / 869\n    747 / 869\n    748 / 869\n    749 / 869\n    750 / 869\n    751 / 869\n    752 / 869\n    753 / 869\n    754 / 869\n    755 / 869\n    756 / 869\n    757 / 869\n    758 / 869\n    759 / 869\n    760 / 869\n    761 / 869\n    762 / 869\n    763 / 869\n    764 / 869\n    765 / 869\n    766 / 869\n    767 / 869\n    768 / 869\n    769 / 869\n    770 / 869\n    771 / 869\n    772 / 869\n    773 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: f31b09f4-4086-47da-8207-c9e072e3f6ed
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"f31b09f4-4086-47da-8207-c9e072e3f6ed\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"7305675d-5f53-4860-bda9-8fb3c369e1a7\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"fe5cd2ed3e4e0cbab5075b72db5ffbd2af241f285bce689fbc5dada74ea72a6c\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"c921e020-9b68-4aed-bb64-e5e84275f9cd\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"350db7f546bcaa37594aa96547962839bd4713310c25fcac605bd24297ada823\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 17502, \"end_char_idx\": 18705, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "/ 869\n    730 / 869\n    731 / 869\n    732 / 869\n    733 / 869\n    734 / 869\n    735 / 869\n    736 / 869\n    737 / 869\n    738 / 869\n    739 / 869\n    740 / 869\n    741 / 869\n    742 / 869\n    743 / 869\n    744 / 869\n    745 / 869\n    746 / 869\n    747 / 869\n    748 / 869\n    749 / 869\n    750 / 869\n    751 / 869\n    752 / 869\n    753 / 869\n    754 / 869\n    755 / 869\n    756 / 869\n    757 / 869\n    758 / 869\n    759 / 869\n    760 / 869\n    761 / 869\n    762 / 869\n    763 / 869\n    764 / 869\n    765 / 869\n    766 / 869\n    767 / 869\n    768 / 869\n    769 / 869\n    770 / 869\n    771 / 869\n    772 / 869\n    773 / 869\n    774 / 869\n    775 / 869\n    776 / 869\n    777 / 869\n    778 / 869\n    779 / 869\n    780 / 869\n    781 / 869\n    782 / 869\n    783 / 869\n    784 / 869\n    785 / 869\n    786 / 869\n    787 / 869\n    788 / 869\n    789 / 869\n    790 / 869\n    791 / 869\n    792 / 869\n    793 / 869\n    794 / 869\n    795 / 869\n    796 / 869\n    797 / 869\n    798 / 869\n    799 / 869\n    800 / 869\n    801 / 869\n    802 / 869\n    803 / 869\n    804 / 869\n    805 / 869\n    806 / 869\n    807 / 869\n    808 / 869\n    809 / 869\n    810 / 869\n    811 / 869\n    812 / 869\n    813 / 869\n    814 / 869\n    815"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: c921e020-9b68-4aed-bb64-e5e84275f9cd
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"c921e020-9b68-4aed-bb64-e5e84275f9cd\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f31b09f4-4086-47da-8207-c9e072e3f6ed\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"f49a48e326d6c8aafe1018ae912dcbe68e36389409578a84e0113f4ce443816f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"693c3cea-32e0-4a56-8d55-e4f87f8b558e\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"dcfe5736b44210ff7dd9bef0d431aed242da6caa4dc6610586e8d0a185b92c07\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 18086, \"end_char_idx\": 19285, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "771 / 869\n    772 / 869\n    773 / 869\n    774 / 869\n    775 / 869\n    776 / 869\n    777 / 869\n    778 / 869\n    779 / 869\n    780 / 869\n    781 / 869\n    782 / 869\n    783 / 869\n    784 / 869\n    785 / 869\n    786 / 869\n    787 / 869\n    788 / 869\n    789 / 869\n    790 / 869\n    791 / 869\n    792 / 869\n    793 / 869\n    794 / 869\n    795 / 869\n    796 / 869\n    797 / 869\n    798 / 869\n    799 / 869\n    800 / 869\n    801 / 869\n    802 / 869\n    803 / 869\n    804 / 869\n    805 / 869\n    806 / 869\n    807 / 869\n    808 / 869\n    809 / 869\n    810 / 869\n    811 / 869\n    812 / 869\n    813 / 869\n    814 / 869\n    815 / 869\n    816 / 869\n    817 / 869\n    818 / 869\n    819 / 869\n    820 / 869\n    821 / 869\n    822 / 869\n    823 / 869\n    824 / 869\n    825 / 869\n    826 / 869\n    827 / 869\n    828 / 869\n    829 / 869\n    830 / 869\n    831 / 869\n    832 / 869\n    833 / 869\n    834 / 869\n    835 / 869\n    836 / 869\n    837 / 869\n    838 / 869\n    839 / 869\n    840 / 869\n    841 / 869\n    842 / 869\n    843 / 869\n    844 / 869\n    845 / 869\n    846 / 869\n    847 / 869\n    848 / 869\n    849 / 869\n    850 / 869\n    851 / 869\n    852 / 869\n    853 / 869\n    854 / 869\n    855 / 869\n    856 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 693c3cea-32e0-4a56-8d55-e4f87f8b558e
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb", "title": "Translate a book written in LaTeX from Slovenian into English", "tokens": 8114, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"693c3cea-32e0-4a56-8d55-e4f87f8b558e\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"ad421ac5-73f9-4b31-8f8e-aa07b5c3829f\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e8673e7bb6f84df1ef3c7408e95992d51bd540e2432875166d4aa93603de1\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"c921e020-9b68-4aed-bb64-e5e84275f9cd\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/book_translation/translate_latex_book.ipynb\", \"title\": \"Translate a book written in LaTeX from Slovenian into English\", \"tokens\": 8114, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"b132c767b684bee1a079a2b7133925aa6f11175f43495d3ffedf176e471cd396\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 18666, \"end_char_idx\": 19453, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "ref_doc_id": "ad421ac5-73f9-4b31-8f8e-aa07b5c3829f", "chroma:document": "869\n    813 / 869\n    814 / 869\n    815 / 869\n    816 / 869\n    817 / 869\n    818 / 869\n    819 / 869\n    820 / 869\n    821 / 869\n    822 / 869\n    823 / 869\n    824 / 869\n    825 / 869\n    826 / 869\n    827 / 869\n    828 / 869\n    829 / 869\n    830 / 869\n    831 / 869\n    832 / 869\n    833 / 869\n    834 / 869\n    835 / 869\n    836 / 869\n    837 / 869\n    838 / 869\n    839 / 869\n    840 / 869\n    841 / 869\n    842 / 869\n    843 / 869\n    844 / 869\n    845 / 869\n    846 / 869\n    847 / 869\n    848 / 869\n    849 / 869\n    850 / 869\n    851 / 869\n    852 / 869\n    853 / 869\n    854 / 869\n    855 / 869\n    856 / 869\n    857 / 869\n    858 / 869\n    859 / 869\n    860 / 869\n    861 / 869\n    862 / 869\n    863 / 869\n    864 / 869\n    865 / 869\n    866 / 869\n    867 / 869\n    868 / 869"}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 547ea539-fe25-4394-8682-ab27e7dd4e0f
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb", "title": "3. Train a fine-tuning model specialized for Q&A", "tokens": 3706, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"547ea539-fe25-4394-8682-ab27e7dd4e0f\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"d678dd15-f627-407c-881b-3f384b1d9028\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"f254b8aa71e3e1906f07ce37ffb70b3c250910fc2ccc3f31ca144d7e478357e4\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"a2ee2568-77fc-4251-ab2d-0c88b1a38072\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"449b3241257ca1cb72749d8fed1cfd30ec0751c3a75e96bf390c9bc867ecbb9d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 2466, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d678dd15-f627-407c-881b-3f384b1d9028", "doc_id": "d678dd15-f627-407c-881b-3f384b1d9028", "ref_doc_id": "d678dd15-f627-407c-881b-3f384b1d9028", "chroma:document": "<span style=\"color:orange; font-weight:bold\">Note: To answer questions based on text documents, we recommend the procedure in <a href=\"https://github.com/openai/openai-cookbook/blob/main/examples/Question_answering_using_embeddings.ipynb\">Question Answering using Embeddings</a>. Some of the code below may rely on <a href=\"https://github.com/openai/openai-cookbook/tree/main/transition_guides_for_deprecated_API_endpoints\">deprecated API endpoints</a>.</span>\n\n# 3. Train a fine-tuning model specialized for Q&A\nThis notebook will utilize the dataset of context, question and answer pairs to additionally create adversarial questions and context pairs, where the question was not generated on that context. In those cases the model will be prompted to answer \"No sufficient context for answering the question\". We will also train a discriminator model, which predicts whether the question can be answered based on the context or not.\n\nWe will add hard adversarial examples as well, which will be based either on semantically similar sections, or neighbouring sections, originating from the same article.\n\n\n```python\nimport openai\nimport pandas as pd\ndf = pd.read_csv('olympics-data/olympics_qa.csv')\nolympics_search_fileid = \"file-c3shd8wqF3vSCKaukW4Jr1TT\"\ndf.head()\n```\n\n\n\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>title</th>\n      <th>heading</th>\n      <th>content</th>\n      <th>tokens</th>\n      <th>context</th>\n      <th>questions</th>\n      <th>answers</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>2020 Summer Olympics</td>\n      <td>Summary</td>\n      <td>The 2020 Summer Olympics (Japanese: 2020\u5e74\u590f\u5b63\u30aa\u30ea\u30f3...</td>\n      <td>713</td>\n      <td>2020 Summer Olympics\\nSummary\\n\\nThe 2020 Summ...</td>\n      <td>1. What is the 2020 Summer Olympics?\\n2. When ...</td>\n      <td>1. The 2020 Summer Olympics is an internationa...</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2020 Summer Olympics</td>\n      <td>Host city selection</td>\n      <td>The International Olympic Committee (IOC) vote...</td>\n      <td>126</td>\n      <td>2020 Summer Olympics\\nHost city selection\\n\\nT...</td>\n      <td>1. \\n2. \\n3. \\n4.</td>\n      <td>1."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: a2ee2568-77fc-4251-ab2d-0c88b1a38072
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb", "title": "3. Train a fine-tuning model specialized for Q&A", "tokens": 3706, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"a2ee2568-77fc-4251-ab2d-0c88b1a38072\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"d678dd15-f627-407c-881b-3f384b1d9028\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"f254b8aa71e3e1906f07ce37ffb70b3c250910fc2ccc3f31ca144d7e478357e4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"547ea539-fe25-4394-8682-ab27e7dd4e0f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"d1ce3341ada6351811320c9b3c34779b231b2f0cfed54786fd7368f9dfa9981b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"7715fc97-fd5e-4002-a9da-1197c4b59295\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"f12c67abb246a9f846d950c368a933c933fe9360d9809f903f302b6f620653cd\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1276, \"end_char_idx\": 3670, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d678dd15-f627-407c-881b-3f384b1d9028", "doc_id": "d678dd15-f627-407c-881b-3f384b1d9028", "ref_doc_id": "d678dd15-f627-407c-881b-3f384b1d9028", "chroma:document": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>title</th>\n      <th>heading</th>\n      <th>content</th>\n      <th>tokens</th>\n      <th>context</th>\n      <th>questions</th>\n      <th>answers</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>2020 Summer Olympics</td>\n      <td>Summary</td>\n      <td>The 2020 Summer Olympics (Japanese: 2020\u5e74\u590f\u5b63\u30aa\u30ea\u30f3...</td>\n      <td>713</td>\n      <td>2020 Summer Olympics\\nSummary\\n\\nThe 2020 Summ...</td>\n      <td>1. What is the 2020 Summer Olympics?\\n2. When ...</td>\n      <td>1. The 2020 Summer Olympics is an internationa...</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2020 Summer Olympics</td>\n      <td>Host city selection</td>\n      <td>The International Olympic Committee (IOC) vote...</td>\n      <td>126</td>\n      <td>2020 Summer Olympics\\nHost city selection\\n\\nT...</td>\n      <td>1. \\n2. \\n3. \\n4.</td>\n      <td>1. What is the International Olympic Committee...</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2020 Summer Olympics</td>\n      <td>Impact of the COVID-19 pandemic</td>\n      <td>In January 2020, concerns were raised about th...</td>\n      <td>369</td>\n      <td>2020 Summer Olympics\\nImpact of the COVID-19 p...</td>\n      <td>1. What was the COVID-19 pandemic?\\n2. How did...</td>\n      <td>1. The COVID-19 pandemic was a pandemic that o...</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>2020 Summer Olympics</td>\n      <td>Qualifying event cancellation and postponement</td>\n      <td>Concerns about the pandemic began to affect qu...</td>\n      <td>298</td>\n      <td>2020 Summer Olympics\\nQualifying event cancell...</td>\n      <td>1. What was the original location of the Asia ...</td>\n      <td>1. The original location of the Asia &amp; Oceania...</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>2020 Summer Olympics</td>\n      <td>Effect on doping tests</td>\n      <td>Mandatory doping tests were being severely res...</td>\n      <td>163</td>\n      <td>2020 Summer Olympics\\nEffect on doping tests\\n...</td>\n      <td>1. What was the COVID-19 pandemic?\\n2. What di...</td>\n      <td>1."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 7715fc97-fd5e-4002-a9da-1197c4b59295
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb", "title": "3. Train a fine-tuning model specialized for Q&A", "tokens": 3706, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"7715fc97-fd5e-4002-a9da-1197c4b59295\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"d678dd15-f627-407c-881b-3f384b1d9028\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"f254b8aa71e3e1906f07ce37ffb70b3c250910fc2ccc3f31ca144d7e478357e4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"a2ee2568-77fc-4251-ab2d-0c88b1a38072\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"fa18bbfccc43c200190693145fa25609d4b94ae459a4ab8b083903b7298aca91\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"25f7ab39-e8d9-4d63-803e-bc8edcef554a\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"85546658aff985b4d27e4eee28ab43cccb8c549be21360871bda44c87310aeed\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2434, \"end_char_idx\": 5075, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d678dd15-f627-407c-881b-3f384b1d9028", "doc_id": "d678dd15-f627-407c-881b-3f384b1d9028", "ref_doc_id": "d678dd15-f627-407c-881b-3f384b1d9028", "chroma:document": "\\n2. \\n3. \\n4.</td>\n      <td>1. What is the International Olympic Committee...</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2020 Summer Olympics</td>\n      <td>Impact of the COVID-19 pandemic</td>\n      <td>In January 2020, concerns were raised about th...</td>\n      <td>369</td>\n      <td>2020 Summer Olympics\\nImpact of the COVID-19 p...</td>\n      <td>1. What was the COVID-19 pandemic?\\n2. How did...</td>\n      <td>1. The COVID-19 pandemic was a pandemic that o...</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>2020 Summer Olympics</td>\n      <td>Qualifying event cancellation and postponement</td>\n      <td>Concerns about the pandemic began to affect qu...</td>\n      <td>298</td>\n      <td>2020 Summer Olympics\\nQualifying event cancell...</td>\n      <td>1. What was the original location of the Asia ...</td>\n      <td>1. The original location of the Asia &amp; Oceania...</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>2020 Summer Olympics</td>\n      <td>Effect on doping tests</td>\n      <td>Mandatory doping tests were being severely res...</td>\n      <td>163</td>\n      <td>2020 Summer Olympics\\nEffect on doping tests\\n...</td>\n      <td>1. What was the COVID-19 pandemic?\\n2. What di...</td>\n      <td>1. The COVID-19 pandemic was a pandemic that o...</td>\n    </tr>\n  </tbody>\n</table>\n</div>\n\n\n\nSplit the sections into a training and testing set\n\n\n```python\nfrom sklearn.model_selection import train_test_split\ntrain_df, test_df = train_test_split(df, test_size=0.2, random_state=42)\nlen(train_df), len(test_df)\n```\n\n\n\n\n    (3014, 754)\n\n\n\nwe check that the separator we intend to use isn't present within the contexts\n\n\n```python\ndf.context.str.contains('->').sum()\n```\n\n\n\n\n    0\n\n\n\n## 3.1 Create the fine-tuning datasets for Q&A and discriminator models\nThe fine-tuning dataset is created in the following way. For every corresponding question, answer and context pair we create:\n- Positive example: correct question, answer, context pair\n- Negative examples:\n  - random negative example, where the random context is paired with the question \n  - two hard negative examples\n    - one originating from the same wikipedia article\n    - another, which is most similar to the correct context\n\nThis process is noisy, as sometimes the question might be answerable given a different context, but on average we hope this won't affect the performance too much.\n\nWe apply the same process of dataset creation for both the discriminator, and the Q&A answering model. We apply the process separately for the training and testing set, to ensure that the examples from the training set don't feature within the test set."}


created_at: 2024-08-26 20:31:29
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 25f7ab39-e8d9-4d63-803e-bc8edcef554a
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb", "title": "3. Train a fine-tuning model specialized for Q&A", "tokens": 3706, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"25f7ab39-e8d9-4d63-803e-bc8edcef554a\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"excluded_embed_metadata_keys\": [\"url\", \"tokens\", \"retrieve_doc\", \"source\"], \"excluded_llm_metadata_keys\": [\"title\", \"tokens\", \"retrieve_doc\", \"source\"], \"relationships\": {\"1\": {\"node_id\": \"d678dd15-f627-407c-881b-3f384b1d9028\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"f254b8aa71e3e1906f07ce37ffb70b3c250910fc2ccc3f31ca144d7e478357e4\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"7715fc97-fd5e-4002-a9da-1197c4b59295\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb\", \"title\": \"3. Train a fine-tuning model specialized for Q&A\", \"tokens\": 3706, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"d4e009f49cbefb5395ffbcbf880db7fef123375970d873385f046aa9359e2dc2\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"5255a6a8-54d9-4d12-8353-83905e991e98\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"733bf2b599de79aef180c1639506e25efc36cd90590dc885243e4fe29e061b32\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 3606, \"end_char_idx\": 6839, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d678dd15-f627-407c-881b-3f384b1d9028", "doc_id": "d678dd15-f627-407c-881b-3f384b1d9028", "ref_doc_id": "d678dd15-f627-407c-881b-3f384b1d9028", "chroma:document": "What was the COVID-19 pandemic?\\n2. What di...</td>\n      <td>1. The COVID-19 pandemic was a pandemic that o...</td>\n    </tr>\n  </tbody>\n</table>\n</div>\n\n\n\nSplit the sections into a training and testing set\n\n\n```python\nfrom sklearn.model_selection import train_test_split\ntrain_df, test_df = train_test_split(df, test_size=0.2, random_state=42)\nlen(train_df), len(test_df)\n```\n\n\n\n\n    (3014, 754)\n\n\n\nwe check that the separator we intend to use isn't present within the contexts\n\n\n```python\ndf.context.str.contains('->').sum()\n```\n\n\n\n\n    0\n\n\n\n## 3.1 Create the fine-tuning datasets for Q&A and discriminator models\nThe fine-tuning dataset is created in the following way. For every corresponding question, answer and context pair we create:\n- Positive example: correct question, answer, context pair\n- Negative examples:\n  - random negative example, where the random context is paired with the question \n  - two hard negative examples\n    - one originating from the same wikipedia article\n    - another, which is most similar to the correct context\n\nThis process is noisy, as sometimes the question might be answerable given a different context, but on average we hope this won't affect the performance too much.\n\nWe apply the same process of dataset creation for both the discriminator, and the Q&A answering model. We apply the process separately for the training and testing set, to ensure that the examples from the training set don't feature within the test set.\n\n\n```python\nimport random\n\ndef get_random_similar_contexts(question, context, file_id=olympics_search_fileid, search_model='ada', max_rerank=10):\n    \"\"\"\n    Find similar contexts to the given context using the search file\n    \"\"\"\n    try:\n        # TODO: openai.Engine(search_model) is deprecated\n        results = openai.Engine(search_model).search(\n            search_model=search_model, \n            query=question, \n            max_rerank=max_rerank,\n            file=file_id\n        )\n        candidates = []\n        for result in results['data'][:3]:\n            if result['text'] == context:\n                continue\n            candidates.append(result['text'])\n        random_candidate = random.choice(candidates)\n        return random_candidate\n    except Exception as e:\n        print(e)\n        return \"\"\n\ndef create_fine_tuning_dataset(df, discriminator=False, n_negative=1, add_related=False):\n    \"\"\"\n    Create a dataset for fine tuning the OpenAI model; either for a discriminator model, \n    or a model specializing in Q&A, where it says if no relevant context is found.\n\n    Parameters\n    ----------\n    df: pd.DataFrame\n        The dataframe containing the question, answer and context pairs\n    discriminator: bool\n        Whether to create a dataset for the discriminator\n    n_negative: int\n        The number of random negative samples to add (using a random context)\n    add_related: bool\n        Whether to add the related contexts to the correct context. These are hard negative examples\n\n    Returns\n    -------\n    pd.DataFrame\n        The dataframe containing the prompts and completions, ready for fine-tuning\n    \"\"\"\n    rows = []\n    for i, row in df.iterrows():\n        for q, a in zip((\"1.\" + row.questions).split('\\n'), (\"1.\""}


