# embeddings_queue

created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 76ae0eb6-adfc-4474-aadf-eb49f870c33c
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb", "title": "Structured Outputs for Multi-Agent Systems", "tokens": 5044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"76ae0eb6-adfc-4474-aadf-eb49f870c33c\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"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\": \"0f8ad10f-0d8c-4e3d-8815-d40cce7a9577\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"fe1af06febe25208ec0c4afc1b80b6117753c8e698e0a38b78ab9c14c19a6c43\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6b0d6c2f-32c2-43a7-b92b-f46d74b33122\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"b340e7f352cd54c3c071ef2906c1ff6527231192c61ecedef1c9a5041fca6d7f\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"75ca3f91-ab78-4010-b9b2-8d1fcd2d2aba\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8a9b73fdf95bbefe86d0eaac4e51e7566eda84e6159afdd6cc69dc035444d864\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 12547, \"end_char_idx\": 15663, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "ref_doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "chroma:document": "```python\n# Example query\n\nuser_query = \"\"\"\nBelow is some data. I want you to first remove the duplicates then analyze the statistics of the data as well as plot a line chart.\n\nhouse_size (m3), house_price ($)\n90, 100\n80, 90\n100, 120\n90, 100\n\"\"\"\n\n```\n\nFrom the user query, we can infer that the tools we would need to call are `clean_data`, `start_analysis` and `use_line_chart`.\n\nWe will first define the execution function which runs tool calls.\n\nThis maps a tool call to the corresponding function. It then appends the output of the function to the conversation history.\n\n\n```python\ndef clean_data(data):\n    data_io = StringIO(data)\n    df = pd.read_csv(data_io, sep=\",\")\n    df_deduplicated = df.drop_duplicates()\n    return df_deduplicated\n\ndef stat_analysis(data):\n    data_io = StringIO(data)\n    df = pd.read_csv(data_io, sep=\",\")\n    return df.describe()\n\ndef plot_line_chart(data):\n    data_io = StringIO(data)\n    df = pd.read_csv(data_io, sep=\",\")\n    \n    x = df.iloc[:, 0]\n    y = df.iloc[:, 1]\n    \n    coefficients = np.polyfit(x, y, 1)\n    polynomial = np.poly1d(coefficients)\n    y_fit = polynomial(x)\n    \n    plt.figure(figsize=(10, 6))\n    plt.plot(x, y, 'o', label='Data Points')\n    plt.plot(x, y_fit, '-', label='Best Fit Line')\n    plt.title('Line Chart with Best Fit Line')\n    plt.xlabel(df.columns[0])\n    plt.ylabel(df.columns[1])\n    plt.legend()\n    plt.grid(True)\n    plt.show()\n\n# Define the function to execute the tools\ndef execute_tool(tool_calls, messages):\n    for tool_call in tool_calls:\n        tool_name = tool_call.function.name\n        tool_arguments = json.loads(tool_call.function.arguments)\n\n        if tool_name == 'clean_data':\n            # Simulate data cleaning\n            cleaned_df = clean_data(tool_arguments['data'])\n            cleaned_data = {\"cleaned_data\": cleaned_df.to_dict()}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(cleaned_data)})\n            print('Cleaned data: ', cleaned_df)\n        elif tool_name == 'transform_data':\n            # Simulate data transformation\n            transformed_data = {\"transformed_data\": \"sample_transformed_data\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(transformed_data)})\n        elif tool_name == 'aggregate_data':\n            # Simulate data aggregation\n            aggregated_data = {\"aggregated_data\": \"sample_aggregated_data\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(aggregated_data)})\n        elif tool_name == 'stat_analysis':\n            # Simulate statistical analysis\n            stats_df = stat_analysis(tool_arguments['data'])\n            stats = {\"stats\": stats_df.to_dict()}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(stats)})\n            print('Statistical Analysis: ', stats_df)\n        elif tool_name == 'correlation_analysis':\n            # Simulate correlation analysis\n            correlations = {\"correlations\": \"sample_correlations\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 75ca3f91-ab78-4010-b9b2-8d1fcd2d2aba
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb", "title": "Structured Outputs for Multi-Agent Systems", "tokens": 5044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"75ca3f91-ab78-4010-b9b2-8d1fcd2d2aba\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"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\": \"0f8ad10f-0d8c-4e3d-8815-d40cce7a9577\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"fe1af06febe25208ec0c4afc1b80b6117753c8e698e0a38b78ab9c14c19a6c43\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"76ae0eb6-adfc-4474-aadf-eb49f870c33c\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a1e44f216f366a9c022b54f91a6f94e4d9e5549fc360e427a3201a2f5c002c7\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"d40cf797-4328-4b59-9c99-5ae0aa63a3f5\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"4cc000034029137f549cbc037f3bbd0a2c0b159db48b69d5228f97f09ee18065\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 13886, \"end_char_idx\": 17059, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "ref_doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "chroma:document": "ylabel(df.columns[1])\n    plt.legend()\n    plt.grid(True)\n    plt.show()\n\n# Define the function to execute the tools\ndef execute_tool(tool_calls, messages):\n    for tool_call in tool_calls:\n        tool_name = tool_call.function.name\n        tool_arguments = json.loads(tool_call.function.arguments)\n\n        if tool_name == 'clean_data':\n            # Simulate data cleaning\n            cleaned_df = clean_data(tool_arguments['data'])\n            cleaned_data = {\"cleaned_data\": cleaned_df.to_dict()}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(cleaned_data)})\n            print('Cleaned data: ', cleaned_df)\n        elif tool_name == 'transform_data':\n            # Simulate data transformation\n            transformed_data = {\"transformed_data\": \"sample_transformed_data\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(transformed_data)})\n        elif tool_name == 'aggregate_data':\n            # Simulate data aggregation\n            aggregated_data = {\"aggregated_data\": \"sample_aggregated_data\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(aggregated_data)})\n        elif tool_name == 'stat_analysis':\n            # Simulate statistical analysis\n            stats_df = stat_analysis(tool_arguments['data'])\n            stats = {\"stats\": stats_df.to_dict()}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(stats)})\n            print('Statistical Analysis: ', stats_df)\n        elif tool_name == 'correlation_analysis':\n            # Simulate correlation analysis\n            correlations = {\"correlations\": \"sample_correlations\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(correlations)})\n        elif tool_name == 'regression_analysis':\n            # Simulate regression analysis\n            regression_results = {\"regression_results\": \"sample_regression_results\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(regression_results)})\n        elif tool_name == 'create_bar_chart':\n            # Simulate bar chart creation\n            bar_chart = {\"bar_chart\": \"sample_bar_chart\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(bar_chart)})\n        elif tool_name == 'create_line_chart':\n            # Simulate line chart creation\n            line_chart = {\"line_chart\": \"sample_line_chart\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(line_chart)})\n            plot_line_chart(tool_arguments['data'])\n        elif tool_name == 'create_pie_chart':\n            # Simulate pie chart creation\n            pie_chart = {\"pie_chart\": \"sample_pie_chart\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(pie_chart)})\n    return messages\n```\n\nNext, we will create the tool handlers for each of the sub-agents.\n\nThese have a unique prompt and tool set passed to the model. \n\nThe output is then passed to an execution function which runs the tool calls.\n\nWe will also append the messages to the conversation history."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: d40cf797-4328-4b59-9c99-5ae0aa63a3f5
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb", "title": "Structured Outputs for Multi-Agent Systems", "tokens": 5044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"d40cf797-4328-4b59-9c99-5ae0aa63a3f5\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"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\": \"0f8ad10f-0d8c-4e3d-8815-d40cce7a9577\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"fe1af06febe25208ec0c4afc1b80b6117753c8e698e0a38b78ab9c14c19a6c43\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"75ca3f91-ab78-4010-b9b2-8d1fcd2d2aba\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"4ec9d12f2be7ff8b7cc54bc2b9f09717ca7b393b092f928b0d8a0d1dab4967dc\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"77c52cac-e291-4ac6-a22c-f1eb56581575\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b44890ff91be8ed1f6ca738a51286a228e425876a42ee184485e6e985cd46d9a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 15262, \"end_char_idx\": 19028, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "ref_doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "chroma:document": "to_dict()}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(stats)})\n            print('Statistical Analysis: ', stats_df)\n        elif tool_name == 'correlation_analysis':\n            # Simulate correlation analysis\n            correlations = {\"correlations\": \"sample_correlations\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(correlations)})\n        elif tool_name == 'regression_analysis':\n            # Simulate regression analysis\n            regression_results = {\"regression_results\": \"sample_regression_results\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(regression_results)})\n        elif tool_name == 'create_bar_chart':\n            # Simulate bar chart creation\n            bar_chart = {\"bar_chart\": \"sample_bar_chart\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(bar_chart)})\n        elif tool_name == 'create_line_chart':\n            # Simulate line chart creation\n            line_chart = {\"line_chart\": \"sample_line_chart\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(line_chart)})\n            plot_line_chart(tool_arguments['data'])\n        elif tool_name == 'create_pie_chart':\n            # Simulate pie chart creation\n            pie_chart = {\"pie_chart\": \"sample_pie_chart\"}\n            messages.append({\"role\": \"tool\", \"name\": tool_name, \"content\": json.dumps(pie_chart)})\n    return messages\n```\n\nNext, we will create the tool handlers for each of the sub-agents.\n\nThese have a unique prompt and tool set passed to the model. \n\nThe output is then passed to an execution function which runs the tool calls.\n\nWe will also append the messages to the conversation history.\n\n\n```python\n# Define the functions to handle each agent's processing\ndef handle_data_processing_agent(query, conversation_messages):\n    messages = [{\"role\": \"system\", \"content\": processing_system_prompt}]\n    messages.append({\"role\": \"user\", \"content\": query})\n\n    response = client.chat.completions.create(\n        model=MODEL,\n        messages=messages,\n        temperature=0,\n        tools=preprocess_tools,\n    )\n\n    conversation_messages.append([tool_call.function for tool_call in response.choices[0].message.tool_calls])\n    execute_tool(response.choices[0].message.tool_calls, conversation_messages)\n\ndef handle_analysis_agent(query, conversation_messages):\n    messages = [{\"role\": \"system\", \"content\": analysis_system_prompt}]\n    messages.append({\"role\": \"user\", \"content\": query})\n\n    response = client.chat.completions.create(\n        model=MODEL,\n        messages=messages,\n        temperature=0,\n        tools=analysis_tools,\n    )\n\n    conversation_messages.append([tool_call.function for tool_call in response.choices[0].message.tool_calls])\n    execute_tool(response.choices[0].message.tool_calls, conversation_messages)\n\ndef handle_visualization_agent(query, conversation_messages):\n    messages = [{\"role\": \"system\", \"content\": visualization_system_prompt}]\n    messages.append({\"role\": \"user\", \"content\": query})\n\n    response = client.chat.completions.create(\n        model=MODEL,\n        messages=messages,\n        temperature=0,\n        tools=visualization_tools,\n    )\n\n    conversation_messages.append([tool_call.function for tool_call in response.choices[0].message.tool_calls])\n    execute_tool(response.choices[0].message.tool_calls, conversation_messages)\n\n```\n\nFinally, we create the overarching tool to handle processing the user query.\n\nThis function takes the user query, gets a response from the model and handles passing it to the other agents to execute. In addition to this, we will keep the state of the ongoing conversation."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 77c52cac-e291-4ac6-a22c-f1eb56581575
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb", "title": "Structured Outputs for Multi-Agent Systems", "tokens": 5044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"77c52cac-e291-4ac6-a22c-f1eb56581575\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"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\": \"0f8ad10f-0d8c-4e3d-8815-d40cce7a9577\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"fe1af06febe25208ec0c4afc1b80b6117753c8e698e0a38b78ab9c14c19a6c43\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"d40cf797-4328-4b59-9c99-5ae0aa63a3f5\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"ff7d5f9065f06b2cb843b69aeed6c4bd01bcd9595d3855e45c929d898b0ce115\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"295ef027-c032-4a7e-8aac-6e739f9993c9\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"3b8ef1fd6e774006ad1bf052b1104c5a123c609b42b6d3b5aba4bb146569adcd\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 17062, \"end_char_idx\": 20490, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "ref_doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "chroma:document": "```python\n# Define the functions to handle each agent's processing\ndef handle_data_processing_agent(query, conversation_messages):\n    messages = [{\"role\": \"system\", \"content\": processing_system_prompt}]\n    messages.append({\"role\": \"user\", \"content\": query})\n\n    response = client.chat.completions.create(\n        model=MODEL,\n        messages=messages,\n        temperature=0,\n        tools=preprocess_tools,\n    )\n\n    conversation_messages.append([tool_call.function for tool_call in response.choices[0].message.tool_calls])\n    execute_tool(response.choices[0].message.tool_calls, conversation_messages)\n\ndef handle_analysis_agent(query, conversation_messages):\n    messages = [{\"role\": \"system\", \"content\": analysis_system_prompt}]\n    messages.append({\"role\": \"user\", \"content\": query})\n\n    response = client.chat.completions.create(\n        model=MODEL,\n        messages=messages,\n        temperature=0,\n        tools=analysis_tools,\n    )\n\n    conversation_messages.append([tool_call.function for tool_call in response.choices[0].message.tool_calls])\n    execute_tool(response.choices[0].message.tool_calls, conversation_messages)\n\ndef handle_visualization_agent(query, conversation_messages):\n    messages = [{\"role\": \"system\", \"content\": visualization_system_prompt}]\n    messages.append({\"role\": \"user\", \"content\": query})\n\n    response = client.chat.completions.create(\n        model=MODEL,\n        messages=messages,\n        temperature=0,\n        tools=visualization_tools,\n    )\n\n    conversation_messages.append([tool_call.function for tool_call in response.choices[0].message.tool_calls])\n    execute_tool(response.choices[0].message.tool_calls, conversation_messages)\n\n```\n\nFinally, we create the overarching tool to handle processing the user query.\n\nThis function takes the user query, gets a response from the model and handles passing it to the other agents to execute. In addition to this, we will keep the state of the ongoing conversation.\n\n\n```python\n# Function to handle user input and triaging\ndef handle_user_message(user_query, conversation_messages=[]):\n    user_message = {\"role\": \"user\", \"content\": user_query}\n    conversation_messages.append(user_message)\n\n\n    messages = [{\"role\": \"system\", \"content\": triaging_system_prompt}]\n    messages.extend(conversation_messages)\n\n    response = client.chat.completions.create(\n        model=MODEL,\n        messages=messages,\n        temperature=0,\n        tools=triage_tools,\n    )\n\n    conversation_messages.append([tool_call.function for tool_call in response.choices[0].message.tool_calls])\n\n    for tool_call in response.choices[0].message.tool_calls:\n        if tool_call.function.name == 'send_query_to_agents':\n            agents = json.loads(tool_call.function.arguments)['agents']\n            query = json.loads(tool_call.function.arguments)['query']\n            for agent in agents:\n                if agent == \"Data Processing Agent\":\n                    handle_data_processing_agent(query, conversation_messages)\n                elif agent == \"Analysis Agent\":\n                    handle_analysis_agent(query, conversation_messages)\n                elif agent == \"Visualization Agent\":\n                    handle_visualization_agent(query, conversation_messages)\n\n    return conversation_messages\n```\n\n## Multi-agent system execution\n\nFinally, we run the overarching `handle_user_message` function on the user query and view the output."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 295ef027-c032-4a7e-8aac-6e739f9993c9
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb", "title": "Structured Outputs for Multi-Agent Systems", "tokens": 5044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"295ef027-c032-4a7e-8aac-6e739f9993c9\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"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\": \"0f8ad10f-0d8c-4e3d-8815-d40cce7a9577\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"fe1af06febe25208ec0c4afc1b80b6117753c8e698e0a38b78ab9c14c19a6c43\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"77c52cac-e291-4ac6-a22c-f1eb56581575\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"190bc8473940e526922a57451748e1cc1a14c06d5509f16f5c4bfc9597368850\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"6ff46108-c4e9-432f-b12c-84a64d064c6b\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"5ec02275156366d6b7c66296637a6ff174890163a1addd5f836beda85027ac16\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 19031, \"end_char_idx\": 21088, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "ref_doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "chroma:document": "```python\n# Function to handle user input and triaging\ndef handle_user_message(user_query, conversation_messages=[]):\n    user_message = {\"role\": \"user\", \"content\": user_query}\n    conversation_messages.append(user_message)\n\n\n    messages = [{\"role\": \"system\", \"content\": triaging_system_prompt}]\n    messages.extend(conversation_messages)\n\n    response = client.chat.completions.create(\n        model=MODEL,\n        messages=messages,\n        temperature=0,\n        tools=triage_tools,\n    )\n\n    conversation_messages.append([tool_call.function for tool_call in response.choices[0].message.tool_calls])\n\n    for tool_call in response.choices[0].message.tool_calls:\n        if tool_call.function.name == 'send_query_to_agents':\n            agents = json.loads(tool_call.function.arguments)['agents']\n            query = json.loads(tool_call.function.arguments)['query']\n            for agent in agents:\n                if agent == \"Data Processing Agent\":\n                    handle_data_processing_agent(query, conversation_messages)\n                elif agent == \"Analysis Agent\":\n                    handle_analysis_agent(query, conversation_messages)\n                elif agent == \"Visualization Agent\":\n                    handle_visualization_agent(query, conversation_messages)\n\n    return conversation_messages\n```\n\n## Multi-agent system execution\n\nFinally, we run the overarching `handle_user_message` function on the user query and view the output.\n\n\n```python\nhandle_user_message(user_query)\n```\n\n    Cleaned data:     house_size (m3)   house_price ($)\n    0               90               100\n    1               80                90\n    2              100               120\n    Statistical Analysis:         house_size  house_price\n    count    4.000000     4.000000\n    mean    90.000000   102.500000\n    std      8.164966    12.583057\n    min     80.000000    90.000000\n    25%     87.500000    97.500000\n    50%     90.000000   100.000000\n    75%     92.500000   105.000000\n    max    100.000000   120.000000\n\n\n\n    \n![png](output_17_1.png)"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 6ff46108-c4e9-432f-b12c-84a64d064c6b
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb", "title": "Structured Outputs for Multi-Agent Systems", "tokens": 5044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"6ff46108-c4e9-432f-b12c-84a64d064c6b\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"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\": \"0f8ad10f-0d8c-4e3d-8815-d40cce7a9577\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"fe1af06febe25208ec0c4afc1b80b6117753c8e698e0a38b78ab9c14c19a6c43\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"295ef027-c032-4a7e-8aac-6e739f9993c9\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"66a7451b5a182a76f26fc5ac656b7a8254e4e2151053b0b608868e881e713b76\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"170f50b0-b87b-41cd-be29-4029dbe8f6af\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"3ca26a10fac99412b4e4e60a583b3b4eb32c7e214f8ebb623ecd1fd4178f4cfc\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 20493, \"end_char_idx\": 23067, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "ref_doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "chroma:document": "```python\nhandle_user_message(user_query)\n```\n\n    Cleaned data:     house_size (m3)   house_price ($)\n    0               90               100\n    1               80                90\n    2              100               120\n    Statistical Analysis:         house_size  house_price\n    count    4.000000     4.000000\n    mean    90.000000   102.500000\n    std      8.164966    12.583057\n    min     80.000000    90.000000\n    25%     87.500000    97.500000\n    50%     90.000000   100.000000\n    75%     92.500000   105.000000\n    max    100.000000   120.000000\n\n\n\n    \n![png](output_17_1.png)\n    \n\n\n\n\n\n    [{'role': 'user',\n      'content': '\\nBelow is some data. I want you to first remove the duplicates then analyze the statistics of the data as well as plot a line chart.\\n\\nhouse_size (m3), house_price ($)\\n90, 100\\n80, 90\\n100, 120\\n90, 100\\n'},\n     [Function(arguments='{\"agents\": [\"Data Processing Agent\"], \"query\": \"Remove duplicates from the data: house_size (m3), house_price ($)\\\\n90, 100\\\\n80, 90\\\\n100, 120\\\\n90, 100\"}', name='send_query_to_agents'),\n      Function(arguments='{\"agents\": [\"Analysis Agent\"], \"query\": \"Analyze the statistics of the data: house_size (m3), house_price ($)\\\\n90, 100\\\\n80, 90\\\\n100, 120\\\\n90, 100\"}', name='send_query_to_agents'),\n      Function(arguments='{\"agents\": [\"Visualization Agent\"], \"query\": \"Plot a line chart for the data: house_size (m3), house_price ($)\\\\n90, 100\\\\n80, 90\\\\n100, 120\\\\n90, 100\"}', name='send_query_to_agents')],\n     [Function(arguments='{\"data\":\"house_size (m3), house_price ($)\\\\n90, 100\\\\n80, 90\\\\n100, 120\\\\n90, 100\"}', name='clean_data')],\n     {'role': 'tool',\n      'name': 'clean_data',\n      'content': '{\"cleaned_data\": {\"house_size (m3)\": {\"0\": 90, \"1\": 80, \"2\": 100}, \" house_price ($)\": {\"0\": 100, \"1\": 90, \"2\": 120}}}'},\n     [Function(arguments='{\"data\":\"house_size,house_price\\\\n90,100\\\\n80,90\\\\n100,120\\\\n90,100\"}', name='stat_analysis')],\n     {'role': 'tool',\n      'name': 'stat_analysis',\n      'content': '{\"stats\": {\"house_size\": {\"count\": 4.0, \"mean\": 90.0, \"std\": 8.16496580927726, \"min\": 80.0, \"25%\": 87.5, \"50%\": 90.0, \"75%\": 92.5, \"max\": 100.0}, \"house_price\": {\"count\": 4.0, \"mean\": 102.5, \"std\": 12.583057392117917, \"min\": 90.0, \"25%\": 97.5, \"50%\": 100.0, \"75%\": 105.0, \"max\": 120.0}}}'},\n     [Function(arguments='{\"data\":\"house_size,house_price\\\\n90,100\\\\n80,90\\\\n100,120\\\\n90,100\",\"x\":\"house_size\",\"y\":\"house_price\"}', name='create_line_chart')],\n     {'role': 'tool',\n      'name': 'create_line_chart',\n      'content': '{\"line_chart\": \"sample_line_chart\"}'}]"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 170f50b0-b87b-41cd-be29-4029dbe8f6af
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb", "title": "Structured Outputs for Multi-Agent Systems", "tokens": 5044, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"170f50b0-b87b-41cd-be29-4029dbe8f6af\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"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\": \"0f8ad10f-0d8c-4e3d-8815-d40cce7a9577\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"fe1af06febe25208ec0c4afc1b80b6117753c8e698e0a38b78ab9c14c19a6c43\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6ff46108-c4e9-432f-b12c-84a64d064c6b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Structured_outputs_multi_agent.ipynb\", \"title\": \"Structured Outputs for Multi-Agent Systems\", \"tokens\": 5044, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"f7664ccb0e6e4ac5ec835a7b0b5c2125a76c7f3fef661c6252a9506312f30a59\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 23071, \"end_char_idx\": 23478, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "ref_doc_id": "0f8ad10f-0d8c-4e3d-8815-d40cce7a9577", "chroma:document": "## Conclusion\n\nIn this cookbook, we've explored how to leverage Structured Outputs to build more robust multi-agent systems.\n\nUsing this new feature allows to make sure that tool calls follow the specified schema and avoids having to handle edge cases or validate arguments on your side.\n\nThis can be applied to many more use cases, and we hope you can take inspiration from this to build your own use case!"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: f4a011d0-35fe-4a63-9e47-5338f8520f9b
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb", "title": "Get embeddings from dataset", "tokens": 1039, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"f4a011d0-35fe-4a63-9e47-5338f8520f9b\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb\", \"title\": \"Get embeddings from dataset\", \"tokens\": 1039, \"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\": \"5baa0f2c-2841-40b8-8dfc-f63f9cf03b37\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb\", \"title\": \"Get embeddings from dataset\", \"tokens\": 1039, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"49be16cfb23af57242bf7423ac38d296ea745d86ade8881c11652b3cdc713d2c\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"b4d5d5f6-f33b-45c6-9c87-42a1707bb516\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"846db94890969d02b511b6b0563485df3f45fcfc0e81948dad0f947efa431353\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 1585, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "5baa0f2c-2841-40b8-8dfc-f63f9cf03b37", "doc_id": "5baa0f2c-2841-40b8-8dfc-f63f9cf03b37", "ref_doc_id": "5baa0f2c-2841-40b8-8dfc-f63f9cf03b37", "chroma:document": "# Get embeddings from dataset\n\nThis notebook gives an example on how to get embeddings from a large dataset.\n\n\n## 1. Load the dataset\n\nThe dataset used in this example is [fine-food reviews](https://www.kaggle.com/snap/amazon-fine-food-reviews) from Amazon. The dataset contains a total of 568,454 food reviews Amazon users left up to October 2012. We will use a subset of this dataset, consisting of 1,000 most recent reviews for illustration purposes. The reviews are in English and tend to be positive or negative. Each review has a ProductId, UserId, Score, review title (Summary) and review body (Text).\n\nWe will combine the review summary and review text into a single combined text. The model will encode this combined text and it will output a single vector embedding.\n\nTo run this notebook, you will need to install: pandas, openai, transformers, plotly, matplotlib, scikit-learn, torch (transformer dep), torchvision, and scipy.\n\n\n```python\nimport pandas as pd\nimport tiktoken\n\nfrom utils.embeddings_utils import get_embedding\n```\n\n\n```python\nembedding_model = \"text-embedding-3-small\"\nembedding_encoding = \"cl100k_base\"\nmax_tokens = 8000  # the maximum for text-embedding-3-small is 8191\n```\n\n\n```python\n# load & inspect dataset\ninput_datapath = \"data/fine_food_reviews_1k.csv\"  # to save space, we provide a pre-filtered dataset\ndf = pd.read_csv(input_datapath, index_col=0)\ndf = df[[\"Time\", \"ProductId\", \"UserId\", \"Score\", \"Summary\", \"Text\"]]\ndf = df.dropna()\ndf[\"combined\"] = (\n    \"Title: \" + df.Summary.str.strip() + \"; Content: \" + df.Text.str.strip()\n)\ndf.head(2)\n```"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: b4d5d5f6-f33b-45c6-9c87-42a1707bb516
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb", "title": "Get embeddings from dataset", "tokens": 1039, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"b4d5d5f6-f33b-45c6-9c87-42a1707bb516\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb\", \"title\": \"Get embeddings from dataset\", \"tokens\": 1039, \"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\": \"5baa0f2c-2841-40b8-8dfc-f63f9cf03b37\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb\", \"title\": \"Get embeddings from dataset\", \"tokens\": 1039, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"49be16cfb23af57242bf7423ac38d296ea745d86ade8881c11652b3cdc713d2c\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f4a011d0-35fe-4a63-9e47-5338f8520f9b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb\", \"title\": \"Get embeddings from dataset\", \"tokens\": 1039, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"73341300812797c473f5aba64de2386509a5fabdfaa92ff5b7e3ae0badd17c48\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"46d75d4e-de03-4a57-a70e-08997748a292\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"4aab987284a9b930ef5bcf5c4684f53c7a0f43edcb39020b2294aefd9f02f97b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 2764, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "5baa0f2c-2841-40b8-8dfc-f63f9cf03b37", "doc_id": "5baa0f2c-2841-40b8-8dfc-f63f9cf03b37", "ref_doc_id": "5baa0f2c-2841-40b8-8dfc-f63f9cf03b37", "chroma:document": "# Get embeddings from dataset\n\nThis notebook gives an example on how to get embeddings from a large dataset.\n\n\n## 1. Load the dataset\n\nThe dataset used in this example is [fine-food reviews](https://www.kaggle.com/snap/amazon-fine-food-reviews) from Amazon. The dataset contains a total of 568,454 food reviews Amazon users left up to October 2012. We will use a subset of this dataset, consisting of 1,000 most recent reviews for illustration purposes. The reviews are in English and tend to be positive or negative. Each review has a ProductId, UserId, Score, review title (Summary) and review body (Text).\n\nWe will combine the review summary and review text into a single combined text. The model will encode this combined text and it will output a single vector embedding.\n\nTo run this notebook, you will need to install: pandas, openai, transformers, plotly, matplotlib, scikit-learn, torch (transformer dep), torchvision, and scipy.\n\n\n```python\nimport pandas as pd\nimport tiktoken\n\nfrom utils.embeddings_utils import get_embedding\n```\n\n\n```python\nembedding_model = \"text-embedding-3-small\"\nembedding_encoding = \"cl100k_base\"\nmax_tokens = 8000  # the maximum for text-embedding-3-small is 8191\n```\n\n\n```python\n# load & inspect dataset\ninput_datapath = \"data/fine_food_reviews_1k.csv\"  # to save space, we provide a pre-filtered dataset\ndf = pd.read_csv(input_datapath, index_col=0)\ndf = df[[\"Time\", \"ProductId\", \"UserId\", \"Score\", \"Summary\", \"Text\"]]\ndf = df.dropna()\ndf[\"combined\"] = (\n    \"Title: \" + df.Summary.str.strip() + \"; Content: \" + df.Text.str.strip()\n)\ndf.head(2)\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>Time</th>\n      <th>ProductId</th>\n      <th>UserId</th>\n      <th>Score</th>\n      <th>Summary</th>\n      <th>Text</th>\n      <th>combined</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1351123200</td>\n      <td>B003XPF9BO</td>\n      <td>A3R7JR3FMEBXQB</td>\n      <td>5</td>\n      <td>where does one  start...and stop... with a tre...</td>\n      <td>Wanted to save some to bring to my Chicago fam...</td>\n      <td>Title: where does one  start...and stop... wit...</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1351123200</td>\n      <td>B003JK537S</td>\n      <td>A3JBPC3WFUT5ZP</td>\n      <td>1</td>\n      <td>Arrived in pieces</td>\n      <td>Not pleased at all. When I opened the box, mos...</td>\n      <td>Title: Arrived in pieces; Content: Not pleased...</td>\n    </tr>\n  </tbody>\n</table>\n</div>"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 46d75d4e-de03-4a57-a70e-08997748a292
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb", "title": "Get embeddings from dataset", "tokens": 1039, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"46d75d4e-de03-4a57-a70e-08997748a292\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb\", \"title\": \"Get embeddings from dataset\", \"tokens\": 1039, \"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\": \"5baa0f2c-2841-40b8-8dfc-f63f9cf03b37\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb\", \"title\": \"Get embeddings from dataset\", \"tokens\": 1039, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"49be16cfb23af57242bf7423ac38d296ea745d86ade8881c11652b3cdc713d2c\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"b4d5d5f6-f33b-45c6-9c87-42a1707bb516\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings_from_dataset.ipynb\", \"title\": \"Get embeddings from dataset\", \"tokens\": 1039, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"9b4a5a36de072f523644ee0cedc53a67c01b22faea8c7e94b36be40a9a157642\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1590, \"end_char_idx\": 3694, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "5baa0f2c-2841-40b8-8dfc-f63f9cf03b37", "doc_id": "5baa0f2c-2841-40b8-8dfc-f63f9cf03b37", "ref_doc_id": "5baa0f2c-2841-40b8-8dfc-f63f9cf03b37", "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>Time</th>\n      <th>ProductId</th>\n      <th>UserId</th>\n      <th>Score</th>\n      <th>Summary</th>\n      <th>Text</th>\n      <th>combined</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1351123200</td>\n      <td>B003XPF9BO</td>\n      <td>A3R7JR3FMEBXQB</td>\n      <td>5</td>\n      <td>where does one  start...and stop... with a tre...</td>\n      <td>Wanted to save some to bring to my Chicago fam...</td>\n      <td>Title: where does one  start...and stop... wit...</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1351123200</td>\n      <td>B003JK537S</td>\n      <td>A3JBPC3WFUT5ZP</td>\n      <td>1</td>\n      <td>Arrived in pieces</td>\n      <td>Not pleased at all. When I opened the box, mos...</td>\n      <td>Title: Arrived in pieces; Content: Not pleased...</td>\n    </tr>\n  </tbody>\n</table>\n</div>\n\n\n\n\n```python\n# subsample to 1k most recent reviews and remove samples that are too long\ntop_n = 1000\ndf = df.sort_values(\"Time\").tail(top_n * 2)  # first cut to first 2k entries, assuming less than half will be filtered out\ndf.drop(\"Time\", axis=1, inplace=True)\n\nencoding = tiktoken.get_encoding(embedding_encoding)\n\n# omit reviews that are too long to embed\ndf[\"n_tokens\"] = df.combined.apply(lambda x: len(encoding.encode(x)))\ndf = df[df.n_tokens <= max_tokens].tail(top_n)\nlen(df)\n```\n\n\n\n\n    1000\n\n\n\n## 2. Get embeddings and save them for future reuse\n\n\n```python\n# Ensure you have your API key set in your environment per the README: https://github.com/openai/openai-python#usage\n\n# This may take a few minutes\ndf[\"embedding\"] = df.combined.apply(lambda x: get_embedding(x, model=embedding_model))\ndf.to_csv(\"data/fine_food_reviews_with_embeddings_1k.csv\")\n```\n\n\n```python\na = get_embedding(\"hi\", model=embedding_model)\n```"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: d740bf66-0d08-4fa9-b194-3354cb49672b
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"d740bf66-0d08-4fa9-b194-3354cb49672b\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"13b71fe6-71a2-4f31-abe3-0b69b001dbeb\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"35728e63cdd5b2305dcccd2a26134c575d0591fecbb6474b2eb63040d81a3ab2\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3340, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "# How to handle rate limits\n\nWhen you call the OpenAI API repeatedly, you may encounter error messages that say `429: 'Too Many Requests'` or `RateLimitError`. These error messages come from exceeding the API's rate limits.\n\nThis guide shares tips for avoiding and handling rate limit errors.\n\nTo see an example script for throttling parallel requests to avoid rate limit errors, see [api_request_parallel_processor.py](https://github.com/openai/openai-cookbook/blob/main/examples/api_request_parallel_processor.py).\n\n## Why rate limits exist\n\nRate limits are a common practice for APIs, and they're put in place for a few different reasons.\n\n- First, they help protect against abuse or misuse of the API. For example, a malicious actor could flood the API with requests in an attempt to overload it or cause disruptions in service. By setting rate limits, OpenAI can prevent this kind of activity.\n- Second, rate limits help ensure that everyone has fair access to the API. If one person or organization makes an excessive number of requests, it could bog down the API for everyone else. By throttling the number of requests that a single user can make, OpenAI ensures that everyone has an opportunity to use the API without experiencing slowdowns.\n- Lastly, rate limits can help OpenAI manage the aggregate load on its infrastructure. If requests to the API increase dramatically, it could tax the servers and cause performance issues. By setting rate limits, OpenAI can help maintain a smooth and consistent experience for all users.\n\nAlthough hitting rate limits can be frustrating, rate limits exist to protect the reliable operation of the API for its users.\n\n## Default rate limits\n\nYour rate limit and spending limit (quota) are automatically adjusted based on a number of factors. As your usage of the OpenAI API goes up and you successfully pay the bill, we automatically increase your usage tier. You can find specific information regarding rate limits using the resources below.\n\n### Other rate limit resources\n\nRead more about OpenAI's rate limits in these other resources:\n\n- [Guide: Rate limits](https://platform.openai.com/docs/guides/rate-limits?context=tier-free)\n- [Help Center: Is API usage subject to any rate limits?](https://help.openai.com/en/articles/5955598-is-api-usage-subject-to-any-rate-limits)\n- [Help Center: How can I solve 429: 'Too Many Requests' errors?](https://help.openai.com/en/articles/5955604-how-can-i-solve-429-too-many-requests-errors)\n\n### Requesting a rate limit increase\n\nIf you'd like your organization's rate limit increased, please visit your [Limits settings page](https://platform.openai.com/account/limits) to see how you can increase your usage tier\n\n\n\n```python\nimport openai\nimport os\n\nclient = openai.OpenAI(api_key=os.environ.get(\"OPENAI_API_KEY\", \"<your OpenAI API key if not set as env var>\"))\n```\n\n## Example rate limit error\n\nA rate limit error will occur when API requests are sent too quickly. If using the OpenAI Python library, they will look something like:\n\n```\nRateLimitError: Rate limit reached for default-codex in organization org-{id} on requests per min. Limit: 20.000000 / min. Current: 24.000000 / min. Contact support@openai.com if you continue to have issues or if you\u2019d like to request an increase.\n```\n\nBelow is example code for triggering a rate limit error."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 13b71fe6-71a2-4f31-abe3-0b69b001dbeb
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"13b71fe6-71a2-4f31-abe3-0b69b001dbeb\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"d740bf66-0d08-4fa9-b194-3354cb49672b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"8855150a11bb97552ac55d2f317d12574e4ceb53e562e01b1ef3819f50d26ad6\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"fb9d1da1-4f6b-4fb9-a6d3-51b0cc6710cc\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"9b6983d9c479972d804521dedbdfb4111e4acb446dea7d958ff0b908de43e817\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2708, \"end_char_idx\": 5921, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "```python\nimport openai\nimport os\n\nclient = openai.OpenAI(api_key=os.environ.get(\"OPENAI_API_KEY\", \"<your OpenAI API key if not set as env var>\"))\n```\n\n## Example rate limit error\n\nA rate limit error will occur when API requests are sent too quickly. If using the OpenAI Python library, they will look something like:\n\n```\nRateLimitError: Rate limit reached for default-codex in organization org-{id} on requests per min. Limit: 20.000000 / min. Current: 24.000000 / min. Contact support@openai.com if you continue to have issues or if you\u2019d like to request an increase.\n```\n\nBelow is example code for triggering a rate limit error.\n\n\n```python\n# request a bunch of completions in a loop\nfor _ in range(100):\n    client.chat.completions.create(\n        model=\"gpt-3.5-turbo\",\n        messages=[{\"role\": \"user\", \"content\": \"Hello\"}],\n        max_tokens=10,\n    )\n```\n\n## How to avoid rate limit errors\n\n### Retrying with exponential backoff\n\nOne easy way to avoid rate limit errors is to automatically retry requests with a random exponential backoff. Retrying with exponential backoff means performing a short sleep when a rate limit error is hit, then retrying the unsuccessful request. If the request is still unsuccessful, the sleep length is increased and the process is repeated. This continues until the request is successful or until a maximum number of retries is reached.\n\nThis approach has many benefits:\n\n- Automatic retries means you can recover from rate limit errors without crashes or missing data\n- Exponential backoff means that your first retries can be tried quickly, while still benefiting from longer delays if your first few retries fail\n- Adding random jitter to the delay helps retries from all hitting at the same time\n\nNote that unsuccessful requests contribute to your per-minute limit, so continuously resending a request won\u2019t work.\n\nBelow are a few example solutions.\n\n#### Example #1: Using the Tenacity library\n\n[Tenacity](https://tenacity.readthedocs.io/en/latest/) is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just about anything.\n\nTo add exponential backoff to your requests, you can use the `tenacity.retry` [decorator](https://peps.python.org/pep-0318/). The following example uses the `tenacity.wait_random_exponential` function to add random exponential backoff to a request.\n\nNote that the Tenacity library is a third-party tool, and OpenAI makes no guarantees about its reliability or security.\n\n\n```python\nfrom tenacity import (\n    retry,\n    stop_after_attempt,\n    wait_random_exponential,\n)  # for exponential backoff\n\n@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))\ndef completion_with_backoff(**kwargs):\n    return client.chat.completions.create(**kwargs)\n\n\ncompletion_with_backoff(model=\"gpt-3.5-turbo\", messages=[{\"role\": \"user\", \"content\": \"Once upon a time,\"}])\n```\n\n\n\n\n    ChatCompletion(id='chatcmpl-8PAu6anX2JxQdYmJRzps38R8u0ZBC', choices=[Choice(finish_reason='stop', index=0, message=ChatCompletionMessage(content='in a small village nestled among green fields and rolling hills, there lived a kind-hearted and curious young girl named Lily."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: fb9d1da1-4f6b-4fb9-a6d3-51b0cc6710cc
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"fb9d1da1-4f6b-4fb9-a6d3-51b0cc6710cc\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"13b71fe6-71a2-4f31-abe3-0b69b001dbeb\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"bbca2abb06e0ea071c0dac9bbe6c0a0117de2be0475579ed269de9ada2f19e43\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"64bec6a0-f6e1-418c-889f-2bd88cd77711\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"9fe11423660d31ddac67a28aa64dbd5bf5e5e8f76bfe4e852ecef2dae0e6f0ad\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 5229, \"end_char_idx\": 8557, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "```python\nfrom tenacity import (\n    retry,\n    stop_after_attempt,\n    wait_random_exponential,\n)  # for exponential backoff\n\n@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))\ndef completion_with_backoff(**kwargs):\n    return client.chat.completions.create(**kwargs)\n\n\ncompletion_with_backoff(model=\"gpt-3.5-turbo\", messages=[{\"role\": \"user\", \"content\": \"Once upon a time,\"}])\n```\n\n\n\n\n    ChatCompletion(id='chatcmpl-8PAu6anX2JxQdYmJRzps38R8u0ZBC', choices=[Choice(finish_reason='stop', index=0, message=ChatCompletionMessage(content='in a small village nestled among green fields and rolling hills, there lived a kind-hearted and curious young girl named Lily. Lily was known for her bright smile and infectious laughter, bringing joy to everyone around her.\\n\\nOne sunny morning, as Lily played in the meadows, she stumbled upon a mysterious book tucked away beneath a tall oak tree. Intrigued, she picked it up and dusted off its weathered cover to reveal intricate golden patterns. Without hesitation, she opened it, discovering that its pages were filled with magical tales and enchanting adventures.\\n\\nAmong the stories she found, one particularly caught her attention\u2014a tale of a long-lost treasure hidden deep within a mysterious forest. Legend had it that whoever found this hidden treasure would be granted one wish, no matter how big or small. Excited by the prospect of finding such treasure and fulfilling her wildest dreams, Lily decided to embark on a thrilling journey to the forest.\\n\\nGathering her courage, Lily told her parents about the magical book and her quest to find the hidden treasure. Though concerned for their daughter\\'s safety, they couldn\\'t help but admire her spirit and determination. They hugged her tightly and blessed her with love and luck, promising to await her return.\\n\\nEquipped with a map she found within the book, Lily ventured into the depths of the thick forest. The trees whispered tales of forgotten secrets, and the enchanted creatures hidden within watched her every step. But Lily remained undeterred, driven by her desire to discover what lay ahead.\\n\\nDays turned into weeks as Lily traversed through dense foliage, crossed swift rivers, and climbed treacherous mountains. She encountered mystical beings who offered guidance and protection along her perilous journey. With their help, she overcame countless obstacles and grew braver with each passing day.\\n\\nFinally, after what felt like an eternity, Lily reached the heart of the forest. There, beneath a jeweled waterfall, she found the long-lost treasure\u2014a magnificent chest adorned with sparkling gemstones. Overwhelmed with excitement, she gently opened the chest to reveal a brilliant light that illuminated the forest.\\n\\nWithin the glow, a wise voice echoed, \"You have proven your courage and pure heart, young Lily. Make your wish, and it shall be granted.\"\\n\\nLily thought deeply about her wish, realizing that her true treasure was the love and happiness she felt in her heart. Instead of making a wish for herself, she asked for the wellbeing and prosperity of her village, spreading joy and harmony to everyone living there.\\n\\nAs the light faded, Lily knew her quest was complete. She retraced her steps through the forest, returning home to find her village flourishing."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 64bec6a0-f6e1-418c-889f-2bd88cd77711
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"64bec6a0-f6e1-418c-889f-2bd88cd77711\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"fb9d1da1-4f6b-4fb9-a6d3-51b0cc6710cc\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"9e6283fbaa3299fcf9375a59407747ae2688c6319a3702ee0c09950fcdffd851\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"337b39eb-d4b6-4996-a6cd-6973aa6cd5f1\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"bf4efd6c34417f98e9b916b0076e7aa24fad6bfe439826b58fa66fadee359a92\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 6875, \"end_char_idx\": 9966, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "Though concerned for their daughter\\'s safety, they couldn\\'t help but admire her spirit and determination. They hugged her tightly and blessed her with love and luck, promising to await her return.\\n\\nEquipped with a map she found within the book, Lily ventured into the depths of the thick forest. The trees whispered tales of forgotten secrets, and the enchanted creatures hidden within watched her every step. But Lily remained undeterred, driven by her desire to discover what lay ahead.\\n\\nDays turned into weeks as Lily traversed through dense foliage, crossed swift rivers, and climbed treacherous mountains. She encountered mystical beings who offered guidance and protection along her perilous journey. With their help, she overcame countless obstacles and grew braver with each passing day.\\n\\nFinally, after what felt like an eternity, Lily reached the heart of the forest. There, beneath a jeweled waterfall, she found the long-lost treasure\u2014a magnificent chest adorned with sparkling gemstones. Overwhelmed with excitement, she gently opened the chest to reveal a brilliant light that illuminated the forest.\\n\\nWithin the glow, a wise voice echoed, \"You have proven your courage and pure heart, young Lily. Make your wish, and it shall be granted.\"\\n\\nLily thought deeply about her wish, realizing that her true treasure was the love and happiness she felt in her heart. Instead of making a wish for herself, she asked for the wellbeing and prosperity of her village, spreading joy and harmony to everyone living there.\\n\\nAs the light faded, Lily knew her quest was complete. She retraced her steps through the forest, returning home to find her village flourishing. Fields bloomed with vibrant flowers, and laughter filled the air.\\n\\nThe villagers greeted Lily with open arms, recognizing her selflessness and the magic she had brought into their lives. From that day forward, they told the tale of Lily\\'s journey, celebrating her as a heroine who embodied the power of love, kindness, and the belief that true treasure lies within oneself.\\n\\nAnd so, the story of Lily became an everlasting legend, inspiring generations to follow their dreams, be selfless, and find the true treasures that lie within their hearts.', role='assistant', function_call=None, tool_calls=None))], created=1701010806, model='gpt-3.5-turbo-0613', object='chat.completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=641, prompt_tokens=12, total_tokens=653))\n\n\n\n#### Example #2: Using the backoff library\n\nAnother library that provides function decorators for backoff and retry is [backoff](https://pypi.org/project/backoff/).\n\nLike Tenacity, the backoff library is a third-party tool, and OpenAI makes no guarantees about its reliability or security.\n\n\n```python\nimport backoff  # for exponential backoff\n\n@backoff.on_exception(backoff.expo, openai.RateLimitError)\ndef completions_with_backoff(**kwargs):\n    return client.chat.completions.create(**kwargs)\n\n\ncompletions_with_backoff(model=\"gpt-3.5-turbo\", messages=[{\"role\": \"user\", \"content\": \"Once upon a time,\"}])\n\n```"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 337b39eb-d4b6-4996-a6cd-6973aa6cd5f1
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"337b39eb-d4b6-4996-a6cd-6973aa6cd5f1\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"64bec6a0-f6e1-418c-889f-2bd88cd77711\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"bbeacc8a26cf3589e79afe9de7303e7091c96470400fb8b88a5dcc351cddbd77\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"07742532-d883-47be-a4c2-f8e97b44069b\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"537d34ecc6186471d0c52531761f49a5b68e23ca3e918f1350f155dcd6cf1603\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 8261, \"end_char_idx\": 13467, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "Instead of making a wish for herself, she asked for the wellbeing and prosperity of her village, spreading joy and harmony to everyone living there.\\n\\nAs the light faded, Lily knew her quest was complete. She retraced her steps through the forest, returning home to find her village flourishing. Fields bloomed with vibrant flowers, and laughter filled the air.\\n\\nThe villagers greeted Lily with open arms, recognizing her selflessness and the magic she had brought into their lives. From that day forward, they told the tale of Lily\\'s journey, celebrating her as a heroine who embodied the power of love, kindness, and the belief that true treasure lies within oneself.\\n\\nAnd so, the story of Lily became an everlasting legend, inspiring generations to follow their dreams, be selfless, and find the true treasures that lie within their hearts.', role='assistant', function_call=None, tool_calls=None))], created=1701010806, model='gpt-3.5-turbo-0613', object='chat.completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=641, prompt_tokens=12, total_tokens=653))\n\n\n\n#### Example #2: Using the backoff library\n\nAnother library that provides function decorators for backoff and retry is [backoff](https://pypi.org/project/backoff/).\n\nLike Tenacity, the backoff library is a third-party tool, and OpenAI makes no guarantees about its reliability or security.\n\n\n```python\nimport backoff  # for exponential backoff\n\n@backoff.on_exception(backoff.expo, openai.RateLimitError)\ndef completions_with_backoff(**kwargs):\n    return client.chat.completions.create(**kwargs)\n\n\ncompletions_with_backoff(model=\"gpt-3.5-turbo\", messages=[{\"role\": \"user\", \"content\": \"Once upon a time,\"}])\n\n```\n\n\n\n\n    ChatCompletion(id='chatcmpl-8PAwkg7Q9pPeAkvVuAZ8AyA108WhR', choices=[Choice(finish_reason='stop', index=0, message=ChatCompletionMessage(content=\"in a small village, there lived a young girl named Lily. She had fiery red hair, lively green eyes, and a spirit as wild as the rushing river nearby. Lily was known for her curious nature and her desire to explore the world beyond the village boundaries.\\n\\nOne day, while playing near the river, Lily spotted an injured bird nested on a branch. Its wing was broken, and it seemed unable to fly away. Lily's heart filled with sadness, and she knew she couldn't leave the bird alone.\\n\\nCarefully, she climbed up the tree and gently placed the bird inside her pocket. Lily brought it home and made a cozy bed for it in a small wooden box. She named the bird Ruby, after its shimmering red feathers.\\n\\nDays turned into weeks, and Ruby's wing slowly healed under Lily's constant care and attention. As they spent time together, a deep bond grew between them. Ruby would chirp happily whenever Lily approached, and she would spend hours talking to the bird, sharing stories of her adventures, dreams, and fears.\\n\\nOne evening, as Lily was about to go to bed, a peculiar thing happened. Ruby hopped out of his box and fluttered onto the windowsill. He turned to face Lily with his bright eyes and began to sing a beautiful melody.\\n\\nLily was astonished. Never before had she heard Ruby sing. The tune was so captivating that it filled the room and made the quiet night come alive. The magical music seemed to touch Lily's soul, awakening a deep sense of wonder and wanderlust within her.\\n\\nFilled with an undeniable urge to explore, Lily decided it was time to go on an adventure with her newfound friend, Ruby. She packed a small bag and bid farewell to her family and friends, promising to return one day.\\n\\nTogether, Lily and Ruby embarked on a grand journey, soaring across expansive skies, diving into lush forests, and exploring hidden caves. They encountered magnificent landscapes, unique creatures, and encountered kind-hearted individuals who shared their wisdom and stories.\\n\\nThroughout their journey, Ruby's song continued to inspire and guide them. It became a symbol of hope, reminding them to embrace bravery, follow their dreams, and always remain true to themselves.\\n\\nAs the years passed, Lily and Ruby traversed the world, weaving their stories into the tapestry of time. They became renowned for their extraordinary bond and the magic they shared with everyone they encountered.\\n\\nEventually, it was time for Lily to return to her village, a place eagerly awaiting her return. She had grown wise, learned many lessons, and gained a deeper understanding of herself and the world around her.\\n\\nWith Ruby perched on her shoulder, they descended upon the village like a ray of sunshine, bringing joy and wonder to every heart. Lily shared the wisdom she had acquired and inspired others to embrace their own adventures, no matter how big or small.\\n\\nAnd so, the tale of Lily and Ruby became legend, passed down from generation to generation. Their story reminded people to cherish the connections they make, to nurture their dreams, and to believe in the magic that lies within them.\", role='assistant', function_call=None, tool_calls=None))], created=1701010970, model='gpt-3.5-turbo-0613', object='chat.completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=621, prompt_tokens=12, total_tokens=633))"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 07742532-d883-47be-a4c2-f8e97b44069b
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"07742532-d883-47be-a4c2-f8e97b44069b\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"337b39eb-d4b6-4996-a6cd-6973aa6cd5f1\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"58033f86422576871083ddde4e8efbd58a8570a3021dd7ca9e04d760725431df\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"9877ec09-81c2-476a-8f2d-c678ed3accb0\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"7267226ee460535ff9c9811b0eae4e6c60e8321cff1587ee8915312e2858dc7f\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 13471, \"end_char_idx\": 16703, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "#### Example 3: Manual backoff implementation\n\nIf you don't want to use third-party libraries, you can implement your own backoff logic.\n\n\n```python\n# imports\nimport random\nimport time\n\n# define a retry decorator\ndef retry_with_exponential_backoff(\n    func,\n    initial_delay: float = 1,\n    exponential_base: float = 2,\n    jitter: bool = True,\n    max_retries: int = 10,\n    errors: tuple = (openai.RateLimitError,),\n):\n    \"\"\"Retry a function with exponential backoff.\"\"\"\n\n    def wrapper(*args, **kwargs):\n        # Initialize variables\n        num_retries = 0\n        delay = initial_delay\n\n        # Loop until a successful response or max_retries is hit or an exception is raised\n        while True:\n            try:\n                return func(*args, **kwargs)\n\n            # Retry on specified errors\n            except errors as e:\n                # Increment retries\n                num_retries += 1\n\n                # Check if max retries has been reached\n                if num_retries > max_retries:\n                    raise Exception(\n                        f\"Maximum number of retries ({max_retries}) exceeded.\"\n                    )\n\n                # Increment the delay\n                delay *= exponential_base * (1 + jitter * random.random())\n\n                # Sleep for the delay\n                time.sleep(delay)\n\n            # Raise exceptions for any errors not specified\n            except Exception as e:\n                raise e\n\n    return wrapper\n\n\n@retry_with_exponential_backoff\ndef completions_with_backoff(**kwargs):\n    return client.chat.completions.create(**kwargs)\n\n\ncompletions_with_backoff(model=\"gpt-3.5-turbo\", messages=[{\"role\": \"user\", \"content\": \"Once upon a time,\"}])\n```\n\n\n\n\n    ChatCompletion(id='chatcmpl-8PAxGvV3GbLpnOoKSvJ00XCUdOglM', choices=[Choice(finish_reason='stop', index=0, message=ChatCompletionMessage(content=\"in a faraway kingdom, there lived a young princess named Aurora. She was known for her beauty, grace, and kind heart. Aurora's kingdom was filled with lush green meadows, towering mountains, and sparkling rivers. The princess loved spending time exploring the enchanting forests surrounding her castle.\\n\\nOne day, while Aurora was wandering through the woods, she stumbled upon a hidden clearing. At the center stood a majestic oak tree, its branches reaching towards the sky. Aurora approached the tree with curiosity, and as she got closer, she noticed a small door at its base.\\n\\nIntrigued, she gently pushed open the door and was amazed to find herself in a magical realm. The forest transformed into a breathtaking wonderland, with colorful flowers blooming in every direction and woodland creatures frolicking joyously. Aurora's eyes widened with wonder as she explored this extraordinary world.\\n\\nAs she explored further, Aurora came across a small cottage in the distance. Curiosity overcame her, and she cautiously approached the cottage. To her surprise, an elderly woman with twinkling eyes and a warm smile stood in the doorway, welcoming her inside.\\n\\nThe woman revealed herself to be a fairy named Luna. Luna informed Aurora that she had been chosen to undertake a quest that would bring harmony to both her kingdom and the mystical realm."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 9877ec09-81c2-476a-8f2d-c678ed3accb0
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"9877ec09-81c2-476a-8f2d-c678ed3accb0\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"07742532-d883-47be-a4c2-f8e97b44069b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"84a56d3138017bc5b9939a89f6c8de68d3f48e3e740fe9a68aa60f39ba56d030\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"b2642784-a38d-4ed6-aae7-032b1d0f9c0d\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"64b108d9d8feb330c4d84724a0f79c593ae5f53329717247ca8408646192eb2c\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 15079, \"end_char_idx\": 18425, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "completions_with_backoff(model=\"gpt-3.5-turbo\", messages=[{\"role\": \"user\", \"content\": \"Once upon a time,\"}])\n```\n\n\n\n\n    ChatCompletion(id='chatcmpl-8PAxGvV3GbLpnOoKSvJ00XCUdOglM', choices=[Choice(finish_reason='stop', index=0, message=ChatCompletionMessage(content=\"in a faraway kingdom, there lived a young princess named Aurora. She was known for her beauty, grace, and kind heart. Aurora's kingdom was filled with lush green meadows, towering mountains, and sparkling rivers. The princess loved spending time exploring the enchanting forests surrounding her castle.\\n\\nOne day, while Aurora was wandering through the woods, she stumbled upon a hidden clearing. At the center stood a majestic oak tree, its branches reaching towards the sky. Aurora approached the tree with curiosity, and as she got closer, she noticed a small door at its base.\\n\\nIntrigued, she gently pushed open the door and was amazed to find herself in a magical realm. The forest transformed into a breathtaking wonderland, with colorful flowers blooming in every direction and woodland creatures frolicking joyously. Aurora's eyes widened with wonder as she explored this extraordinary world.\\n\\nAs she explored further, Aurora came across a small cottage in the distance. Curiosity overcame her, and she cautiously approached the cottage. To her surprise, an elderly woman with twinkling eyes and a warm smile stood in the doorway, welcoming her inside.\\n\\nThe woman revealed herself to be a fairy named Luna. Luna informed Aurora that she had been chosen to undertake a quest that would bring harmony to both her kingdom and the mystical realm. Aurora, eager to help, listened intently as Luna explained that a powerful enchantress had cast a spell on the kingdom, causing darkness and despair to loom over the land.\\n\\nTo break the curse, Aurora had to embark on a journey to retrieve a magical crystal hidden deep within the heart of an ancient cave. Without hesitation, the princess agreed and bid farewell to Luna, promising to return victorious.\\n\\nWith newfound determination, Aurora set off on her quest. Along the way, she encountered numerous challenges and obstacles but never lost hope. She often drew strength from the enchanting woodland creatures who accompanied her on this journey, reminding her that she was not alone.\\n\\nAfter a long and arduous journey, Aurora reached the entrance of the ancient cave. Inside, she faced a series of tests that pushed her physical and emotional limits. With sheer determination and unwavering courage, she overcame each trial, paving her way to the crystal's resting place.\\n\\nAs Aurora held the crystal in her hands, its warmth spread through her body. The artifact contained unimaginable power that could shatter the enchantress's curse and restore light to her kingdom. Brimming with joy and newfound strength, she made her way back to Luna's cottage.\\n\\nUpon her return, Aurora and Luna performed a powerful ritual, using the crystal's magic to break the curse. Waves of light and color spread across the kingdom, banishing darkness and despair. The once-gray skies turned blue, and laughter filled the air once again. The kingdom rejoiced, thanking Princess Aurora for her bravery and selflessness.\\n\\nFrom that day forward, Aurora was hailed as a hero, not only in her kingdom but also in the mystical realm."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: b2642784-a38d-4ed6-aae7-032b1d0f9c0d
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"b2642784-a38d-4ed6-aae7-032b1d0f9c0d\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"9877ec09-81c2-476a-8f2d-c678ed3accb0\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"827beb52d89702135d84cb1e3b41cd1070387a1ef68cbc4bd23f25d835c1c3a0\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"15656396-f565-465c-a54e-55a54558b19e\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"f1fe2b7959918290beee8a6c208d1372a0f1923ce07809a92b8da5047de3fa3f\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 16568, \"end_char_idx\": 20023, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "Luna informed Aurora that she had been chosen to undertake a quest that would bring harmony to both her kingdom and the mystical realm. Aurora, eager to help, listened intently as Luna explained that a powerful enchantress had cast a spell on the kingdom, causing darkness and despair to loom over the land.\\n\\nTo break the curse, Aurora had to embark on a journey to retrieve a magical crystal hidden deep within the heart of an ancient cave. Without hesitation, the princess agreed and bid farewell to Luna, promising to return victorious.\\n\\nWith newfound determination, Aurora set off on her quest. Along the way, she encountered numerous challenges and obstacles but never lost hope. She often drew strength from the enchanting woodland creatures who accompanied her on this journey, reminding her that she was not alone.\\n\\nAfter a long and arduous journey, Aurora reached the entrance of the ancient cave. Inside, she faced a series of tests that pushed her physical and emotional limits. With sheer determination and unwavering courage, she overcame each trial, paving her way to the crystal's resting place.\\n\\nAs Aurora held the crystal in her hands, its warmth spread through her body. The artifact contained unimaginable power that could shatter the enchantress's curse and restore light to her kingdom. Brimming with joy and newfound strength, she made her way back to Luna's cottage.\\n\\nUpon her return, Aurora and Luna performed a powerful ritual, using the crystal's magic to break the curse. Waves of light and color spread across the kingdom, banishing darkness and despair. The once-gray skies turned blue, and laughter filled the air once again. The kingdom rejoiced, thanking Princess Aurora for her bravery and selflessness.\\n\\nFrom that day forward, Aurora was hailed as a hero, not only in her kingdom but also in the mystical realm. She continued to be a beacon of hope and kindness, reminding everyone that true courage lies within, waiting to be awakened.\\n\\nAnd so, Princess Aurora's tale lived on as a timeless reminder that even in the darkest of times, there is always light and hope to be found.\", role='assistant', function_call=None, tool_calls=None))], created=1701011002, model='gpt-3.5-turbo-0613', object='chat.completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=657, prompt_tokens=12, total_tokens=669))\n\n\n\n## How to maximize throughput of batch processing given rate limits\n\nIf you're processing real-time requests from users, backoff and retry is a great strategy to minimize latency while avoiding rate limit errors.\n\nHowever, if you're processing large volumes of batch data, where throughput matters more than latency, there are a few other things you can do in addition to backoff and retry.\n\n### Proactively adding delay between requests\n\nIf you are constantly hitting the rate limit, then backing off, then hitting the rate limit again, then backing off again, it's possible that a good fraction of your request budget will be 'wasted' on requests that need to be retried. This limits your processing throughput, given a fixed rate limit.\n\nHere, one potential solution is to calculate your rate limit and add a delay equal to its reciprocal (e.g., if your rate limit 20 requests per minute, add a delay of 3\u20136 seconds to each request). This can help you operate near the rate limit ceiling without hitting it and incurring wasted requests.\n\n#### Example of adding delay to a request"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 15656396-f565-465c-a54e-55a54558b19e
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"15656396-f565-465c-a54e-55a54558b19e\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"b2642784-a38d-4ed6-aae7-032b1d0f9c0d\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"124cb3399cace2c48e7dcc860e86e2b316ead670db236573754a1452678051ed\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"9c775e8e-7968-4254-a3c3-bc335cab4189\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"fedecaa6618c0f18aaf11abe09af9f01e562209cb03667c099a57553da69eed6\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 18234, \"end_char_idx\": 20669, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "The kingdom rejoiced, thanking Princess Aurora for her bravery and selflessness.\\n\\nFrom that day forward, Aurora was hailed as a hero, not only in her kingdom but also in the mystical realm. She continued to be a beacon of hope and kindness, reminding everyone that true courage lies within, waiting to be awakened.\\n\\nAnd so, Princess Aurora's tale lived on as a timeless reminder that even in the darkest of times, there is always light and hope to be found.\", role='assistant', function_call=None, tool_calls=None))], created=1701011002, model='gpt-3.5-turbo-0613', object='chat.completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=657, prompt_tokens=12, total_tokens=669))\n\n\n\n## How to maximize throughput of batch processing given rate limits\n\nIf you're processing real-time requests from users, backoff and retry is a great strategy to minimize latency while avoiding rate limit errors.\n\nHowever, if you're processing large volumes of batch data, where throughput matters more than latency, there are a few other things you can do in addition to backoff and retry.\n\n### Proactively adding delay between requests\n\nIf you are constantly hitting the rate limit, then backing off, then hitting the rate limit again, then backing off again, it's possible that a good fraction of your request budget will be 'wasted' on requests that need to be retried. This limits your processing throughput, given a fixed rate limit.\n\nHere, one potential solution is to calculate your rate limit and add a delay equal to its reciprocal (e.g., if your rate limit 20 requests per minute, add a delay of 3\u20136 seconds to each request). This can help you operate near the rate limit ceiling without hitting it and incurring wasted requests.\n\n#### Example of adding delay to a request\n\n\n```python\n# imports\nimport time\n\n# Define a function that adds a delay to a Completion API call\ndef delayed_completion(delay_in_seconds: float = 1, **kwargs):\n    \"\"\"Delay a completion by a specified amount of time.\"\"\"\n\n    # Sleep for the delay\n    time.sleep(delay_in_seconds)\n\n    # Call the Completion API and return the result\n    return client.chat.completions.create(**kwargs)\n\n\n# Calculate the delay based on your rate limit\nrate_limit_per_minute = 20\ndelay = 60.0 / rate_limit_per_minute\n\ndelayed_completion(\n    delay_in_seconds=delay,\n    model=\"gpt-3.5-turbo\",\n    messages=[{\"role\": \"user\", \"content\": \"Once upon a time,\"}]\n)\n\n```"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 9c775e8e-7968-4254-a3c3-bc335cab4189
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"9c775e8e-7968-4254-a3c3-bc335cab4189\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"15656396-f565-465c-a54e-55a54558b19e\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"9caa849bac6af6182f6d28f4f6baa1413ee2323bc05564925aadad4bdd5039c0\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"0de33293-36c9-43c8-a432-3aa0ff3eeba6\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"58f91675f6169c705361f303d47ac1296375c425637d7b2a8d74512023d08b02\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 18940, \"end_char_idx\": 23658, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "## How to maximize throughput of batch processing given rate limits\n\nIf you're processing real-time requests from users, backoff and retry is a great strategy to minimize latency while avoiding rate limit errors.\n\nHowever, if you're processing large volumes of batch data, where throughput matters more than latency, there are a few other things you can do in addition to backoff and retry.\n\n### Proactively adding delay between requests\n\nIf you are constantly hitting the rate limit, then backing off, then hitting the rate limit again, then backing off again, it's possible that a good fraction of your request budget will be 'wasted' on requests that need to be retried. This limits your processing throughput, given a fixed rate limit.\n\nHere, one potential solution is to calculate your rate limit and add a delay equal to its reciprocal (e.g., if your rate limit 20 requests per minute, add a delay of 3\u20136 seconds to each request). This can help you operate near the rate limit ceiling without hitting it and incurring wasted requests.\n\n#### Example of adding delay to a request\n\n\n```python\n# imports\nimport time\n\n# Define a function that adds a delay to a Completion API call\ndef delayed_completion(delay_in_seconds: float = 1, **kwargs):\n    \"\"\"Delay a completion by a specified amount of time.\"\"\"\n\n    # Sleep for the delay\n    time.sleep(delay_in_seconds)\n\n    # Call the Completion API and return the result\n    return client.chat.completions.create(**kwargs)\n\n\n# Calculate the delay based on your rate limit\nrate_limit_per_minute = 20\ndelay = 60.0 / rate_limit_per_minute\n\ndelayed_completion(\n    delay_in_seconds=delay,\n    model=\"gpt-3.5-turbo\",\n    messages=[{\"role\": \"user\", \"content\": \"Once upon a time,\"}]\n)\n\n```\n\n\n\n\n    ChatCompletion(id='chatcmpl-8PAyCR1axKsomV0e349XiCN1Z81pH', choices=[Choice(finish_reason='stop', index=0, message=ChatCompletionMessage(content=\"in a small village, there lived a young girl named Maya. Maya was known for her kindness and love for nature. She spent hours exploring the forests surrounding the village, admiring the vibrant flowers and talking to the animals.\\n\\nOne sunny day, as Maya was picking wildflowers, she stumbled upon a wounded blackbird with a broken wing. Feeling sorry for the bird, Maya gently picked it up and cradled it in her hands. She knew she had to help the bird, so she hurried back to her cottage.\\n\\nMaya set up a cozy nest for the blackbird and carefully splinted its wing. She fed it worms and berries, doing everything she could to nurse it back to health. Each day, she would sing lullabies and tell stories to keep the blackbird company. Slowly, the bird's wing healed, and before long, it was ready to fly again.\\n\\nOn a beautiful morning, Maya opened the window of her cottage and released the blackbird into the sky. As the bird soared into the air, Maya's heart filled with joy and gratitude. Little did she know, this act of kindness would change her life forever.\\n\\nThe following night, a mysterious glowing light illuminated Maya's room. Startled, she sat up and saw a magical creature standing before her. It was a fairy, tiny yet radiating warmth and light.\\n\\nThe fairy introduced herself as Luna, the Guardian of the Forest. She had witnessed Maya's kindness towards the blackbird and had been watching her ever since. Luna explained that she had come to reward Maya for her selflessness.\\n\\nWith a wave of her wand, Luna granted Maya the ability to communicate with animals. Maya's eyes widened with amazement as she realized she could now understand the language of nature. Birds chirped melodies, rabbits whispered secrets, and trees shared their ancient wisdom.\\n\\nOver time, Maya's ability made her beloved by both humans and animals. Farmers sought her advice on how to care for their crops, and children flocked to her for stories of her enchanting encounters with the forest creatures. Maya used her gift to teach others about the importance of living in harmony with nature.\\n\\nAs years passed, Maya became known as the Village Guardian. She dedicated herself to protecting the surrounding forests from harm and educating others on sustainable living. The village flourished under Maya's guidance, and animals and humans lived side by side peacefully.\\n\\nAnd so, Maya's story became a legend passed down through generations. Her kindness, love for nature, and her ability to communicate with animals inspired people to treat the world around them with compassion and care.\", role='assistant', function_call=None, tool_calls=None))], created=1701011060, model='gpt-3.5-turbo-0613', object='chat.completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=524, prompt_tokens=12, total_tokens=536))"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 0de33293-36c9-43c8-a432-3aa0ff3eeba6
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"0de33293-36c9-43c8-a432-3aa0ff3eeba6\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"9c775e8e-7968-4254-a3c3-bc335cab4189\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"ebeb5de97e7c7d6d05b788d65b9c88cc6cb42e86a299986c13e23d4266e56a29\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"ca631a01-14af-462e-a2a5-9b131a2195db\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"3c80f4ea0cec491cdd1f824575e0395b80c79d37bdc434d547af9f1fa0eb80aa\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 23664, \"end_char_idx\": 25967, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "### Batching requests\n\nThe OpenAI API has separate limits for requests per minute and tokens per minute.\n\nIf you're hitting the limit on requests per minute, but have headroom on tokens per minute, you can increase your throughput by batching multiple tasks into each request. This will allow you to process more tokens per minute, especially with the smaller models.\n\nSending in a batch of prompts works exactly the same as a normal API call, except that pass in a list of strings to `prompt` parameter instead of a single string.\n\n**Warning:** the response object may not return completions in the order of the prompts, so always remember to match responses back to prompts using the `index` field.\n\n#### Example without batching\n\n\n```python\nnum_stories = 10\ncontent = \"Once upon a time,\"\n\n# serial example, with one story completion per request\nfor _ in range(num_stories):\n    response = client.chat.completions.create(\n        model=\"gpt-3.5-turbo\",\n        messages=[{\"role\": \"user\", \"content\": content}],\n        max_tokens=20,\n    )\n\n    # print story\n    print(content + response.choices[0].message.content)\n\n```\n\n    Once upon a time,in a small village nestled between rolling green hills, there lived a young girl named Lily. She had\n    Once upon a time,in a small village nestled in the heart of a lush forest, lived a young girl named Evelyn.\n    Once upon a time,in a faraway kingdom, there lived a young princess named Aurora. She was known for her kind\n    Once upon a time,in a faraway kingdom called Enchantia, there lived a young girl named Ella. Ella was\n    Once upon a time,in a small village nestled among the rolling hills, lived a young woman named Lucy. Lucy was known\n    Once upon a time,in a small village nestled between rolling hills, there lived a young girl named Ava. Ava was a\n    Once upon a time,in a faraway kingdom, there lived a wise and just king named Arthur. King Arthur ruled over\n    Once upon a time,in a small village nestled among towering mountains, lived a young girl named Lily. She was known for\n    Once upon a time,in a small village nestled in the heart of a lush forest, there lived a young girl named Lily\n    Once upon a time,in a far-off kingdom, there lived a kind and beloved queen named Isabella. She ruled with\n\n\n#### Example with batching"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: ca631a01-14af-462e-a2a5-9b131a2195db
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"ca631a01-14af-462e-a2a5-9b131a2195db\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"0de33293-36c9-43c8-a432-3aa0ff3eeba6\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"f8ab38ada62646c0b105dcb02d9e4c0720741d031976988cc684c4cbb57bca68\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"b936a6b4-c644-4f32-baa1-16e08cd1a2f9\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"89523fd07a6f446bffe166ff8716348f24ee073c1f8eab5fd981e50d77ebdee2\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 24398, \"end_char_idx\": 27544, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "```python\nnum_stories = 10\ncontent = \"Once upon a time,\"\n\n# serial example, with one story completion per request\nfor _ in range(num_stories):\n    response = client.chat.completions.create(\n        model=\"gpt-3.5-turbo\",\n        messages=[{\"role\": \"user\", \"content\": content}],\n        max_tokens=20,\n    )\n\n    # print story\n    print(content + response.choices[0].message.content)\n\n```\n\n    Once upon a time,in a small village nestled between rolling green hills, there lived a young girl named Lily. She had\n    Once upon a time,in a small village nestled in the heart of a lush forest, lived a young girl named Evelyn.\n    Once upon a time,in a faraway kingdom, there lived a young princess named Aurora. She was known for her kind\n    Once upon a time,in a faraway kingdom called Enchantia, there lived a young girl named Ella. Ella was\n    Once upon a time,in a small village nestled among the rolling hills, lived a young woman named Lucy. Lucy was known\n    Once upon a time,in a small village nestled between rolling hills, there lived a young girl named Ava. Ava was a\n    Once upon a time,in a faraway kingdom, there lived a wise and just king named Arthur. King Arthur ruled over\n    Once upon a time,in a small village nestled among towering mountains, lived a young girl named Lily. She was known for\n    Once upon a time,in a small village nestled in the heart of a lush forest, there lived a young girl named Lily\n    Once upon a time,in a far-off kingdom, there lived a kind and beloved queen named Isabella. She ruled with\n\n\n#### Example with batching\n\n\n```python\nnum_stories = 10\nprompts = [\"Once upon a time,\"] * num_stories\n\n# batched example, with 10 stories completions per request\nresponse = client.chat.completions.create(\n    model=\"curie\",\n    prompt=prompts,\n    max_tokens=20,\n)\n\n# match completions to prompts by index\nstories = [\"\"] * len(prompts)\nfor choice in response.choices:\n    stories[choice.index] = prompts[choice.index] + choice.text\n\n# print stories\nfor story in stories:\n    print(story)\n\n```\n\n    Once upon a time, I lived in hope. I convinced myself I knew best, because, naive as it might sound,\n    Once upon a time, Thierry Henry was invited to have a type of frosty exchange with English fans, in which\n    Once upon a time, and a long time ago as well, PV was passively cooled because coils cooled by use of metal driving\n    Once upon a time, there was a land called Texas. It was about the size of Wisconsin. It contained, however,\n    Once upon a time, there was an old carpenter who had three sons. The locksmith never learned to read or write\n    Once upon a time, there was a small farming town called Moonridge Village, far West across the great vast plains that lay\n    Once upon a time, California\u2019s shorelines, lakes, and valleys were host to expanses of untamed wilderness\n    Once upon a time, she said. It started with a simple question: Why don\u2019t we know any stories?\n    Once upon a time, when I was a young woman, there was a movie named Wuthering Heights. Stand by alleges\n    Once upon a time, a very long time I mean, in the year 1713, died a beautiful Duchess called the young"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: b936a6b4-c644-4f32-baa1-16e08cd1a2f9
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb", "title": "How to handle rate limits", "tokens": 6170, "retrieve_doc": true, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"b936a6b4-c644-4f32-baa1-16e08cd1a2f9\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"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\": \"904079d1-adc5-4f31-b8ac-2a4759cc9131\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"55b917d4c2d8323320d7e68745831f44c180a3437acb783f6d700c109f0e666a\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"ca631a01-14af-462e-a2a5-9b131a2195db\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/How_to_handle_rate_limits.ipynb\", \"title\": \"How to handle rate limits\", \"tokens\": 6170, \"retrieve_doc\": true, \"source\": \"openai_cookbooks\"}, \"hash\": \"7004b8024869c4f7d9b9f1d60024d7af1c6a2a5c750570dce7e1781b50507384\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 25941, \"end_char_idx\": 28207, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "ref_doc_id": "904079d1-adc5-4f31-b8ac-2a4759cc9131", "chroma:document": "#### Example with batching\n\n\n```python\nnum_stories = 10\nprompts = [\"Once upon a time,\"] * num_stories\n\n# batched example, with 10 stories completions per request\nresponse = client.chat.completions.create(\n    model=\"curie\",\n    prompt=prompts,\n    max_tokens=20,\n)\n\n# match completions to prompts by index\nstories = [\"\"] * len(prompts)\nfor choice in response.choices:\n    stories[choice.index] = prompts[choice.index] + choice.text\n\n# print stories\nfor story in stories:\n    print(story)\n\n```\n\n    Once upon a time, I lived in hope. I convinced myself I knew best, because, naive as it might sound,\n    Once upon a time, Thierry Henry was invited to have a type of frosty exchange with English fans, in which\n    Once upon a time, and a long time ago as well, PV was passively cooled because coils cooled by use of metal driving\n    Once upon a time, there was a land called Texas. It was about the size of Wisconsin. It contained, however,\n    Once upon a time, there was an old carpenter who had three sons. The locksmith never learned to read or write\n    Once upon a time, there was a small farming town called Moonridge Village, far West across the great vast plains that lay\n    Once upon a time, California\u2019s shorelines, lakes, and valleys were host to expanses of untamed wilderness\n    Once upon a time, she said. It started with a simple question: Why don\u2019t we know any stories?\n    Once upon a time, when I was a young woman, there was a movie named Wuthering Heights. Stand by alleges\n    Once upon a time, a very long time I mean, in the year 1713, died a beautiful Duchess called the young\n\n\n## Example parallel processing script\n\nWe've written an example script for parallel processing large quantities of API requests: [api_request_parallel_processor.py](https://github.com/openai/openai-cookbook/blob/main/examples/api_request_parallel_processor.py).\n\nThe script combines some handy features:\n- Streams requests from file, to avoid running out of memory for giant jobs\n- Makes requests concurrently, to maximize throughput\n- Throttles both request and token usage, to stay under rate limits\n- Retries failed requests, to avoid missing data\n- Logs errors, to diagnose problems with requests\n\nFeel free to use it as is or modify it to suit your needs."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: e6c1a9db-d579-4680-8885-e04a09eab2ae
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"e6c1a9db-d579-4680-8885-e04a09eab2ae\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"f25d4c29-ec07-4992-9685-f00f0d6d9e88\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"1747f5921bc46dde0c5f7e7b639c7bb27eb4ede64085ab49aed3e8eff375bd7a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 0, \"end_char_idx\": 3162, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "# Fine tuning with function-calling\n\n\nThis notebook covers how to fine-tune to increase function calling accuracy and reliability. You can find more information on function calling [here](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_call_functions_with_chat_models.ipynb), and on fine tuning [here](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_finetune_chat_models.ipynb)\n\n\nFor context, from the function calling notebook above:\n\n> `tools` is an optional parameter in the Chat Completion API which can be used to provide function specifications. The purpose of this is to enable models to generate function arguments which adhere to the provided specifications. Note that the API will not actually execute any function calls. It is up to developers to execute function calls using model outputs.\n\n\nFunction calling is a very powerful tool when it functions as intended. However, we have seen that as the number of functions increases, and the complexity of the task at hand increases, function calling becomes less accurate (e.g.: more hallucinated invocations, and incorrect invocations).\n\nBefore fine tuning for function calling, it's best to begin with:\n\n- Improvements to the function definitions. Make them more clear, and more distinct from one another.\n- Experiment with prompt engineering: often a more detailed prompt can help the model call the correct function.\n\n_If_ the steps above fail to improve function calling to a satisfactory level, then you can try fine tuning for function calling.\n\n\n### Overview\n\n\nThis notebook contains three sections\n\n- **Assessing baseline function calling performance:** Evaluating an out-of-the-box `gpt-3.5-turbo` model on our given function (let's assume that for latency + cost reasons we cannot use `gpt-4o` for a drone copilot)\n- **Generating synthetic data:** Using `gpt-4o` to create 'golden' set of prompts and function invocations to use as training data\n- **Fine-tuning**: Running the fine tuning job, and evaluating the fine-tuned model\n\n\nNote: _This notebook provides an example of how to create synthetic training data for fine tuning for function calling given just a list of functions. While real-world production test evals are preferable, this method produces strong results and can be used in conjunction with real-world training data._\n\n\n# Getting baseline function calling performance\n\n\n\n```python\n#!pip install tenacity -q\n#!pip install openai -q\n#!pip install typing -q\n# !pip install python-dotenv\n```\n\n\n```python\nimport numpy as np\nimport json\nimport os\nfrom IPython.display import display\nimport pandas as pd\nfrom openai import OpenAI\nimport itertools\nimport time\nimport base64\nfrom tenacity import retry, wait_random_exponential, stop_after_attempt\nfrom typing import Any, Dict, List, Generator\nimport ast\n\n%load_ext dotenv\n%dotenv\n\nclient = OpenAI(api_key=os.environ.get(\"OPENAI_BUILD_HOUR_KEY\"))\n```\n\n    The dotenv extension is already loaded. To reload it, use:\n      %reload_ext dotenv\n\n\n### Utilities\n\n\nLet's define utility functions for making calls to the Chat Completions API, one to get the completion and one to get the function call."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: f25d4c29-ec07-4992-9685-f00f0d6d9e88
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"f25d4c29-ec07-4992-9685-f00f0d6d9e88\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"e6c1a9db-d579-4680-8885-e04a09eab2ae\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"e243fe126a4284cb6153a51a100efafe11fda7a10aa4de0fcb6904c287e7108c\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"86128f8a-fcdc-40ae-b0ce-2ebadc106d91\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"865f52d0f9dde2ddde3c8d5d431f521823465ff8e1de903f782a8fd30aea8370\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 1552, \"end_char_idx\": 3832, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "### Overview\n\n\nThis notebook contains three sections\n\n- **Assessing baseline function calling performance:** Evaluating an out-of-the-box `gpt-3.5-turbo` model on our given function (let's assume that for latency + cost reasons we cannot use `gpt-4o` for a drone copilot)\n- **Generating synthetic data:** Using `gpt-4o` to create 'golden' set of prompts and function invocations to use as training data\n- **Fine-tuning**: Running the fine tuning job, and evaluating the fine-tuned model\n\n\nNote: _This notebook provides an example of how to create synthetic training data for fine tuning for function calling given just a list of functions. While real-world production test evals are preferable, this method produces strong results and can be used in conjunction with real-world training data._\n\n\n# Getting baseline function calling performance\n\n\n\n```python\n#!pip install tenacity -q\n#!pip install openai -q\n#!pip install typing -q\n# !pip install python-dotenv\n```\n\n\n```python\nimport numpy as np\nimport json\nimport os\nfrom IPython.display import display\nimport pandas as pd\nfrom openai import OpenAI\nimport itertools\nimport time\nimport base64\nfrom tenacity import retry, wait_random_exponential, stop_after_attempt\nfrom typing import Any, Dict, List, Generator\nimport ast\n\n%load_ext dotenv\n%dotenv\n\nclient = OpenAI(api_key=os.environ.get(\"OPENAI_BUILD_HOUR_KEY\"))\n```\n\n    The dotenv extension is already loaded. To reload it, use:\n      %reload_ext dotenv\n\n\n### Utilities\n\n\nLet's define utility functions for making calls to the Chat Completions API, one to get the completion and one to get the function call.\n\n\n\n```python\ndef get_chat_completion(\n    messages: list[dict[str, str]],\n    model: str = \"gpt-3.5-turbo\",\n    max_tokens=500,\n    temperature=0.0,\n    stop=None,\n    tools=None,\n    seed=42,\n    functions=None,\n    tool_choice=None,\n) -> str:\n    params = {\n        \"model\": model,\n        \"messages\": messages,\n        \"max_tokens\": max_tokens,\n        \"temperature\": temperature,\n        \"stop\": stop,\n        \"tools\": tools,\n        \"seed\": seed,\n        \"tool_choice\": tool_choice,\n    }\n    if functions:\n        params[\"functions\"] = functions\n\n    completion = client.chat.completions.create(**params)\n    return completion.choices[0].message, completion.usage"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 86128f8a-fcdc-40ae-b0ce-2ebadc106d91
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"86128f8a-fcdc-40ae-b0ce-2ebadc106d91\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f25d4c29-ec07-4992-9685-f00f0d6d9e88\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"7d26657b99aee6852163903a5e06d54f1b19957d016aed3bb29c466e24b83246\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"741483b1-e93e-4851-9092-14ce3ae44500\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b248981f55ee65a98d4c1c123c6035a1dc0c796a67c346a4505c8a2caa3c72c7\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 2348, \"end_char_idx\": 7078, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "# Getting baseline function calling performance\n\n\n\n```python\n#!pip install tenacity -q\n#!pip install openai -q\n#!pip install typing -q\n# !pip install python-dotenv\n```\n\n\n```python\nimport numpy as np\nimport json\nimport os\nfrom IPython.display import display\nimport pandas as pd\nfrom openai import OpenAI\nimport itertools\nimport time\nimport base64\nfrom tenacity import retry, wait_random_exponential, stop_after_attempt\nfrom typing import Any, Dict, List, Generator\nimport ast\n\n%load_ext dotenv\n%dotenv\n\nclient = OpenAI(api_key=os.environ.get(\"OPENAI_BUILD_HOUR_KEY\"))\n```\n\n    The dotenv extension is already loaded. To reload it, use:\n      %reload_ext dotenv\n\n\n### Utilities\n\n\nLet's define utility functions for making calls to the Chat Completions API, one to get the completion and one to get the function call.\n\n\n\n```python\ndef get_chat_completion(\n    messages: list[dict[str, str]],\n    model: str = \"gpt-3.5-turbo\",\n    max_tokens=500,\n    temperature=0.0,\n    stop=None,\n    tools=None,\n    seed=42,\n    functions=None,\n    tool_choice=None,\n) -> str:\n    params = {\n        \"model\": model,\n        \"messages\": messages,\n        \"max_tokens\": max_tokens,\n        \"temperature\": temperature,\n        \"stop\": stop,\n        \"tools\": tools,\n        \"seed\": seed,\n        \"tool_choice\": tool_choice,\n    }\n    if functions:\n        params[\"functions\"] = functions\n\n    completion = client.chat.completions.create(**params)\n    return completion.choices[0].message, completion.usage\n\n\ndef eval(model: str, system_prompt: str, function_list, prompts_to_expected_tool_name):\n    \"\"\"\n    Evaluate the performance of a model in selecting the correct function based on given prompts.\n\n    Args:\n        model (str): The name of the model to be evaluated.\n        system_prompt (str): The system prompt to be used in the chat completion.\n        function_list (list): A list of functions that the model can call.\n        prompts_to_expected_tool_name (dict): A dictionary mapping prompts to their expected function names.\n\n    Returns:\n        None\n    \"\"\"\n\n    prompts_to_actual = []\n    latencies = []\n    tokens_used = []\n\n    for prompt, expected_function in prompts_to_expected_tool_name.items():\n        messages = [\n            {\"role\": \"system\", \"content\": system_prompt},\n            {\"role\": \"user\", \"content\": prompt},\n        ]\n\n        start_time = time.time()\n        completion, usage = get_chat_completion(\n            model=model,\n            messages=messages,\n            seed=42,\n            tools=function_list,\n            temperature=0.0,\n            tool_choice=\"required\",\n        )\n        end_time = time.time()\n\n        latency = (end_time - start_time) * 1000  # convert to milliseconds\n        latencies.append(latency)\n\n        prompts_to_actual.append(\n            {prompt: completion.tool_calls[0].function.name})\n\n        # Calculate tokens used\n        tokens_used.append(usage.total_tokens)\n\n    total_prompts = len(prompts_to_expected_tool_name)\n\n    # Calculate the number of matches\n    matches = sum(\n        1\n        for result in prompts_to_actual\n        if list(result.values())[0]\n        == prompts_to_expected_tool_name[list(result.keys())[0]]\n    )\n    match_percentage = (matches / total_prompts) * 100\n\n    # Calculate average latency\n    avg_latency = sum(latencies) / total_prompts\n    # Calculate average tokens used\n    avg_tokens_used = sum(tokens_used) / total_prompts\n\n    # Create a DataFrame to store the results\n    results_df = pd.DataFrame(columns=[\"Prompt\", \"Expected\", \"Match\"])\n\n    results_list = []\n    for result in prompts_to_actual:\n        prompt = list(result.keys())[0]\n        actual_function = list(result.values())[0]\n        expected_function = prompts_to_expected_tool_name[prompt]\n        match = actual_function == expected_function\n        results_list.append(\n            {\n                \"Prompt\": prompt,\n                \"Actual\": actual_function,\n                \"Expected\": expected_function,\n                \"Match\": \"Yes\" if match else \"No\",\n            }\n        )\n    results_df = pd.DataFrame(results_list)\n\n    def style_rows(row):\n        match = row[\"Match\"]\n        background_color = \"red\" if match == \"No\" else \"white\"\n        return [\"background-color: {}; color: black\".format(background_color)] * len(\n            row\n        )\n\n    styled_results_df = results_df.style.apply(style_rows, axis=1)\n\n    # Display the DataFrame as a table\n    display(styled_results_df)\n\n    print(\n        f\"Number of matches: {matches} out of {total_prompts} ({match_percentage:.2f}%)\"\n    )\n    print(f\"Average latency per request: {avg_latency:.2f} ms\")\n    print(f\"Average tokens used per request: {avg_tokens_used:.2f}\")\n```\n\n### Baseline testing"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 741483b1-e93e-4851-9092-14ce3ae44500
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"741483b1-e93e-4851-9092-14ce3ae44500\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"86128f8a-fcdc-40ae-b0ce-2ebadc106d91\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"80e8a570c33b9f4dcc1e4bb0f4e3668e3c9d18af1c7185fedc2fbc7e7fb296e4\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"36428875-7ba9-44e0-b291-c920d984e0e4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"12cccbb7ddb2be23b222f06c2701073aa081abd7ba0a083f9208a8fa23f9f1de\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 7081, \"end_char_idx\": 11119, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "Let's build an intelligent drone co-pilot. We want to be able to give the co-pilot commands, and have it either call the function\nfor that command, or deny that request if the command is unfeasible.\nWe can first define a system prompt for the copilot.\n\n\n\n```python\nDRONE_SYSTEM_PROMPT = \"\"\"You are an intelligent AI that controls a drone. Given a command or request from the user,\ncall one of your functions to complete the request. If the request cannot be completed by your available functions, call the reject_request function.\nIf the request is ambiguous or unclear, reject the request.\"\"\"\n```\n\nNow let's define functions for all of the actions the copilot can take.\n\n\n\n```python\nfunction_list = [\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"takeoff_drone\",\n            \"description\": \"Initiate the drone's takeoff sequence.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"altitude\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Specifies the altitude in meters to which the drone should ascend.\",\n                    }\n                },\n                \"required\": [\"altitude\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"land_drone\",\n            \"description\": \"Land the drone at its current location or a specified landing point.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"location\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"current\", \"home_base\", \"custom\"],\n                        \"description\": \"Specifies the landing location for the drone.\",\n                    },\n                    \"coordinates\": {\n                        \"type\": \"object\",\n                        \"description\": \"GPS coordinates for custom landing location. Required if location is 'custom'.\",\n                    },\n                },\n                \"required\": [\"location\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"control_drone_movement\",\n            \"description\": \"Direct the drone's movement in a specific direction.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"direction\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"forward\", \"backward\", \"left\", \"right\", \"up\", \"down\"],\n                        \"description\": \"Direction in which the drone should move.\",\n                    },\n                    \"distance\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Distance in meters the drone should travel in the specified direction.\",\n                    },\n                },\n                \"required\": [\"direction\", \"distance\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_drone_speed\",\n            \"description\": \"Adjust the speed of the drone.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"speed\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Specifies the speed in km/h. Valid range is 0 to 100.\",\n                        \"minimum\": 0,\n                    }\n                },\n                \"required\": [\"speed\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"control_camera\",\n            \"description\": \"Control the drone's camera to capture images or videos.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"mode\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"photo\", \"video\", \"panorama\"],\n                        \"description\": \"Camera mode to capture content."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 36428875-7ba9-44e0-b291-c920d984e0e4
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"36428875-7ba9-44e0-b291-c920d984e0e4\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"741483b1-e93e-4851-9092-14ce3ae44500\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"09466794b0383d64925779e04118f830945e2ef88003e2575596342bc02daf75\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"8f0f5468-6078-4b1f-8776-afe7e36caf30\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"2b4fcf61169a9574d2c73712c8121d77457867a0a09fed3fd68c5fb0cea42ea6\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 9043, \"end_char_idx\": 12956, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "Required if location is 'custom'.\",\n                    },\n                },\n                \"required\": [\"location\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"control_drone_movement\",\n            \"description\": \"Direct the drone's movement in a specific direction.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"direction\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"forward\", \"backward\", \"left\", \"right\", \"up\", \"down\"],\n                        \"description\": \"Direction in which the drone should move.\",\n                    },\n                    \"distance\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Distance in meters the drone should travel in the specified direction.\",\n                    },\n                },\n                \"required\": [\"direction\", \"distance\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_drone_speed\",\n            \"description\": \"Adjust the speed of the drone.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"speed\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Specifies the speed in km/h. Valid range is 0 to 100.\",\n                        \"minimum\": 0,\n                    }\n                },\n                \"required\": [\"speed\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"control_camera\",\n            \"description\": \"Control the drone's camera to capture images or videos.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"mode\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"photo\", \"video\", \"panorama\"],\n                        \"description\": \"Camera mode to capture content.\",\n                    },\n                    \"duration\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Duration in seconds for video capture. Required if mode is 'video'.\",\n                    },\n                },\n                \"required\": [\"mode\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"control_gimbal\",\n            \"description\": \"Adjust the drone's gimbal for camera stabilization and direction.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"tilt\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Tilt angle for the gimbal in degrees.\",\n                    },\n                    \"pan\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Pan angle for the gimbal in degrees.\",\n                    },\n                },\n                \"required\": [\"tilt\", \"pan\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_drone_lighting\",\n            \"description\": \"Control the drone's lighting for visibility and signaling.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"mode\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"on\", \"off\", \"blink\", \"sos\"],\n                        \"description\": \"Lighting mode for the drone.\",\n                    }\n                },\n                \"required\": [\"mode\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"return_to_home\",\n            \"description\": \"Command the drone to return to its home or launch location."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 8f0f5468-6078-4b1f-8776-afe7e36caf30
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"8f0f5468-6078-4b1f-8776-afe7e36caf30\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"36428875-7ba9-44e0-b291-c920d984e0e4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"081c2b0b3d162a0c5b86108f5544db0f7881f4b032d19d03afcd419ab7068655\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"7193e2ef-187c-443e-a605-efa6f486257e\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"f3c62e1d2a36b331f737a623b9cb6837e3f7ec8b2074c6922f9cc6fc953fddb1\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 11119, \"end_char_idx\": 14898, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "\",\n                    },\n                    \"duration\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Duration in seconds for video capture. Required if mode is 'video'.\",\n                    },\n                },\n                \"required\": [\"mode\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"control_gimbal\",\n            \"description\": \"Adjust the drone's gimbal for camera stabilization and direction.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"tilt\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Tilt angle for the gimbal in degrees.\",\n                    },\n                    \"pan\": {\n                        \"type\": \"integer\",\n                        \"description\": \"Pan angle for the gimbal in degrees.\",\n                    },\n                },\n                \"required\": [\"tilt\", \"pan\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_drone_lighting\",\n            \"description\": \"Control the drone's lighting for visibility and signaling.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"mode\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"on\", \"off\", \"blink\", \"sos\"],\n                        \"description\": \"Lighting mode for the drone.\",\n                    }\n                },\n                \"required\": [\"mode\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"return_to_home\",\n            \"description\": \"Command the drone to return to its home or launch location.\",\n            \"parameters\": {\"type\": \"object\", \"properties\": {}},\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_battery_saver_mode\",\n            \"description\": \"Toggle battery saver mode.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"status\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"on\", \"off\"],\n                        \"description\": \"Toggle battery saver mode.\",\n                    }\n                },\n                \"required\": [\"status\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_obstacle_avoidance\",\n            \"description\": \"Configure obstacle avoidance settings.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"mode\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"on\", \"off\"],\n                        \"description\": \"Toggle obstacle avoidance.\",\n                    }\n                },\n                \"required\": [\"mode\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_follow_me_mode\",\n            \"description\": \"Enable or disable 'follow me' mode.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"status\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"on\", \"off\"],\n                        \"description\": \"Toggle 'follow me' mode.\",\n                    }\n                },\n                \"required\": [\"status\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"calibrate_sensors\",\n            \"description\": \"Initiate calibration sequence for drone's sensors."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 7193e2ef-187c-443e-a605-efa6f486257e
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"7193e2ef-187c-443e-a605-efa6f486257e\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"8f0f5468-6078-4b1f-8776-afe7e36caf30\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"acf36dbd1c2b75718cc58b70b6a0af1e63c82322530345545b514fad95699f45\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"6c04c5ae-3ae1-41c8-afc3-d6d36965d996\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"b16b6cebacf9682aa9326005a9e0493cdf650a1a1d7a7ac6b1043232912886c5\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 12956, \"end_char_idx\": 16852, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "\",\n            \"parameters\": {\"type\": \"object\", \"properties\": {}},\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_battery_saver_mode\",\n            \"description\": \"Toggle battery saver mode.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"status\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"on\", \"off\"],\n                        \"description\": \"Toggle battery saver mode.\",\n                    }\n                },\n                \"required\": [\"status\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_obstacle_avoidance\",\n            \"description\": \"Configure obstacle avoidance settings.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"mode\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"on\", \"off\"],\n                        \"description\": \"Toggle obstacle avoidance.\",\n                    }\n                },\n                \"required\": [\"mode\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_follow_me_mode\",\n            \"description\": \"Enable or disable 'follow me' mode.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"status\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"on\", \"off\"],\n                        \"description\": \"Toggle 'follow me' mode.\",\n                    }\n                },\n                \"required\": [\"status\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"calibrate_sensors\",\n            \"description\": \"Initiate calibration sequence for drone's sensors.\",\n            \"parameters\": {\"type\": \"object\", \"properties\": {}},\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_autopilot\",\n            \"description\": \"Enable or disable autopilot mode.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"status\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"on\", \"off\"],\n                        \"description\": \"Toggle autopilot mode.\",\n                    }\n                },\n                \"required\": [\"status\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"configure_led_display\",\n            \"description\": \"Configure the drone's LED display pattern and colors.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"pattern\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"solid\", \"blink\", \"pulse\", \"rainbow\"],\n                        \"description\": \"Pattern for the LED display.\",\n                    },\n                    \"color\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"red\", \"blue\", \"green\", \"yellow\", \"white\"],\n                        \"description\": \"Color for the LED display. Not required if pattern is 'rainbow'.\",\n                    },\n                },\n                \"required\": [\"pattern\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_home_location\",\n            \"description\": \"Set or change the home location for the drone.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"coordinates\": {\n                        \"type\": \"object\",\n                        \"description\": \"GPS coordinates for the home location."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 6c04c5ae-3ae1-41c8-afc3-d6d36965d996
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"6c04c5ae-3ae1-41c8-afc3-d6d36965d996\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"7193e2ef-187c-443e-a605-efa6f486257e\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"4a44457f4460d87f0f6dd4e0e785bc89d2f261ca774eef3caae386336f4ad081\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"cc9eb089-06b8-4839-826e-431fb1e6d6f5\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"7e7406058e1abf87bcc40bbdebff9f242dbca6b236d25883f144cf11a3c4ff55\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 14898, \"end_char_idx\": 18412, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "\",\n            \"parameters\": {\"type\": \"object\", \"properties\": {}},\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_autopilot\",\n            \"description\": \"Enable or disable autopilot mode.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"status\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"on\", \"off\"],\n                        \"description\": \"Toggle autopilot mode.\",\n                    }\n                },\n                \"required\": [\"status\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"configure_led_display\",\n            \"description\": \"Configure the drone's LED display pattern and colors.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"pattern\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"solid\", \"blink\", \"pulse\", \"rainbow\"],\n                        \"description\": \"Pattern for the LED display.\",\n                    },\n                    \"color\": {\n                        \"type\": \"string\",\n                        \"enum\": [\"red\", \"blue\", \"green\", \"yellow\", \"white\"],\n                        \"description\": \"Color for the LED display. Not required if pattern is 'rainbow'.\",\n                    },\n                },\n                \"required\": [\"pattern\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"set_home_location\",\n            \"description\": \"Set or change the home location for the drone.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"coordinates\": {\n                        \"type\": \"object\",\n                        \"description\": \"GPS coordinates for the home location.\",\n                    }\n                },\n                \"required\": [\"coordinates\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"reject_request\",\n            \"description\": \"Use this function if the request is not possible.\",\n            \"parameters\": {\"type\": \"object\", \"properties\": {}},\n        },\n    },\n]\n```\n\nFor starters, let's see how function calling performs with some straight forward feasible prompts, and then couple of obviously impossible requests which call the 'reject_request' function.\n\n\n\n```python\nstraightforward_prompts_to_expected = {\n    \"Land the drone at the home base\": \"land_drone\",\n    \"Take off the drone to 50 meters\": \"takeoff_drone\",\n    \"Change speed to 15 kilometers per hour\": \"set_drone_speed\",\n    \"Turn into an elephant!\": \"reject_request\",\n    \"Move the drone forward by 10 meters\": \"control_drone_movement\",\n    \"I want the LED display to blink in red\": \"configure_led_display\",\n    \"Can you take a photo?\": \"control_camera\",\n    \"Can you detect obstacles?\": \"set_obstacle_avoidance\",\n    \"Can you dance for me?\": \"reject_request\",\n    \"Can you follow me?\": \"set_follow_me_mode\",\n}\n```\n\n\n```python\n# Evaluate the model with the given prompts\neval(\n    model=\"gpt-3.5-turbo\",\n    system_prompt=DRONE_SYSTEM_PROMPT,\n    function_list=function_list,\n    prompts_to_expected_tool_name=straightforward_prompts_to_expected,\n)\n```\n\n\n<style type=\"text/css\">\n#T_b01a0_row0_col0, #T_b01a0_row0_col1, #T_b01a0_row0_col2, #T_b01a0_row0_col3, #T_b01a0_row1_col0,"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: cc9eb089-06b8-4839-826e-431fb1e6d6f5
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"cc9eb089-06b8-4839-826e-431fb1e6d6f5\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6c04c5ae-3ae1-41c8-afc3-d6d36965d996\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"09f009171bcf8517dde97b8c0c4d16580b5fb9a7c0b51f9e8cf1bce0d489ab1b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"cbeb5b95-ef6e-496a-8978-53d5e13cc0f2\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"7a71d7dd56e8801497d666ea8787e657c7d9207cc7e6c539915a061aa92bfa56\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 16852, \"end_char_idx\": 19092, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "\",\n                    }\n                },\n                \"required\": [\"coordinates\"],\n            },\n        },\n    },\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"reject_request\",\n            \"description\": \"Use this function if the request is not possible.\",\n            \"parameters\": {\"type\": \"object\", \"properties\": {}},\n        },\n    },\n]\n```\n\nFor starters, let's see how function calling performs with some straight forward feasible prompts, and then couple of obviously impossible requests which call the 'reject_request' function.\n\n\n\n```python\nstraightforward_prompts_to_expected = {\n    \"Land the drone at the home base\": \"land_drone\",\n    \"Take off the drone to 50 meters\": \"takeoff_drone\",\n    \"Change speed to 15 kilometers per hour\": \"set_drone_speed\",\n    \"Turn into an elephant!\": \"reject_request\",\n    \"Move the drone forward by 10 meters\": \"control_drone_movement\",\n    \"I want the LED display to blink in red\": \"configure_led_display\",\n    \"Can you take a photo?\": \"control_camera\",\n    \"Can you detect obstacles?\": \"set_obstacle_avoidance\",\n    \"Can you dance for me?\": \"reject_request\",\n    \"Can you follow me?\": \"set_follow_me_mode\",\n}\n```\n\n\n```python\n# Evaluate the model with the given prompts\neval(\n    model=\"gpt-3.5-turbo\",\n    system_prompt=DRONE_SYSTEM_PROMPT,\n    function_list=function_list,\n    prompts_to_expected_tool_name=straightforward_prompts_to_expected,\n)\n```\n\n\n<style type=\"text/css\">\n#T_b01a0_row0_col0, #T_b01a0_row0_col1, #T_b01a0_row0_col2, #T_b01a0_row0_col3, #T_b01a0_row1_col0, #T_b01a0_row1_col1, #T_b01a0_row1_col2, #T_b01a0_row1_col3, #T_b01a0_row2_col0, #T_b01a0_row2_col1, #T_b01a0_row2_col2, #T_b01a0_row2_col3, #T_b01a0_row3_col0, #T_b01a0_row3_col1, #T_b01a0_row3_col2, #T_b01a0_row3_col3, #T_b01a0_row4_col0, #T_b01a0_row4_col1, #T_b01a0_row4_col2, #T_b01a0_row4_col3, #T_b01a0_row5_col0, #T_b01a0_row5_col1, #T_b01a0_row5_col2, #T_b01a0_row5_col3, #T_b01a0_row6_col0, #T_b01a0_row6_col1, #T_b01a0_row6_col2, #T_b01a0_row6_col3, #T_b01a0_row7_col0, #T_b01a0_row7_col1, #T_b01a0_row7_col2, #T_b01a0_row7_col3, #T_b01a0_row8_col0, #T_b01a0_row8_col1, #T_b01a0_row8_col2, #T_b01a0_row8_col3, #T_b01a0_row9_col0, #T_b01a0_row9_col1, #T_b01a0_row9_col2,"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: cbeb5b95-ef6e-496a-8978-53d5e13cc0f2
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"cbeb5b95-ef6e-496a-8978-53d5e13cc0f2\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"cc9eb089-06b8-4839-826e-431fb1e6d6f5\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"59199e6d5552719234c7dc11427a8d5e820cc61d46e544fdf9774f2d2a20fdf6\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"585dd9db-c94b-43e8-9e9b-3807c4d4cdc0\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8fb98215835a62423081338fd157865f2ac4aec2f2398a4cca63e43bbe0bcc94\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 18373, \"end_char_idx\": 19977, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "#T_b01a0_row0_col3, #T_b01a0_row1_col0, #T_b01a0_row1_col1, #T_b01a0_row1_col2, #T_b01a0_row1_col3, #T_b01a0_row2_col0, #T_b01a0_row2_col1, #T_b01a0_row2_col2, #T_b01a0_row2_col3, #T_b01a0_row3_col0, #T_b01a0_row3_col1, #T_b01a0_row3_col2, #T_b01a0_row3_col3, #T_b01a0_row4_col0, #T_b01a0_row4_col1, #T_b01a0_row4_col2, #T_b01a0_row4_col3, #T_b01a0_row5_col0, #T_b01a0_row5_col1, #T_b01a0_row5_col2, #T_b01a0_row5_col3, #T_b01a0_row6_col0, #T_b01a0_row6_col1, #T_b01a0_row6_col2, #T_b01a0_row6_col3, #T_b01a0_row7_col0, #T_b01a0_row7_col1, #T_b01a0_row7_col2, #T_b01a0_row7_col3, #T_b01a0_row8_col0, #T_b01a0_row8_col1, #T_b01a0_row8_col2, #T_b01a0_row8_col3, #T_b01a0_row9_col0, #T_b01a0_row9_col1, #T_b01a0_row9_col2, #T_b01a0_row9_col3 {\n  background-color: white;\n  color: black;\n}\n</style>\n<table id=\"T_b01a0\">\n  <thead>\n    <tr>\n      <th class=\"blank level0\" >&nbsp;</th>\n      <th id=\"T_b01a0_level0_col0\" class=\"col_heading level0 col0\" >Prompt</th>\n      <th id=\"T_b01a0_level0_col1\" class=\"col_heading level0 col1\" >Actual</th>\n      <th id=\"T_b01a0_level0_col2\" class=\"col_heading level0 col2\" >Expected</th>\n      <th id=\"T_b01a0_level0_col3\" class=\"col_heading level0 col3\" >Match</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th id=\"T_b01a0_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n      <td id=\"T_b01a0_row0_col0\" class=\"data row0 col0\" >Land the drone at the home base</td>\n      <td id=\"T_b01a0_row0_col1\" class=\"data row0 col1\" >land_drone</td>\n      <td id=\"T_b01a0_row0_col2\" class=\"data row0 col2\" >land_drone</td>\n      <td id=\"T_b01a0_row0_col3\" class=\"data row0"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 585dd9db-c94b-43e8-9e9b-3807c4d4cdc0
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"585dd9db-c94b-43e8-9e9b-3807c4d4cdc0\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"cbeb5b95-ef6e-496a-8978-53d5e13cc0f2\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"35f5e14537a0ec958d37a125b6d915925c971d994f8a6215bb4248417ca9c4a5\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"a7316417-1f51-4bc7-b271-f62699a9216b\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"1911d06797c0c5a89e9f69dd933499ad41e3c337eeb6fb78ddc4e0d6e741bb57\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 19053, \"end_char_idx\": 20806, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "#T_b01a0_row9_col1, #T_b01a0_row9_col2, #T_b01a0_row9_col3 {\n  background-color: white;\n  color: black;\n}\n</style>\n<table id=\"T_b01a0\">\n  <thead>\n    <tr>\n      <th class=\"blank level0\" >&nbsp;</th>\n      <th id=\"T_b01a0_level0_col0\" class=\"col_heading level0 col0\" >Prompt</th>\n      <th id=\"T_b01a0_level0_col1\" class=\"col_heading level0 col1\" >Actual</th>\n      <th id=\"T_b01a0_level0_col2\" class=\"col_heading level0 col2\" >Expected</th>\n      <th id=\"T_b01a0_level0_col3\" class=\"col_heading level0 col3\" >Match</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th id=\"T_b01a0_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n      <td id=\"T_b01a0_row0_col0\" class=\"data row0 col0\" >Land the drone at the home base</td>\n      <td id=\"T_b01a0_row0_col1\" class=\"data row0 col1\" >land_drone</td>\n      <td id=\"T_b01a0_row0_col2\" class=\"data row0 col2\" >land_drone</td>\n      <td id=\"T_b01a0_row0_col3\" class=\"data row0 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n      <td id=\"T_b01a0_row1_col0\" class=\"data row1 col0\" >Take off the drone to 50 meters</td>\n      <td id=\"T_b01a0_row1_col1\" class=\"data row1 col1\" >takeoff_drone</td>\n      <td id=\"T_b01a0_row1_col2\" class=\"data row1 col2\" >takeoff_drone</td>\n      <td id=\"T_b01a0_row1_col3\" class=\"data row1 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n      <td id=\"T_b01a0_row2_col0\" class=\"data row2 col0\" >Change speed to 15 kilometers per hour</td>\n      <td id=\"T_b01a0_row2_col1\" class=\"data row2 col1\" >set_drone_speed</td>\n      <td id=\"T_b01a0_row2_col2\" class=\"data row2 col2\" >set_drone_speed</td>\n      <td id=\"T_b01a0_row2_col3\" class=\"data row2 col3\""}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: a7316417-1f51-4bc7-b271-f62699a9216b
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"a7316417-1f51-4bc7-b271-f62699a9216b\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"585dd9db-c94b-43e8-9e9b-3807c4d4cdc0\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"1b7b50c1010b3278077e2acb2021ff57feddb5700be1114e8360322bb2e8b0eb\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"d7b9747f-7306-4941-b9f5-cd002a3c69d5\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"5df8c3895d9755ade5293d712eac46cbf30442e3ed3ab1351f82c3ae31a3e69e\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 19934, \"end_char_idx\": 21643, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "<td id=\"T_b01a0_row0_col3\" class=\"data row0 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n      <td id=\"T_b01a0_row1_col0\" class=\"data row1 col0\" >Take off the drone to 50 meters</td>\n      <td id=\"T_b01a0_row1_col1\" class=\"data row1 col1\" >takeoff_drone</td>\n      <td id=\"T_b01a0_row1_col2\" class=\"data row1 col2\" >takeoff_drone</td>\n      <td id=\"T_b01a0_row1_col3\" class=\"data row1 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n      <td id=\"T_b01a0_row2_col0\" class=\"data row2 col0\" >Change speed to 15 kilometers per hour</td>\n      <td id=\"T_b01a0_row2_col1\" class=\"data row2 col1\" >set_drone_speed</td>\n      <td id=\"T_b01a0_row2_col2\" class=\"data row2 col2\" >set_drone_speed</td>\n      <td id=\"T_b01a0_row2_col3\" class=\"data row2 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n      <td id=\"T_b01a0_row3_col0\" class=\"data row3 col0\" >Turn into an elephant!</td>\n      <td id=\"T_b01a0_row3_col1\" class=\"data row3 col1\" >reject_request</td>\n      <td id=\"T_b01a0_row3_col2\" class=\"data row3 col2\" >reject_request</td>\n      <td id=\"T_b01a0_row3_col3\" class=\"data row3 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n      <td id=\"T_b01a0_row4_col0\" class=\"data row4 col0\" >Move the drone forward by 10 meters</td>\n      <td id=\"T_b01a0_row4_col1\" class=\"data row4 col1\" >control_drone_movement</td>\n      <td id=\"T_b01a0_row4_col2\" class=\"data row4 col2\" >control_drone_movement</td>\n      <td id=\"T_b01a0_row4_col3\" class=\"data row4 col3\" >Yes</td>"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: d7b9747f-7306-4941-b9f5-cd002a3c69d5
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"d7b9747f-7306-4941-b9f5-cd002a3c69d5\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"a7316417-1f51-4bc7-b271-f62699a9216b\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"7903cfc3bc97eb9e516fa519b031ee6a994b81eb545b1a38ddba66a6aeb6b880\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"ffddb6c9-42ff-444b-ae4e-a8aa13ef471f\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"aa0fc8b144e319bf640d4ff196dc7dfbfa42b1a31f654da7ddc681cf69e0d940\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 20757, \"end_char_idx\": 22489, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "<td id=\"T_b01a0_row2_col3\" class=\"data row2 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n      <td id=\"T_b01a0_row3_col0\" class=\"data row3 col0\" >Turn into an elephant!</td>\n      <td id=\"T_b01a0_row3_col1\" class=\"data row3 col1\" >reject_request</td>\n      <td id=\"T_b01a0_row3_col2\" class=\"data row3 col2\" >reject_request</td>\n      <td id=\"T_b01a0_row3_col3\" class=\"data row3 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n      <td id=\"T_b01a0_row4_col0\" class=\"data row4 col0\" >Move the drone forward by 10 meters</td>\n      <td id=\"T_b01a0_row4_col1\" class=\"data row4 col1\" >control_drone_movement</td>\n      <td id=\"T_b01a0_row4_col2\" class=\"data row4 col2\" >control_drone_movement</td>\n      <td id=\"T_b01a0_row4_col3\" class=\"data row4 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row5\" class=\"row_heading level0 row5\" >5</th>\n      <td id=\"T_b01a0_row5_col0\" class=\"data row5 col0\" >I want the LED display to blink in red</td>\n      <td id=\"T_b01a0_row5_col1\" class=\"data row5 col1\" >configure_led_display</td>\n      <td id=\"T_b01a0_row5_col2\" class=\"data row5 col2\" >configure_led_display</td>\n      <td id=\"T_b01a0_row5_col3\" class=\"data row5 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row6\" class=\"row_heading level0 row6\" >6</th>\n      <td id=\"T_b01a0_row6_col0\" class=\"data row6 col0\" >Can you take a photo?</td>\n      <td id=\"T_b01a0_row6_col1\" class=\"data row6 col1\" >control_camera</td>\n      <td id=\"T_b01a0_row6_col2\" class=\"data row6 col2\" >control_camera</td>\n      <td id=\"T_b01a0_row6_col3\" class=\"data row6 col3\" >Yes</td>\n    </tr>\n    <tr>"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: ffddb6c9-42ff-444b-ae4e-a8aa13ef471f
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"ffddb6c9-42ff-444b-ae4e-a8aa13ef471f\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"d7b9747f-7306-4941-b9f5-cd002a3c69d5\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"6bd069f32e7bdc2705cab8b6f2938799e37e39d79703866f461b739bcd47572a\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"df224231-770c-44c6-bf3b-ec8b93059d33\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"4ad821a896ad716de7bcc5fa03c178fe35bf57796cac05acbca1250db3a88c30\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 21611, \"end_char_idx\": 23340, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "class=\"data row4 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row5\" class=\"row_heading level0 row5\" >5</th>\n      <td id=\"T_b01a0_row5_col0\" class=\"data row5 col0\" >I want the LED display to blink in red</td>\n      <td id=\"T_b01a0_row5_col1\" class=\"data row5 col1\" >configure_led_display</td>\n      <td id=\"T_b01a0_row5_col2\" class=\"data row5 col2\" >configure_led_display</td>\n      <td id=\"T_b01a0_row5_col3\" class=\"data row5 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row6\" class=\"row_heading level0 row6\" >6</th>\n      <td id=\"T_b01a0_row6_col0\" class=\"data row6 col0\" >Can you take a photo?</td>\n      <td id=\"T_b01a0_row6_col1\" class=\"data row6 col1\" >control_camera</td>\n      <td id=\"T_b01a0_row6_col2\" class=\"data row6 col2\" >control_camera</td>\n      <td id=\"T_b01a0_row6_col3\" class=\"data row6 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row7\" class=\"row_heading level0 row7\" >7</th>\n      <td id=\"T_b01a0_row7_col0\" class=\"data row7 col0\" >Can you detect obstacles?</td>\n      <td id=\"T_b01a0_row7_col1\" class=\"data row7 col1\" >set_obstacle_avoidance</td>\n      <td id=\"T_b01a0_row7_col2\" class=\"data row7 col2\" >set_obstacle_avoidance</td>\n      <td id=\"T_b01a0_row7_col3\" class=\"data row7 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row8\" class=\"row_heading level0 row8\" >8</th>\n      <td id=\"T_b01a0_row8_col0\" class=\"data row8 col0\" >Can you dance for me?</td>\n      <td id=\"T_b01a0_row8_col1\" class=\"data row8 col1\" >reject_request</td>\n      <td id=\"T_b01a0_row8_col2\" class=\"data row8 col2\" >reject_request</td>\n      <td id=\"T_b01a0_row8_col3\" class=\"data row8 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row9\""}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: df224231-770c-44c6-bf3b-ec8b93059d33
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"df224231-770c-44c6-bf3b-ec8b93059d33\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"ffddb6c9-42ff-444b-ae4e-a8aa13ef471f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"181912c5b078da0a038b8514e196f3ffa99e49689aa50769dc638e52f5bb7cda\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"934a289d-3097-453a-b032-b06cc58da996\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"ca0a30934681d4f01a9f388d711abaf886f2efd88cf5d7ca716aea6ed8d47c50\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 22475, \"end_char_idx\": 24085, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "</tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row7\" class=\"row_heading level0 row7\" >7</th>\n      <td id=\"T_b01a0_row7_col0\" class=\"data row7 col0\" >Can you detect obstacles?</td>\n      <td id=\"T_b01a0_row7_col1\" class=\"data row7 col1\" >set_obstacle_avoidance</td>\n      <td id=\"T_b01a0_row7_col2\" class=\"data row7 col2\" >set_obstacle_avoidance</td>\n      <td id=\"T_b01a0_row7_col3\" class=\"data row7 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row8\" class=\"row_heading level0 row8\" >8</th>\n      <td id=\"T_b01a0_row8_col0\" class=\"data row8 col0\" >Can you dance for me?</td>\n      <td id=\"T_b01a0_row8_col1\" class=\"data row8 col1\" >reject_request</td>\n      <td id=\"T_b01a0_row8_col2\" class=\"data row8 col2\" >reject_request</td>\n      <td id=\"T_b01a0_row8_col3\" class=\"data row8 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row9\" class=\"row_heading level0 row9\" >9</th>\n      <td id=\"T_b01a0_row9_col0\" class=\"data row9 col0\" >Can you follow me?</td>\n      <td id=\"T_b01a0_row9_col1\" class=\"data row9 col1\" >set_follow_me_mode</td>\n      <td id=\"T_b01a0_row9_col2\" class=\"data row9 col2\" >set_follow_me_mode</td>\n      <td id=\"T_b01a0_row9_col3\" class=\"data row9 col3\" >Yes</td>\n    </tr>\n  </tbody>\n</table>\n\n\n\n    Number of matches: 10 out of 10 (100.00%)\n    Average latency per request: 826.81 ms\n    Average tokens used per request: 796.20\n\n\nNice! The model performs quite well with these requests. Now let's try some more difficult requests: requests that are _almost_ feasible and are drone-related, but that the drone cannot actually do, and the pilot should reject."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 934a289d-3097-453a-b032-b06cc58da996
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"934a289d-3097-453a-b032-b06cc58da996\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"df224231-770c-44c6-bf3b-ec8b93059d33\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a7275c60449b36aa36443bf2243a5481e78443657d97dacb1aab0ce83dfdac6a\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"7550d121-d865-4638-8916-aa36501da9e9\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"5ae6de274178b7a35d3c1c613f406eeb967b80877c973ee33f493144861b36f2\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 23016, \"end_char_idx\": 25255, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "class=\"data row8 col0\" >Can you dance for me?</td>\n      <td id=\"T_b01a0_row8_col1\" class=\"data row8 col1\" >reject_request</td>\n      <td id=\"T_b01a0_row8_col2\" class=\"data row8 col2\" >reject_request</td>\n      <td id=\"T_b01a0_row8_col3\" class=\"data row8 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_b01a0_level0_row9\" class=\"row_heading level0 row9\" >9</th>\n      <td id=\"T_b01a0_row9_col0\" class=\"data row9 col0\" >Can you follow me?</td>\n      <td id=\"T_b01a0_row9_col1\" class=\"data row9 col1\" >set_follow_me_mode</td>\n      <td id=\"T_b01a0_row9_col2\" class=\"data row9 col2\" >set_follow_me_mode</td>\n      <td id=\"T_b01a0_row9_col3\" class=\"data row9 col3\" >Yes</td>\n    </tr>\n  </tbody>\n</table>\n\n\n\n    Number of matches: 10 out of 10 (100.00%)\n    Average latency per request: 826.81 ms\n    Average tokens used per request: 796.20\n\n\nNice! The model performs quite well with these requests. Now let's try some more difficult requests: requests that are _almost_ feasible and are drone-related, but that the drone cannot actually do, and the pilot should reject.\n\n\n\n```python\nchallenging_prompts_to_expected = {\n    \"Play pre-recorded audio message\": \"reject_request\",\n    \"Initiate following on social media\": \"reject_request\",\n    \"Scan environment for heat signatures\": \"reject_request\",\n    \"Bump into obstacles\": \"reject_request\",\n    \"Change drone's paint job color\": \"reject_request\",\n    \"Coordinate with nearby drones\": \"reject_request\",\n    \"Change speed to negative 120 km/h\": \"reject_request\",\n    \"Detect a person\": \"reject_request\",\n    \"Please enable night vision\": \"reject_request\",\n    \"Report on humidity levels around you\": \"reject_request\",\n}\n```\n\n\n```python\n# Evaluate the model with the challenging prompts\neval(\n    model=\"gpt-3.5-turbo\",\n    function_list=function_list,\n    system_prompt=DRONE_SYSTEM_PROMPT,\n    prompts_to_expected_tool_name=challenging_prompts_to_expected,\n)\n```\n\n\n<style type=\"text/css\">\n#T_99c20_row0_col0, #T_99c20_row0_col1, #T_99c20_row0_col2, #T_99c20_row0_col3, #T_99c20_row2_col0, #T_99c20_row2_col1, #T_99c20_row2_col2, #T_99c20_row2_col3, #T_99c20_row4_col0, #T_99c20_row4_col1, #T_99c20_row4_col2, #T_99c20_row4_col3, #T_99c20_row5_col0, #T_99c20_row5_col1, #T_99c20_row5_col2,"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 7550d121-d865-4638-8916-aa36501da9e9
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"7550d121-d865-4638-8916-aa36501da9e9\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"934a289d-3097-453a-b032-b06cc58da996\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0452174a0659522784d7946f1cb32a69727587589aa49f5f6137a7798cd9195b\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"17b33714-fb2d-44e9-a3a4-eeb2f34feab9\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"03af495ea6d16222415a155b5a22aa29d095af25d4a6dea5c466621c95e78345\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 24089, \"end_char_idx\": 26085, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "```python\nchallenging_prompts_to_expected = {\n    \"Play pre-recorded audio message\": \"reject_request\",\n    \"Initiate following on social media\": \"reject_request\",\n    \"Scan environment for heat signatures\": \"reject_request\",\n    \"Bump into obstacles\": \"reject_request\",\n    \"Change drone's paint job color\": \"reject_request\",\n    \"Coordinate with nearby drones\": \"reject_request\",\n    \"Change speed to negative 120 km/h\": \"reject_request\",\n    \"Detect a person\": \"reject_request\",\n    \"Please enable night vision\": \"reject_request\",\n    \"Report on humidity levels around you\": \"reject_request\",\n}\n```\n\n\n```python\n# Evaluate the model with the challenging prompts\neval(\n    model=\"gpt-3.5-turbo\",\n    function_list=function_list,\n    system_prompt=DRONE_SYSTEM_PROMPT,\n    prompts_to_expected_tool_name=challenging_prompts_to_expected,\n)\n```\n\n\n<style type=\"text/css\">\n#T_99c20_row0_col0, #T_99c20_row0_col1, #T_99c20_row0_col2, #T_99c20_row0_col3, #T_99c20_row2_col0, #T_99c20_row2_col1, #T_99c20_row2_col2, #T_99c20_row2_col3, #T_99c20_row4_col0, #T_99c20_row4_col1, #T_99c20_row4_col2, #T_99c20_row4_col3, #T_99c20_row5_col0, #T_99c20_row5_col1, #T_99c20_row5_col2, #T_99c20_row5_col3, #T_99c20_row7_col0, #T_99c20_row7_col1, #T_99c20_row7_col2, #T_99c20_row7_col3, #T_99c20_row9_col0, #T_99c20_row9_col1, #T_99c20_row9_col2, #T_99c20_row9_col3 {\n  background-color: white;\n  color: black;\n}\n#T_99c20_row1_col0, #T_99c20_row1_col1, #T_99c20_row1_col2, #T_99c20_row1_col3, #T_99c20_row3_col0, #T_99c20_row3_col1, #T_99c20_row3_col2, #T_99c20_row3_col3, #T_99c20_row6_col0, #T_99c20_row6_col1, #T_99c20_row6_col2, #T_99c20_row6_col3, #T_99c20_row8_col0, #T_99c20_row8_col1, #T_99c20_row8_col2, #T_99c20_row8_col3 {\n  background-color: red;\n  color: black;\n}\n</style>\n<table id=\"T_99c20\">\n  <thead>\n    <tr>\n      <th class=\"blank level0\" >&nbsp;</th>\n      <th id=\"T_99c20_level0_col0\" class=\"col_heading level0 col0\" >Prompt</th>\n      <th id=\"T_99c20_level0_col1\" class=\"col_heading level0 col1\""}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 17b33714-fb2d-44e9-a3a4-eeb2f34feab9
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"17b33714-fb2d-44e9-a3a4-eeb2f34feab9\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"7550d121-d865-4638-8916-aa36501da9e9\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"8d956fc19d4ca539a592671574560ab1a784bd72106841594f979757e0b438ec\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"a3ecd328-3fad-4263-948e-51d21bc271f4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"af1bc7b99b966e5828a08ad1bb375d0eb7b9fd40274c92e444b476e6af707589\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 25256, \"end_char_idx\": 26935, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "#T_99c20_row5_col3, #T_99c20_row7_col0, #T_99c20_row7_col1, #T_99c20_row7_col2, #T_99c20_row7_col3, #T_99c20_row9_col0, #T_99c20_row9_col1, #T_99c20_row9_col2, #T_99c20_row9_col3 {\n  background-color: white;\n  color: black;\n}\n#T_99c20_row1_col0, #T_99c20_row1_col1, #T_99c20_row1_col2, #T_99c20_row1_col3, #T_99c20_row3_col0, #T_99c20_row3_col1, #T_99c20_row3_col2, #T_99c20_row3_col3, #T_99c20_row6_col0, #T_99c20_row6_col1, #T_99c20_row6_col2, #T_99c20_row6_col3, #T_99c20_row8_col0, #T_99c20_row8_col1, #T_99c20_row8_col2, #T_99c20_row8_col3 {\n  background-color: red;\n  color: black;\n}\n</style>\n<table id=\"T_99c20\">\n  <thead>\n    <tr>\n      <th class=\"blank level0\" >&nbsp;</th>\n      <th id=\"T_99c20_level0_col0\" class=\"col_heading level0 col0\" >Prompt</th>\n      <th id=\"T_99c20_level0_col1\" class=\"col_heading level0 col1\" >Actual</th>\n      <th id=\"T_99c20_level0_col2\" class=\"col_heading level0 col2\" >Expected</th>\n      <th id=\"T_99c20_level0_col3\" class=\"col_heading level0 col3\" >Match</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th id=\"T_99c20_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n      <td id=\"T_99c20_row0_col0\" class=\"data row0 col0\" >Play pre-recorded audio message</td>\n      <td id=\"T_99c20_row0_col1\" class=\"data row0 col1\" >reject_request</td>\n      <td id=\"T_99c20_row0_col2\" class=\"data row0 col2\" >reject_request</td>\n      <td id=\"T_99c20_row0_col3\" class=\"data row0 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n      <td id=\"T_99c20_row1_col0\" class=\"data row1 col0\" >Initiate following on social media</td>\n      <td id=\"T_99c20_row1_col1\" class=\"data row1 col1\""}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: a3ecd328-3fad-4263-948e-51d21bc271f4
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"a3ecd328-3fad-4263-948e-51d21bc271f4\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"17b33714-fb2d-44e9-a3a4-eeb2f34feab9\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"327528862e86521b2867cdd982cfcd3b842b423384b1083a3ea33480bd8797fc\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"f7457166-baee-406c-a8f1-4919d42985b4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"2dab33f6d940bf817ce791cd8e35166c8f37ccccf1df387c4733152144a00ada\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 26025, \"end_char_idx\": 27786, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "<th id=\"T_99c20_level0_col1\" class=\"col_heading level0 col1\" >Actual</th>\n      <th id=\"T_99c20_level0_col2\" class=\"col_heading level0 col2\" >Expected</th>\n      <th id=\"T_99c20_level0_col3\" class=\"col_heading level0 col3\" >Match</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th id=\"T_99c20_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n      <td id=\"T_99c20_row0_col0\" class=\"data row0 col0\" >Play pre-recorded audio message</td>\n      <td id=\"T_99c20_row0_col1\" class=\"data row0 col1\" >reject_request</td>\n      <td id=\"T_99c20_row0_col2\" class=\"data row0 col2\" >reject_request</td>\n      <td id=\"T_99c20_row0_col3\" class=\"data row0 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n      <td id=\"T_99c20_row1_col0\" class=\"data row1 col0\" >Initiate following on social media</td>\n      <td id=\"T_99c20_row1_col1\" class=\"data row1 col1\" >set_follow_me_mode</td>\n      <td id=\"T_99c20_row1_col2\" class=\"data row1 col2\" >reject_request</td>\n      <td id=\"T_99c20_row1_col3\" class=\"data row1 col3\" >No</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n      <td id=\"T_99c20_row2_col0\" class=\"data row2 col0\" >Scan environment for heat signatures</td>\n      <td id=\"T_99c20_row2_col1\" class=\"data row2 col1\" >reject_request</td>\n      <td id=\"T_99c20_row2_col2\" class=\"data row2 col2\" >reject_request</td>\n      <td id=\"T_99c20_row2_col3\" class=\"data row2 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n      <td id=\"T_99c20_row3_col0\" class=\"data row3 col0\" >Bump into obstacles</td>\n      <td id=\"T_99c20_row3_col1\" class=\"data row3 col1\" >set_obstacle_avoidance</td>\n      <td"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: f7457166-baee-406c-a8f1-4919d42985b4
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"f7457166-baee-406c-a8f1-4919d42985b4\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"a3ecd328-3fad-4263-948e-51d21bc271f4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"6ce1e7897a4a19e0f1cebe41919ac4a660fe99f53d8144e45bac502695a98655\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"5c17690f-650b-4650-a77d-60eefbec271d\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"533ba1fa91c68ed807c404625ba14c81fc56e53430eb4c8484e9bc13a3389901\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 26886, \"end_char_idx\": 28633, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "<td id=\"T_99c20_row1_col1\" class=\"data row1 col1\" >set_follow_me_mode</td>\n      <td id=\"T_99c20_row1_col2\" class=\"data row1 col2\" >reject_request</td>\n      <td id=\"T_99c20_row1_col3\" class=\"data row1 col3\" >No</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n      <td id=\"T_99c20_row2_col0\" class=\"data row2 col0\" >Scan environment for heat signatures</td>\n      <td id=\"T_99c20_row2_col1\" class=\"data row2 col1\" >reject_request</td>\n      <td id=\"T_99c20_row2_col2\" class=\"data row2 col2\" >reject_request</td>\n      <td id=\"T_99c20_row2_col3\" class=\"data row2 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n      <td id=\"T_99c20_row3_col0\" class=\"data row3 col0\" >Bump into obstacles</td>\n      <td id=\"T_99c20_row3_col1\" class=\"data row3 col1\" >set_obstacle_avoidance</td>\n      <td id=\"T_99c20_row3_col2\" class=\"data row3 col2\" >reject_request</td>\n      <td id=\"T_99c20_row3_col3\" class=\"data row3 col3\" >No</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n      <td id=\"T_99c20_row4_col0\" class=\"data row4 col0\" >Change drone's paint job color</td>\n      <td id=\"T_99c20_row4_col1\" class=\"data row4 col1\" >reject_request</td>\n      <td id=\"T_99c20_row4_col2\" class=\"data row4 col2\" >reject_request</td>\n      <td id=\"T_99c20_row4_col3\" class=\"data row4 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row5\" class=\"row_heading level0 row5\" >5</th>\n      <td id=\"T_99c20_row5_col0\" class=\"data row5 col0\" >Coordinate with nearby drones</td>\n      <td id=\"T_99c20_row5_col1\" class=\"data row5 col1\" >reject_request</td>\n      <td id=\"T_99c20_row5_col2\" class=\"data"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 5c17690f-650b-4650-a77d-60eefbec271d
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"5c17690f-650b-4650-a77d-60eefbec271d\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f7457166-baee-406c-a8f1-4919d42985b4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"614ba95529fc5cbb28096cc57baa7a399460aa33a1e9d3a68e86fe4a130777fb\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"b029c671-3ef8-4fec-9e3b-553235110c51\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"1eeb26238f8dec1ced8908ddf5e8c315638e008826587755e963360436c0b798\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 27725, \"end_char_idx\": 29467, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "class=\"data row3 col1\" >set_obstacle_avoidance</td>\n      <td id=\"T_99c20_row3_col2\" class=\"data row3 col2\" >reject_request</td>\n      <td id=\"T_99c20_row3_col3\" class=\"data row3 col3\" >No</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n      <td id=\"T_99c20_row4_col0\" class=\"data row4 col0\" >Change drone's paint job color</td>\n      <td id=\"T_99c20_row4_col1\" class=\"data row4 col1\" >reject_request</td>\n      <td id=\"T_99c20_row4_col2\" class=\"data row4 col2\" >reject_request</td>\n      <td id=\"T_99c20_row4_col3\" class=\"data row4 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row5\" class=\"row_heading level0 row5\" >5</th>\n      <td id=\"T_99c20_row5_col0\" class=\"data row5 col0\" >Coordinate with nearby drones</td>\n      <td id=\"T_99c20_row5_col1\" class=\"data row5 col1\" >reject_request</td>\n      <td id=\"T_99c20_row5_col2\" class=\"data row5 col2\" >reject_request</td>\n      <td id=\"T_99c20_row5_col3\" class=\"data row5 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row6\" class=\"row_heading level0 row6\" >6</th>\n      <td id=\"T_99c20_row6_col0\" class=\"data row6 col0\" >Change speed to negative 120 km/h</td>\n      <td id=\"T_99c20_row6_col1\" class=\"data row6 col1\" >set_drone_speed</td>\n      <td id=\"T_99c20_row6_col2\" class=\"data row6 col2\" >reject_request</td>\n      <td id=\"T_99c20_row6_col3\" class=\"data row6 col3\" >No</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row7\" class=\"row_heading level0 row7\" >7</th>\n      <td id=\"T_99c20_row7_col0\" class=\"data row7 col0\" >Detect a person</td>\n      <td id=\"T_99c20_row7_col1\" class=\"data row7 col1\" >reject_request</td>\n      <td id=\"T_99c20_row7_col2\" class=\"data row7 col2\" >reject_request</td>"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: b029c671-3ef8-4fec-9e3b-553235110c51
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"b029c671-3ef8-4fec-9e3b-553235110c51\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"5c17690f-650b-4650-a77d-60eefbec271d\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"fdbae09f9a3daa588c0c0d94b1ab2d14c9d08d0ac7001d5c48c5dfc2e0e88cf0\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"da28f872-ba51-47da-be43-233a1983689f\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"0dda9a47d6099a5e419e46c1004c5654aac18507d2f806789c136402ca2fa325\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 28595, \"end_char_idx\": 30296, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "<td id=\"T_99c20_row5_col2\" class=\"data row5 col2\" >reject_request</td>\n      <td id=\"T_99c20_row5_col3\" class=\"data row5 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row6\" class=\"row_heading level0 row6\" >6</th>\n      <td id=\"T_99c20_row6_col0\" class=\"data row6 col0\" >Change speed to negative 120 km/h</td>\n      <td id=\"T_99c20_row6_col1\" class=\"data row6 col1\" >set_drone_speed</td>\n      <td id=\"T_99c20_row6_col2\" class=\"data row6 col2\" >reject_request</td>\n      <td id=\"T_99c20_row6_col3\" class=\"data row6 col3\" >No</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row7\" class=\"row_heading level0 row7\" >7</th>\n      <td id=\"T_99c20_row7_col0\" class=\"data row7 col0\" >Detect a person</td>\n      <td id=\"T_99c20_row7_col1\" class=\"data row7 col1\" >reject_request</td>\n      <td id=\"T_99c20_row7_col2\" class=\"data row7 col2\" >reject_request</td>\n      <td id=\"T_99c20_row7_col3\" class=\"data row7 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row8\" class=\"row_heading level0 row8\" >8</th>\n      <td id=\"T_99c20_row8_col0\" class=\"data row8 col0\" >Please enable night vision</td>\n      <td id=\"T_99c20_row8_col1\" class=\"data row8 col1\" >set_drone_lighting</td>\n      <td id=\"T_99c20_row8_col2\" class=\"data row8 col2\" >reject_request</td>\n      <td id=\"T_99c20_row8_col3\" class=\"data row8 col3\" >No</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row9\" class=\"row_heading level0 row9\" >9</th>\n      <td id=\"T_99c20_row9_col0\" class=\"data row9 col0\" >Report on humidity levels around you</td>\n      <td id=\"T_99c20_row9_col1\" class=\"data row9 col1\" >reject_request</td>\n      <td id=\"T_99c20_row9_col2\" class=\"data row9 col2\" >reject_request</td>\n      <td"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: da28f872-ba51-47da-be43-233a1983689f
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"da28f872-ba51-47da-be43-233a1983689f\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"b029c671-3ef8-4fec-9e3b-553235110c51\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"5a2b532ae65617ee3c9dd975e152d7b7354f60d53fbd30ee1419c6c63b2bda71\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"dfe14c26-f6bc-49b4-a200-8887070ba5d9\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"e929d6833418b0c3ac4cb65ebfb1329b88059ea2806617bd3fe5f6c182161f64\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 29397, \"end_char_idx\": 31942, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "<td id=\"T_99c20_row7_col2\" class=\"data row7 col2\" >reject_request</td>\n      <td id=\"T_99c20_row7_col3\" class=\"data row7 col3\" >Yes</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row8\" class=\"row_heading level0 row8\" >8</th>\n      <td id=\"T_99c20_row8_col0\" class=\"data row8 col0\" >Please enable night vision</td>\n      <td id=\"T_99c20_row8_col1\" class=\"data row8 col1\" >set_drone_lighting</td>\n      <td id=\"T_99c20_row8_col2\" class=\"data row8 col2\" >reject_request</td>\n      <td id=\"T_99c20_row8_col3\" class=\"data row8 col3\" >No</td>\n    </tr>\n    <tr>\n      <th id=\"T_99c20_level0_row9\" class=\"row_heading level0 row9\" >9</th>\n      <td id=\"T_99c20_row9_col0\" class=\"data row9 col0\" >Report on humidity levels around you</td>\n      <td id=\"T_99c20_row9_col1\" class=\"data row9 col1\" >reject_request</td>\n      <td id=\"T_99c20_row9_col2\" class=\"data row9 col2\" >reject_request</td>\n      <td id=\"T_99c20_row9_col3\" class=\"data row9 col3\" >Yes</td>\n    </tr>\n  </tbody>\n</table>\n\n\n\n    Number of matches: 6 out of 10 (60.00%)\n    Average latency per request: 610.26 ms\n    Average tokens used per request: 791.90\n\n\nNow we run into some problems.\nThe model here should reject all of these requests, as they are impossible/conflicting/ambiguous given the functions, however instead the model calls functions that are somewhat related to the request, but incorrect. For example, the model sets follow_me_mode when asked to initiate following on social media.\n\n<br>\nIn this simple case, more prompt engineering may resolve some of these issues, but for the purpose of this example we will demonstrate how fine tuning can be used to improve performance. Additionally, while this case is relatively straightforward, as the number of and complexity of the functions increases, fine tuning becomes more and more impactful.\n\nAgain, our goal here is to improve performance and use less tokens, so fine-tuning allows us to:\n\n- Omit function and parameter descriptions: remove the description field from function and parameters\n- Omit parameters: remove the entire properties field from the parameters object\n- Omit function entirely: remove the entire function object from the functions array\n\n\n# Generating synthetic data\n\n\n### Helper functions\n\n\nWe want to generate every invocation of every function, so that we have\nfull coverage of all potential invocations to create synthetic data for. Then, we will use `gpt-4o` to come up with prompts that would call each invocation, and we will use that prompt - function invocation pair as training data."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: dfe14c26-f6bc-49b4-a200-8887070ba5d9
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"dfe14c26-f6bc-49b4-a200-8887070ba5d9\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"da28f872-ba51-47da-be43-233a1983689f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"fb5c5a2b1e3527a7ba47e7d575126e9947afcd8bd93c2a3d0b541569bb028fd1\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"f4ca57c5-4d4a-40b9-9f0d-ad761aa11851\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"edc60e07775f0fecace101e6faa2dc2387528bf4072d4b8fd85b8747821d105d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 30189, \"end_char_idx\": 33378, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": ">reject_request</td>\n      <td id=\"T_99c20_row9_col2\" class=\"data row9 col2\" >reject_request</td>\n      <td id=\"T_99c20_row9_col3\" class=\"data row9 col3\" >Yes</td>\n    </tr>\n  </tbody>\n</table>\n\n\n\n    Number of matches: 6 out of 10 (60.00%)\n    Average latency per request: 610.26 ms\n    Average tokens used per request: 791.90\n\n\nNow we run into some problems.\nThe model here should reject all of these requests, as they are impossible/conflicting/ambiguous given the functions, however instead the model calls functions that are somewhat related to the request, but incorrect. For example, the model sets follow_me_mode when asked to initiate following on social media.\n\n<br>\nIn this simple case, more prompt engineering may resolve some of these issues, but for the purpose of this example we will demonstrate how fine tuning can be used to improve performance. Additionally, while this case is relatively straightforward, as the number of and complexity of the functions increases, fine tuning becomes more and more impactful.\n\nAgain, our goal here is to improve performance and use less tokens, so fine-tuning allows us to:\n\n- Omit function and parameter descriptions: remove the description field from function and parameters\n- Omit parameters: remove the entire properties field from the parameters object\n- Omit function entirely: remove the entire function object from the functions array\n\n\n# Generating synthetic data\n\n\n### Helper functions\n\n\nWe want to generate every invocation of every function, so that we have\nfull coverage of all potential invocations to create synthetic data for. Then, we will use `gpt-4o` to come up with prompts that would call each invocation, and we will use that prompt - function invocation pair as training data.\n\n\nGenerating every invocation for a function with fixed enums is more simple, but for a function such as\n`control_gimbal` we need to set the `tilt` and `pan` integer values, so to generate those synthetic invocations we will first set a placeholder, and then later use `gpt-4o` to come up with reasonable values.\n\n\n\n```python\nplaceholder_int = \"fill_in_int\"\nplaceholder_string = \"fill_in_string\"\n```\n\nThe functions below take in all the functions from the function list, and look\nat all the potential invocations of those functions given each function's parameters.\nThe functions also account for `required` parameters, so that all the invocations\nare actually feasible.\n\n\n\n```python\ndef generate_permutations(\n    params: Dict[str, Dict[str, Any]]\n) -> Generator[Dict[str, Any], None, None]:\n    \"\"\"\n    Generates all possible permutations for given parameters.\n\n    :param params: Parameter dictionary containing required and optional fields.\n    :return: A generator yielding each permutation.\n    \"\"\"\n\n    # Extract the required fields from the parameters\n    required_fields = params.get(\"required\", [])\n\n    # Generate permutations for required fields\n    required_permutations = generate_required_permutations(params, required_fields)\n\n    # Generate optional permutations based on each required permutation\n    for required_perm in required_permutations:\n        yield from generate_optional_permutations(params, required_perm)"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: f4ca57c5-4d4a-40b9-9f0d-ad761aa11851
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"f4ca57c5-4d4a-40b9-9f0d-ad761aa11851\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"dfe14c26-f6bc-49b4-a200-8887070ba5d9\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2168a568d6327f4254aaf24b76760e2e644736d55be744fede6aadb952fd2f2c\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"b4307cad-b5b4-4737-8a0c-a496265b20de\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"0936691a0f4e7bbb6a8a0669b6e1810241cc3ae7a52d47f7672469ca732468ee\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 31588, \"end_char_idx\": 35246, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "# Generating synthetic data\n\n\n### Helper functions\n\n\nWe want to generate every invocation of every function, so that we have\nfull coverage of all potential invocations to create synthetic data for. Then, we will use `gpt-4o` to come up with prompts that would call each invocation, and we will use that prompt - function invocation pair as training data.\n\n\nGenerating every invocation for a function with fixed enums is more simple, but for a function such as\n`control_gimbal` we need to set the `tilt` and `pan` integer values, so to generate those synthetic invocations we will first set a placeholder, and then later use `gpt-4o` to come up with reasonable values.\n\n\n\n```python\nplaceholder_int = \"fill_in_int\"\nplaceholder_string = \"fill_in_string\"\n```\n\nThe functions below take in all the functions from the function list, and look\nat all the potential invocations of those functions given each function's parameters.\nThe functions also account for `required` parameters, so that all the invocations\nare actually feasible.\n\n\n\n```python\ndef generate_permutations(\n    params: Dict[str, Dict[str, Any]]\n) -> Generator[Dict[str, Any], None, None]:\n    \"\"\"\n    Generates all possible permutations for given parameters.\n\n    :param params: Parameter dictionary containing required and optional fields.\n    :return: A generator yielding each permutation.\n    \"\"\"\n\n    # Extract the required fields from the parameters\n    required_fields = params.get(\"required\", [])\n\n    # Generate permutations for required fields\n    required_permutations = generate_required_permutations(params, required_fields)\n\n    # Generate optional permutations based on each required permutation\n    for required_perm in required_permutations:\n        yield from generate_optional_permutations(params, required_perm)\n\n\ndef generate_required_permutations(\n    params: Dict[str, Dict[str, Any]], required_fields: List[str]\n) -> List[Dict[str, Any]]:\n    \"\"\"\n    Generates permutations for the required fields.\n\n    :param params: Parameter dictionary.\n    :param required_fields: List of required fields.\n    :return: A list of permutations for required fields.\n    \"\"\"\n\n    # Get all possible values for each required field\n    required_values = [get_possible_values(params, field) for field in required_fields]\n\n    # Generate permutations from possible values\n    return [\n        dict(zip(required_fields, values))\n        for values in itertools.product(*required_values)\n    ]\n\n\ndef generate_optional_permutations(\n    params: Dict[str, Dict[str, Any]], base_perm: Dict[str, Any]\n) -> Generator[Dict[str, Any], None, None]:\n    \"\"\"\n    Generates permutations for optional fields based on a base permutation.\n\n    :param params: Parameter dictionary.\n    :param base_perm: Base permutation dictionary.\n    :return: A generator yielding each permutation for optional fields.\n    \"\"\"\n\n    # Determine the fields that are optional by subtracting the base permutation's fields from all properties\n    optional_fields = set(params[\"properties\"]) - set(base_perm)\n\n    # Iterate through all combinations of optional fields\n    for field_subset in itertools.chain.from_iterable(\n        itertools.combinations(optional_fields, r)\n        for r in range(len(optional_fields) + 1)\n    ):\n\n        # Generate product of possible values for the current subset of fields\n        for values in itertools.product(\n            *(get_possible_values(params, field) for field in field_subset)\n        ):\n\n            # Create a new permutation by combining base permutation and current field values\n            new_perm = {**base_perm, **dict(zip(field_subset, values))}\n\n            yield new_perm"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: b4307cad-b5b4-4737-8a0c-a496265b20de
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"b4307cad-b5b4-4737-8a0c-a496265b20de\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f4ca57c5-4d4a-40b9-9f0d-ad761aa11851\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"7d26730f425b2b6d020fe2d329e4946d25785add171a35e4a5bb994e30825f28\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"a43fc809-886c-467f-8b00-b204c500cac6\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"9ae34d082576d9658dcf480809ba14cfa083c7531ab1b609a59c8979c2f4d6a5\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 33381, \"end_char_idx\": 36449, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "def generate_required_permutations(\n    params: Dict[str, Dict[str, Any]], required_fields: List[str]\n) -> List[Dict[str, Any]]:\n    \"\"\"\n    Generates permutations for the required fields.\n\n    :param params: Parameter dictionary.\n    :param required_fields: List of required fields.\n    :return: A list of permutations for required fields.\n    \"\"\"\n\n    # Get all possible values for each required field\n    required_values = [get_possible_values(params, field) for field in required_fields]\n\n    # Generate permutations from possible values\n    return [\n        dict(zip(required_fields, values))\n        for values in itertools.product(*required_values)\n    ]\n\n\ndef generate_optional_permutations(\n    params: Dict[str, Dict[str, Any]], base_perm: Dict[str, Any]\n) -> Generator[Dict[str, Any], None, None]:\n    \"\"\"\n    Generates permutations for optional fields based on a base permutation.\n\n    :param params: Parameter dictionary.\n    :param base_perm: Base permutation dictionary.\n    :return: A generator yielding each permutation for optional fields.\n    \"\"\"\n\n    # Determine the fields that are optional by subtracting the base permutation's fields from all properties\n    optional_fields = set(params[\"properties\"]) - set(base_perm)\n\n    # Iterate through all combinations of optional fields\n    for field_subset in itertools.chain.from_iterable(\n        itertools.combinations(optional_fields, r)\n        for r in range(len(optional_fields) + 1)\n    ):\n\n        # Generate product of possible values for the current subset of fields\n        for values in itertools.product(\n            *(get_possible_values(params, field) for field in field_subset)\n        ):\n\n            # Create a new permutation by combining base permutation and current field values\n            new_perm = {**base_perm, **dict(zip(field_subset, values))}\n\n            yield new_perm\n\n\ndef get_possible_values(params: Dict[str, Dict[str, Any]], field: str) -> List[Any]:\n    \"\"\"\n    Retrieves possible values for a given field.\n\n    :param params: Parameter dictionary.\n    :param field: The field for which to get possible values.\n    :return: A list of possible values.\n    \"\"\"\n\n    # Extract field information from the parameters\n    field_info = params[\"properties\"][field]\n\n    # Based on the field's type or presence of 'enum', determine and return the possible values\n    if \"enum\" in field_info:\n        return field_info[\"enum\"]\n    elif field_info[\"type\"] == \"integer\":\n        return [placeholder_int]\n    elif field_info[\"type\"] == \"string\":\n        return [placeholder_string]\n    elif field_info[\"type\"] == \"boolean\":\n        return [True, False]\n    elif field_info[\"type\"] == \"array\" and \"enum\" in field_info[\"items\"]:\n        enum_values = field_info[\"items\"][\"enum\"]\n        all_combinations = [\n            list(combo)\n            for i in range(1, len(enum_values) + 1)\n            for combo in itertools.combinations(enum_values, i)\n        ]\n        return all_combinations\n    return []\n```\n\n### Let's generate every invocation for every function first\n\n\nPrompts:"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: a43fc809-886c-467f-8b00-b204c500cac6
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"a43fc809-886c-467f-8b00-b204c500cac6\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"b4307cad-b5b4-4737-8a0c-a496265b20de\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"03b9bae3866dfa324ce544f89d49d620fb536d746c4b5c0281425d7a2197e7ed\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"007e1a29-7ba7-4c31-9ebb-64f1326a3580\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"e405244e7d1b5bf45c3de5391ab1c59e1542ccf86725cedafd2bf158f8583767\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 35249, \"end_char_idx\": 37219, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "def get_possible_values(params: Dict[str, Dict[str, Any]], field: str) -> List[Any]:\n    \"\"\"\n    Retrieves possible values for a given field.\n\n    :param params: Parameter dictionary.\n    :param field: The field for which to get possible values.\n    :return: A list of possible values.\n    \"\"\"\n\n    # Extract field information from the parameters\n    field_info = params[\"properties\"][field]\n\n    # Based on the field's type or presence of 'enum', determine and return the possible values\n    if \"enum\" in field_info:\n        return field_info[\"enum\"]\n    elif field_info[\"type\"] == \"integer\":\n        return [placeholder_int]\n    elif field_info[\"type\"] == \"string\":\n        return [placeholder_string]\n    elif field_info[\"type\"] == \"boolean\":\n        return [True, False]\n    elif field_info[\"type\"] == \"array\" and \"enum\" in field_info[\"items\"]:\n        enum_values = field_info[\"items\"][\"enum\"]\n        all_combinations = [\n            list(combo)\n            for i in range(1, len(enum_values) + 1)\n            for combo in itertools.combinations(enum_values, i)\n        ]\n        return all_combinations\n    return []\n```\n\n### Let's generate every invocation for every function first\n\n\nPrompts:\n\n\n\n```python\nINVOCATION_FILLER_PROMPT = \"\"\"\n1) Input reasonable values for 'fill_in_string' and 'fill_in_int' in the invocation here: {invocation}. Reasonable values are determined by the function definition. Use the\nthe entire function provided here :{function} to get context over what proper fill_in_string and fill_in_int values would be.\nExample:\n\nInput: invocation: {{\n    \"name\": \"control_camera\",\n    \"arguments\": {{\n      \"mode\":\"video\",\n      \"duration\":\"fill_in_int\"\n    }}\n}},\nfunction:{function}\n\nOutput: invocation: {{\n    \"name\": \"control_camera\",\n    \"arguments\": {{\n      \"mode\":\"video\",\n      \"duration\": 30\n    }}\n}}\n\n\nMAKE SURE output is just a dictionary with keys 'name' and 'arguments', no other text or response.\n\nInput: {invocation}\nOutput:\n\"\"\""}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 007e1a29-7ba7-4c31-9ebb-64f1326a3580
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"007e1a29-7ba7-4c31-9ebb-64f1326a3580\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"a43fc809-886c-467f-8b00-b204c500cac6\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"ba6247c89332040bfd095e595099b41d5e7e8648e13210fb28ae19f2d0c316de\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"327dd5f0-db96-4fbc-a639-d10a06d4bbf4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"27808f73badd61967c9fdf7f853e4e71bf6186e93700ed7e139d3891994dd25b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 36441, \"end_char_idx\": 39018, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "Prompts:\n\n\n\n```python\nINVOCATION_FILLER_PROMPT = \"\"\"\n1) Input reasonable values for 'fill_in_string' and 'fill_in_int' in the invocation here: {invocation}. Reasonable values are determined by the function definition. Use the\nthe entire function provided here :{function} to get context over what proper fill_in_string and fill_in_int values would be.\nExample:\n\nInput: invocation: {{\n    \"name\": \"control_camera\",\n    \"arguments\": {{\n      \"mode\":\"video\",\n      \"duration\":\"fill_in_int\"\n    }}\n}},\nfunction:{function}\n\nOutput: invocation: {{\n    \"name\": \"control_camera\",\n    \"arguments\": {{\n      \"mode\":\"video\",\n      \"duration\": 30\n    }}\n}}\n\n\nMAKE SURE output is just a dictionary with keys 'name' and 'arguments', no other text or response.\n\nInput: {invocation}\nOutput:\n\"\"\"\n\n\nCOMMAND_GENERATION_PROMPT = \"\"\"\nYou are to output 2 commands, questions or statements that would generate the inputted function and parameters.\nPlease make the commands or questions natural, as a person would ask, and the command or questions should be varied and not repetitive.\nIt should not always mirror the exact technical terminology used in the function and parameters, rather reflect a conversational and intuitive request.\nFor instance, the prompt should not be 'turn on the dome light', as that is too technical, but rather 'turn on the inside lights'.\nAnother example, is the prompt should not be 'turn on the HVAC', but rather 'turn on the air conditioning'. Use language a normal driver would use, even if\nit is technically incorrect but colloquially used.\n\nRULES: ALWAYS put a backwards slash before an apostrophe or single quote '. For example, do not say don't but say don\\'t.\nPrompts MUST be in double quotes as well.\n\nExample\n\nInput: {{'name': 'calibrate_sensors','arguments': {{}}'' }}\nPrompt: [\"The sensors are out of whack, can you reset them\", \"The calibration of the drone is off, fix it please!\"]\n\nInput: {{'name': 'set_autopilot','arguments': {{'status': 'off'}}}}\nPrompt: [\"OK, I want to take back pilot control now\",\"Turn off the automatic pilot I'm ready control it\"]\n\nInput: {invocation}\nPrompt:\n\"\"\"\n```\n\nIn the below snippet, we generate the invocation of each function except for the `reject_request` function.\n\nTo perform effective fine-tuning we need correctly labeled data. We could manually come up with examples and label the data,\\\nor we can generate synthetic data with the help of `gpt-4o` <br>\n\nEmpirically, `gpt-4o` needs a bit more help to get good realistic examples of prompts that would generate the `reject_request` function, so we'll do that next..."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 327dd5f0-db96-4fbc-a639-d10a06d4bbf4
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"327dd5f0-db96-4fbc-a639-d10a06d4bbf4\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"007e1a29-7ba7-4c31-9ebb-64f1326a3580\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"1b10ea48a70e1d61c53569911575e83d08dad64ceb539bd4787c028211640748\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"da14ca42-3a4e-42ae-8792-6f39c46d50ea\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"c91e70ffb9d8ebcf471eeede5800b903e6d6b946e0ecfdb58cfd9d92c9a1948e\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 39022, \"end_char_idx\": 42152, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "```python\ninput_objects = []\nall_but_reject = [f for f in function_list if f.get(\"name\") != \"reject_request\"]\n\nfor function in all_but_reject:\n    func_name = function[\"function\"][\"name\"]\n    params = function[\"function\"][\"parameters\"]\n    for arguments in generate_permutations(params):\n        if any(val in arguments.values() for val in [\"fill_in_int\", \"fill_in_str\"]):\n            input_object = {\"name\": func_name, \"arguments\": arguments}\n            messages = [\n                {\n                    \"role\": \"user\",\n                    \"content\": INVOCATION_FILLER_PROMPT.format(\n                        invocation=str(input_object), function=function\n                    ),\n                }\n            ]\n            input_object, usage = get_chat_completion(\n                model=\"gpt-4o\", messages=messages, max_tokens=200, temperature=0.1\n            ).content\n        else:\n            input_object = {\"name\": func_name, \"arguments\": arguments}\n\n        input_objects.append(input_object)\n```\n\nNow that we have all the invocations, let's use `gpt-4o` to generate prompts that would result in those invocations\n\n\n\n```python\ndef remove_sequences(input_string):\n    # Replace the specific sequences with an empty string\n    cleaned_string = input_string.replace(\"```json\", \"\")  # Remove \"```json\" first\n    cleaned_string = cleaned_string.replace(\"```\", \"\")  # Then remove \"```\"\n    return json.loads(cleaned_string)\n```\n\n\n```python\ndef create_commands(invocation_list):\n    example_list = []\n    for i, invocation in enumerate(invocation_list):\n        if i < 100:\n            print(\n                f\"\\033[34m{np.round(100*i/len(invocation_list),1)}% complete\\033[0m\")\n            if type(invocation) == str or \"json\" in invocation:\n                invocation = remove_sequences(invocation)\n            print(invocation)\n\n        # Format the prompt with the invocation string\n        request_prompt = COMMAND_GENERATION_PROMPT.format(\n            invocation=invocation)\n\n        messages = [{\"role\": \"user\", \"content\": f\"{request_prompt}\"}]\n        completion, usage = get_chat_completion(messages, temperature=0.8)\n        command_dict = {\"Input\": invocation, \"Prompt\": completion.content}\n        example_list.append(command_dict)\n    return example_list\n```\n\n\n```python\n# Only printing the first 10 rows\ntraining_examples_unformatted = create_commands(input_objects)\n```\n\n    \u001b[34m0.0% complete\u001b[0m\n    {'name': 'takeoff_drone', 'arguments': {'altitude': 100}}\n    \u001b[34m1.8% complete\u001b[0m\n    {'name': 'land_drone', 'arguments': {'location': 'current'}}\n    \u001b[34m3.5% complete\u001b[0m\n    {'name': 'land_drone', 'arguments': {'location': 'home_base'}}\n    \u001b[34m5.3% complete\u001b[0m\n    {'name': 'land_drone', 'arguments': {'location': 'custom'}}\n    \u001b[34m7.0% complete\u001b[0m\n    {'name': 'control_drone_movement', 'arguments': {'direction': 'forward', 'distance': 100}}\n    \u001b[34m8.8% complete\u001b[0m\n    {'name': 'control_drone_movement', 'arguments': {'direction': 'backward', 'distance': 50}}\n    \u001b[34m10.5% complete\u001b[0m\n    {'name': 'control_drone_movement', 'arguments': {'direction': 'left', 'distance': 10}}\n    \u001b[34m12."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: da14ca42-3a4e-42ae-8792-6f39c46d50ea
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"da14ca42-3a4e-42ae-8792-6f39c46d50ea\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"327dd5f0-db96-4fbc-a639-d10a06d4bbf4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"a5c40e32e4d954b6b1b2a58ce307c105de01089f5d2b04a01b96399c798d7986\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"72bd030a-0ef6-4a6a-b183-b08a654900c4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"43d820f3573b22bb1ff0913f29f2469154782b2720148138ce6014135eb6a2fc\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 41299, \"end_char_idx\": 43528, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "```python\n# Only printing the first 10 rows\ntraining_examples_unformatted = create_commands(input_objects)\n```\n\n    \u001b[34m0.0% complete\u001b[0m\n    {'name': 'takeoff_drone', 'arguments': {'altitude': 100}}\n    \u001b[34m1.8% complete\u001b[0m\n    {'name': 'land_drone', 'arguments': {'location': 'current'}}\n    \u001b[34m3.5% complete\u001b[0m\n    {'name': 'land_drone', 'arguments': {'location': 'home_base'}}\n    \u001b[34m5.3% complete\u001b[0m\n    {'name': 'land_drone', 'arguments': {'location': 'custom'}}\n    \u001b[34m7.0% complete\u001b[0m\n    {'name': 'control_drone_movement', 'arguments': {'direction': 'forward', 'distance': 100}}\n    \u001b[34m8.8% complete\u001b[0m\n    {'name': 'control_drone_movement', 'arguments': {'direction': 'backward', 'distance': 50}}\n    \u001b[34m10.5% complete\u001b[0m\n    {'name': 'control_drone_movement', 'arguments': {'direction': 'left', 'distance': 10}}\n    \u001b[34m12.3% complete\u001b[0m\n    {'name': 'control_drone_movement', 'arguments': {'direction': 'right', 'distance': 10}}\n    \u001b[34m14.0% complete\u001b[0m\n    {'name': 'control_drone_movement', 'arguments': {'direction': 'up', 'distance': 10}}\n    \u001b[34m15.8% complete\u001b[0m\n    {'name': 'control_drone_movement', 'arguments': {'direction': 'down', 'distance': 10}}\n    \u001b[34m17.5% complete\u001b[0m\n    {'name': 'set_drone_speed', 'arguments': {'speed': 10}}\n    \u001b[34m19.3% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'photo'}}\n    \u001b[34m21.1% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'photo', 'duration': 10}}\n    \u001b[34m22.8% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'video'}}\n    \u001b[34m24.6% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'video', 'duration': 60}}\n    \u001b[34m26.3% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'panorama'}}\n    \u001b[34m28.1% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'panorama', 'duration': 60}}\n    \u001b[34m29.8% complete\u001b[0m\n    {'name': 'control_gimbal', 'arguments': {'tilt': 45, 'pan': 90}}\n    \u001b[34m31.6% complete\u001b[0m\n    {'name': 'set_drone_lighting', 'arguments': {'mode': 'on'}}\n    \u001b[34m33.3% complete\u001b[0m\n    {'name': 'set_drone_lighting', 'arguments': {'mode': 'off'}}\n    \u001b[34m35.1% complete\u001b[0m\n    {'name': 'set_drone_lighting',"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 72bd030a-0ef6-4a6a-b183-b08a654900c4
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"72bd030a-0ef6-4a6a-b183-b08a654900c4\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"da14ca42-3a4e-42ae-8792-6f39c46d50ea\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"5b01f7528d7cc94fd22c5ff07905d975d79c80780ce6450f2046967ab5e14230\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"61cb2203-1dee-4d29-b70d-d969208fa932\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"008e2e7517cc10270fed48e49c79476a09012fc2428b66838e9d5c8ded11f1c7\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 42444, \"end_char_idx\": 44579, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "'arguments': {'direction': 'down', 'distance': 10}}\n    \u001b[34m17.5% complete\u001b[0m\n    {'name': 'set_drone_speed', 'arguments': {'speed': 10}}\n    \u001b[34m19.3% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'photo'}}\n    \u001b[34m21.1% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'photo', 'duration': 10}}\n    \u001b[34m22.8% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'video'}}\n    \u001b[34m24.6% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'video', 'duration': 60}}\n    \u001b[34m26.3% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'panorama'}}\n    \u001b[34m28.1% complete\u001b[0m\n    {'name': 'control_camera', 'arguments': {'mode': 'panorama', 'duration': 60}}\n    \u001b[34m29.8% complete\u001b[0m\n    {'name': 'control_gimbal', 'arguments': {'tilt': 45, 'pan': 90}}\n    \u001b[34m31.6% complete\u001b[0m\n    {'name': 'set_drone_lighting', 'arguments': {'mode': 'on'}}\n    \u001b[34m33.3% complete\u001b[0m\n    {'name': 'set_drone_lighting', 'arguments': {'mode': 'off'}}\n    \u001b[34m35.1% complete\u001b[0m\n    {'name': 'set_drone_lighting', 'arguments': {'mode': 'blink'}}\n    \u001b[34m36.8% complete\u001b[0m\n    {'name': 'set_drone_lighting', 'arguments': {'mode': 'sos'}}\n    \u001b[34m38.6% complete\u001b[0m\n    {'name': 'return_to_home', 'arguments': {}}\n    \u001b[34m40.4% complete\u001b[0m\n    {'name': 'set_battery_saver_mode', 'arguments': {'status': 'on'}}\n    \u001b[34m42.1% complete\u001b[0m\n    {'name': 'set_battery_saver_mode', 'arguments': {'status': 'off'}}\n    \u001b[34m43.9% complete\u001b[0m\n    {'name': 'set_obstacle_avoidance', 'arguments': {'mode': 'on'}}\n    \u001b[34m45.6% complete\u001b[0m\n    {'name': 'set_obstacle_avoidance', 'arguments': {'mode': 'off'}}\n    \u001b[34m47.4% complete\u001b[0m\n    {'name': 'set_follow_me_mode', 'arguments': {'status': 'on'}}\n    \u001b[34m49.1% complete\u001b[0m\n    {'name': 'set_follow_me_mode', 'arguments': {'status': 'off'}}\n    \u001b[34m50.9% complete\u001b[0m\n    {'name': 'calibrate_sensors', 'arguments': {}}\n    \u001b[34m52.6% complete\u001b[0m\n    {'name': 'set_autopilot', 'arguments': {'status': 'on'}}\n    \u001b[34m54.4% complete\u001b[0m\n    {'name': 'set_autopilot', 'arguments': {'status': 'off'}}\n    \u001b[34m56."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 61cb2203-1dee-4d29-b70d-d969208fa932
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"61cb2203-1dee-4d29-b70d-d969208fa932\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"72bd030a-0ef6-4a6a-b183-b08a654900c4\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"9f79594e61c04c1be453ac4aec2694497bd3b221f81a419ee74db19a5312efda\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"549300d3-47ba-4a18-81b1-fb60c9b6b735\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"a9b039c718520255cf42e17c97fd0db5a63ff2066ec9a34fecdb98cebfccca4b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 43478, \"end_char_idx\": 45728, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "1% complete\u001b[0m\n    {'name': 'set_drone_lighting', 'arguments': {'mode': 'blink'}}\n    \u001b[34m36.8% complete\u001b[0m\n    {'name': 'set_drone_lighting', 'arguments': {'mode': 'sos'}}\n    \u001b[34m38.6% complete\u001b[0m\n    {'name': 'return_to_home', 'arguments': {}}\n    \u001b[34m40.4% complete\u001b[0m\n    {'name': 'set_battery_saver_mode', 'arguments': {'status': 'on'}}\n    \u001b[34m42.1% complete\u001b[0m\n    {'name': 'set_battery_saver_mode', 'arguments': {'status': 'off'}}\n    \u001b[34m43.9% complete\u001b[0m\n    {'name': 'set_obstacle_avoidance', 'arguments': {'mode': 'on'}}\n    \u001b[34m45.6% complete\u001b[0m\n    {'name': 'set_obstacle_avoidance', 'arguments': {'mode': 'off'}}\n    \u001b[34m47.4% complete\u001b[0m\n    {'name': 'set_follow_me_mode', 'arguments': {'status': 'on'}}\n    \u001b[34m49.1% complete\u001b[0m\n    {'name': 'set_follow_me_mode', 'arguments': {'status': 'off'}}\n    \u001b[34m50.9% complete\u001b[0m\n    {'name': 'calibrate_sensors', 'arguments': {}}\n    \u001b[34m52.6% complete\u001b[0m\n    {'name': 'set_autopilot', 'arguments': {'status': 'on'}}\n    \u001b[34m54.4% complete\u001b[0m\n    {'name': 'set_autopilot', 'arguments': {'status': 'off'}}\n    \u001b[34m56.1% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid'}}\n    \u001b[34m57.9% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid', 'color': 'red'}}\n    \u001b[34m59.6% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid', 'color': 'blue'}}\n    \u001b[34m61.4% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid', 'color': 'green'}}\n    \u001b[34m63.2% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid', 'color': 'yellow'}}\n    \u001b[34m64.9% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid', 'color': 'white'}}\n    \u001b[34m66.7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink'}}\n    \u001b[34m68.4% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink', 'color': 'red'}}\n    \u001b[34m70.2% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink', 'color': 'blue'}}\n    \u001b[34m71.9% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink', 'color': 'green'}}\n    \u001b[34m73."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 549300d3-47ba-4a18-81b1-fb60c9b6b735
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"549300d3-47ba-4a18-81b1-fb60c9b6b735\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"61cb2203-1dee-4d29-b70d-d969208fa932\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"150863ead67c39afc0a904a39d4e07ad3db774606b3c0307dcf4fe8ea9579d6a\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"9cb6bf0f-b5fa-458d-949f-1474fa5ba1da\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"adbecc63de3ee9606026b33cbd9ab150059511c5047693c9cfefdb1b971dde8d\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 44535, \"end_char_idx\": 46936, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "'arguments': {'status': 'off'}}\n    \u001b[34m56.1% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid'}}\n    \u001b[34m57.9% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid', 'color': 'red'}}\n    \u001b[34m59.6% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid', 'color': 'blue'}}\n    \u001b[34m61.4% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid', 'color': 'green'}}\n    \u001b[34m63.2% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid', 'color': 'yellow'}}\n    \u001b[34m64.9% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'solid', 'color': 'white'}}\n    \u001b[34m66.7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink'}}\n    \u001b[34m68.4% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink', 'color': 'red'}}\n    \u001b[34m70.2% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink', 'color': 'blue'}}\n    \u001b[34m71.9% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink', 'color': 'green'}}\n    \u001b[34m73.7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink', 'color': 'yellow'}}\n    \u001b[34m75.4% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink', 'color': 'white'}}\n    \u001b[34m77.2% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse'}}\n    \u001b[34m78.9% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse', 'color': 'red'}}\n    \u001b[34m80.7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse', 'color': 'blue'}}\n    \u001b[34m82.5% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse', 'color': 'green'}}\n    \u001b[34m84.2% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse', 'color': 'yellow'}}\n    \u001b[34m86.0% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse', 'color': 'white'}}\n    \u001b[34m87.7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow'}}\n    \u001b[34m89.5% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'red'}}\n    \u001b[34m91.2% complete\u001b[0m\n    {'name': 'configure_led_display',"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 9cb6bf0f-b5fa-458d-949f-1474fa5ba1da
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"9cb6bf0f-b5fa-458d-949f-1474fa5ba1da\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"549300d3-47ba-4a18-81b1-fb60c9b6b735\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"8deef10ca98e40f2b79ac9849ac393ba6c948b463bdda4505f561292e26515d7\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"1de3a32d-a035-498d-91cd-92e7266f03d1\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8816ecb32fa8870585f9ae01f9369a628ae8caf4197d7a08a01f86b9eb4a220e\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 45697, \"end_char_idx\": 48166, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "'color': 'green'}}\n    \u001b[34m73.7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink', 'color': 'yellow'}}\n    \u001b[34m75.4% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'blink', 'color': 'white'}}\n    \u001b[34m77.2% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse'}}\n    \u001b[34m78.9% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse', 'color': 'red'}}\n    \u001b[34m80.7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse', 'color': 'blue'}}\n    \u001b[34m82.5% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse', 'color': 'green'}}\n    \u001b[34m84.2% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse', 'color': 'yellow'}}\n    \u001b[34m86.0% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'pulse', 'color': 'white'}}\n    \u001b[34m87.7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow'}}\n    \u001b[34m89.5% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'red'}}\n    \u001b[34m91.2% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'blue'}}\n    \u001b[34m93.0% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'green'}}\n    \u001b[34m94.7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'yellow'}}\n    \u001b[34m96.5% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'white'}}\n    \u001b[34m98.2% complete\u001b[0m\n    {'name': 'reject_request', 'arguments': {}}\n\n\nNow let's format the training examples properly. For more documentation on the proper training data formatting for fine tuning for function calling, see here: https://platform.openai.com/docs/guides/fine-tuning/fine-tuning-examples\n\n\n\n```python\ndef remove_descriptions(function_list):\n    for function in function_list:\n        func = function[\"function\"]\n        if \"description\" in func:\n            del func[\"description\"]\n\n        params = func[\"parameters\"]\n        if \"properties\" in params:\n            for param in params[\"properties\"].values():\n                if \"description\" in param:\n                    del param[\"description\"]\n\n    return function_list\n\n\nmodified_function_list = remove_descriptions(function_list)\n```"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 1de3a32d-a035-498d-91cd-92e7266f03d1
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"1de3a32d-a035-498d-91cd-92e7266f03d1\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"9cb6bf0f-b5fa-458d-949f-1474fa5ba1da\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"f3cc724786c0981a97bbb1f497a6c19ca984c0c5d4087114259594039d6fa128\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"8d42d487-7afd-4684-b6ee-2938a9411f35\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"e716f43a2271a9d0f3910f33377ed82f424b99ca1657d32865f5fd208b79489f\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 46661, \"end_char_idx\": 49501, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow'}}\n    \u001b[34m89.5% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'red'}}\n    \u001b[34m91.2% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'blue'}}\n    \u001b[34m93.0% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'green'}}\n    \u001b[34m94.7% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'yellow'}}\n    \u001b[34m96.5% complete\u001b[0m\n    {'name': 'configure_led_display', 'arguments': {'pattern': 'rainbow', 'color': 'white'}}\n    \u001b[34m98.2% complete\u001b[0m\n    {'name': 'reject_request', 'arguments': {}}\n\n\nNow let's format the training examples properly. For more documentation on the proper training data formatting for fine tuning for function calling, see here: https://platform.openai.com/docs/guides/fine-tuning/fine-tuning-examples\n\n\n\n```python\ndef remove_descriptions(function_list):\n    for function in function_list:\n        func = function[\"function\"]\n        if \"description\" in func:\n            del func[\"description\"]\n\n        params = func[\"parameters\"]\n        if \"properties\" in params:\n            for param in params[\"properties\"].values():\n                if \"description\" in param:\n                    del param[\"description\"]\n\n    return function_list\n\n\nmodified_function_list = remove_descriptions(function_list)\n```\n\n\n```python\ntraining_examples = []\n\nfor prompt in training_examples_unformatted:\n    # adjust formatting for training data specs\n\n    # if its not a dict, convert to dict\n    if type(prompt[\"Input\"]) != dict:\n        prompt[\"Input\"] = ast.literal_eval(prompt[\"Input\"])\n    prompt[\"Input\"][\"arguments\"] = json.dumps(prompt[\"Input\"][\"arguments\"])\n    try:\n        prompt[\"Prompt\"] = json.loads(prompt[\"Prompt\"])\n    except:\n        continue\n    for p in prompt[\"Prompt\"]:\n        print(p)\n        print(prompt[\"Input\"])\n        tool_calls = [\n            {\"id\": \"call_id\", \"type\": \"function\", \"function\": prompt[\"Input\"]}\n        ]\n        training_examples.append(\n            {\n                \"messages\": [\n                    {\"role\": \"system\", \"content\": DRONE_SYSTEM_PROMPT},\n                    {\"role\": \"user\", \"content\": p},\n                    {\"role\": \"assistant\", \"tool_calls\": tool_calls},\n                ],\n                \"parallel_tool_calls\": False,\n                \"tools\": modified_function_list,\n            }\n        )\n```\n\n    Let's get the drone in the air, how high should it go?\n    {'name': 'takeoff_drone', 'arguments': '{\"altitude\": 100}'}\n    Ready for takeoff, how high should the drone fly?\n    {'name': 'takeoff_drone', 'arguments': '{\"altitude\": 100}'}\n    Can you bring the drone down to where we are?"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 8d42d487-7afd-4684-b6ee-2938a9411f35
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"8d42d487-7afd-4684-b6ee-2938a9411f35\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"1de3a32d-a035-498d-91cd-92e7266f03d1\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"9fc07e958e885016e928c458333a84d0f45e72c0f13ee375702af084a81f4ec7\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"985ec7ad-e8e1-4f63-88ad-09efcc0fba49\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"70f83438c601fcca0b07cf5e787384925b7d813bbf82b7817d7bee5922d85772\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 47668, \"end_char_idx\": 50870, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "```python\ndef remove_descriptions(function_list):\n    for function in function_list:\n        func = function[\"function\"]\n        if \"description\" in func:\n            del func[\"description\"]\n\n        params = func[\"parameters\"]\n        if \"properties\" in params:\n            for param in params[\"properties\"].values():\n                if \"description\" in param:\n                    del param[\"description\"]\n\n    return function_list\n\n\nmodified_function_list = remove_descriptions(function_list)\n```\n\n\n```python\ntraining_examples = []\n\nfor prompt in training_examples_unformatted:\n    # adjust formatting for training data specs\n\n    # if its not a dict, convert to dict\n    if type(prompt[\"Input\"]) != dict:\n        prompt[\"Input\"] = ast.literal_eval(prompt[\"Input\"])\n    prompt[\"Input\"][\"arguments\"] = json.dumps(prompt[\"Input\"][\"arguments\"])\n    try:\n        prompt[\"Prompt\"] = json.loads(prompt[\"Prompt\"])\n    except:\n        continue\n    for p in prompt[\"Prompt\"]:\n        print(p)\n        print(prompt[\"Input\"])\n        tool_calls = [\n            {\"id\": \"call_id\", \"type\": \"function\", \"function\": prompt[\"Input\"]}\n        ]\n        training_examples.append(\n            {\n                \"messages\": [\n                    {\"role\": \"system\", \"content\": DRONE_SYSTEM_PROMPT},\n                    {\"role\": \"user\", \"content\": p},\n                    {\"role\": \"assistant\", \"tool_calls\": tool_calls},\n                ],\n                \"parallel_tool_calls\": False,\n                \"tools\": modified_function_list,\n            }\n        )\n```\n\n    Let's get the drone in the air, how high should it go?\n    {'name': 'takeoff_drone', 'arguments': '{\"altitude\": 100}'}\n    Ready for takeoff, how high should the drone fly?\n    {'name': 'takeoff_drone', 'arguments': '{\"altitude\": 100}'}\n    Can you bring the drone down to where we are?\n    {'name': 'land_drone', 'arguments': '{\"location\": \"current\"}'}\n    Let's get the drone to land right here\n    {'name': 'land_drone', 'arguments': '{\"location\": \"current\"}'}\n    Bring the drone back to base for landing\n    {'name': 'land_drone', 'arguments': '{\"location\": \"home_base\"}'}\n    Can you safely land the drone at home base\n    {'name': 'land_drone', 'arguments': '{\"location\": \"home_base\"}'}\n    Can you make the drone move to the left by 10 units?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"left\", \"distance\": 10}'}\n    I need the drone to go left, could you move it 10 steps that way?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"left\", \"distance\": 10}'}\n    Can you move the drone to the right by 10 feet?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"right\", \"distance\": 10}'}\n    I need the drone to go 10 feet to the right, can you do that?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"right\", \"distance\": 10}'}\n    Can you make the drone go upwards by 10 units?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"up\", \"distance\": 10}'}\n    I need the drone to move up, can you do that for me?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"up\", \"distance\": 10}'}\n    Can you bring the drone lower by 10 feet please?"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 985ec7ad-e8e1-4f63-88ad-09efcc0fba49
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"985ec7ad-e8e1-4f63-88ad-09efcc0fba49\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"8d42d487-7afd-4684-b6ee-2938a9411f35\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"87b203330301a06f524f3002c06a359285584533756cb8c72340fa492524a6db\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"5e37eaf7-54d6-4aca-8daa-8a5656acb6a7\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"a5cd2e96efeddbd49fc117a07af801f025551ecc7f1a3bfe4af2f05763d6439a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 49506, \"end_char_idx\": 52116, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "{'name': 'land_drone', 'arguments': '{\"location\": \"current\"}'}\n    Let's get the drone to land right here\n    {'name': 'land_drone', 'arguments': '{\"location\": \"current\"}'}\n    Bring the drone back to base for landing\n    {'name': 'land_drone', 'arguments': '{\"location\": \"home_base\"}'}\n    Can you safely land the drone at home base\n    {'name': 'land_drone', 'arguments': '{\"location\": \"home_base\"}'}\n    Can you make the drone move to the left by 10 units?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"left\", \"distance\": 10}'}\n    I need the drone to go left, could you move it 10 steps that way?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"left\", \"distance\": 10}'}\n    Can you move the drone to the right by 10 feet?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"right\", \"distance\": 10}'}\n    I need the drone to go 10 feet to the right, can you do that?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"right\", \"distance\": 10}'}\n    Can you make the drone go upwards by 10 units?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"up\", \"distance\": 10}'}\n    I need the drone to move up, can you do that for me?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"up\", \"distance\": 10}'}\n    Can you bring the drone lower by 10 feet please?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"down\", \"distance\": 10}'}\n    I need the drone to descend 10 units, can you make that happen?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"down\", \"distance\": 10}'}\n    Can you make the drone go faster?\n    {'name': 'set_drone_speed', 'arguments': '{\"speed\": 10}'}\n    I think the drone should speed up a bit, don't you think?\n    {'name': 'set_drone_speed', 'arguments': '{\"speed\": 10}'}\n    I want to take a picture, can you switch the camera mode to photo\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"photo\"}'}\n    Let's capture this moment, switch the camera to photo mode please\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"photo\"}'}\n    Can you switch the camera to photo mode and take a picture for 10 seconds?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"photo\", \"duration\": 10}'}\n    I need to capture something, can you set the camera to take photos for 10 seconds?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"photo\", \"duration\": 10}'}\n    Can you switch the camera to video mode?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"video\"}'}\n    I want to record, can you set the camera to video mode?"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 5e37eaf7-54d6-4aca-8daa-8a5656acb6a7
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"5e37eaf7-54d6-4aca-8daa-8a5656acb6a7\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"985ec7ad-e8e1-4f63-88ad-09efcc0fba49\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"f0ba888d4dbfd0b9f5ce8e3cf2591451295f0e0c04619abb8bcdc18df22c84c5\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"1cf3e496-4c36-4f11-bab3-16bed89db345\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"52b3f8c9622b91912f96a0a2f130f6b604a957026432ba6e0a556a07d9f4e2e5\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 50731, \"end_char_idx\": 53272, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "{'name': 'control_drone_movement', 'arguments': '{\"direction\": \"up\", \"distance\": 10}'}\n    Can you bring the drone lower by 10 feet please?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"down\", \"distance\": 10}'}\n    I need the drone to descend 10 units, can you make that happen?\n    {'name': 'control_drone_movement', 'arguments': '{\"direction\": \"down\", \"distance\": 10}'}\n    Can you make the drone go faster?\n    {'name': 'set_drone_speed', 'arguments': '{\"speed\": 10}'}\n    I think the drone should speed up a bit, don't you think?\n    {'name': 'set_drone_speed', 'arguments': '{\"speed\": 10}'}\n    I want to take a picture, can you switch the camera mode to photo\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"photo\"}'}\n    Let's capture this moment, switch the camera to photo mode please\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"photo\"}'}\n    Can you switch the camera to photo mode and take a picture for 10 seconds?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"photo\", \"duration\": 10}'}\n    I need to capture something, can you set the camera to take photos for 10 seconds?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"photo\", \"duration\": 10}'}\n    Can you switch the camera to video mode?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"video\"}'}\n    I want to record, can you set the camera to video mode?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"video\"}'}\n    Can you start recording a video with the camera for a minute\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"video\", \"duration\": 60}'}\n    I need to film something, can you put the camera in video mode for 60 seconds\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"video\", \"duration\": 60}'}\n    Can you switch the camera to panorama mode?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"panorama\"}'}\n    I'd like to take a 360-degree photo, can you set the camera to panorama mode?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"panorama\"}'}\n    Can you set the camera to take a panorama shot for a minute\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"panorama\", \"duration\": 60}'}\n    I'd like to switch the camera mode to panorama and have it last for a minute\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"panorama\", \"duration\": 60}'}\n    Can you adjust the camera angle up and to the right?\n    {'name': 'control_gimbal', 'arguments': '{\"tilt\": 45, \"pan\": 90}'}\n    I need to tilt the camera up and pan it to the right, can you do that?"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 1cf3e496-4c36-4f11-bab3-16bed89db345
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"1cf3e496-4c36-4f11-bab3-16bed89db345\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"5e37eaf7-54d6-4aca-8daa-8a5656acb6a7\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"f18f99e780a145e6d3f3886a291026333b9b3d35dadbb9f14c95ea72886c8ded\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"7d7d92cb-551e-4c41-b916-261267cadd89\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"d76124c319154f2dbca48554e8f2fc199a43c604583ffdd7fa816c9f00114440\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 51870, \"end_char_idx\": 54462, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "{'name': 'control_camera', 'arguments': '{\"mode\": \"photo\", \"duration\": 10}'}\n    Can you switch the camera to video mode?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"video\"}'}\n    I want to record, can you set the camera to video mode?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"video\"}'}\n    Can you start recording a video with the camera for a minute\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"video\", \"duration\": 60}'}\n    I need to film something, can you put the camera in video mode for 60 seconds\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"video\", \"duration\": 60}'}\n    Can you switch the camera to panorama mode?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"panorama\"}'}\n    I'd like to take a 360-degree photo, can you set the camera to panorama mode?\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"panorama\"}'}\n    Can you set the camera to take a panorama shot for a minute\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"panorama\", \"duration\": 60}'}\n    I'd like to switch the camera mode to panorama and have it last for a minute\n    {'name': 'control_camera', 'arguments': '{\"mode\": \"panorama\", \"duration\": 60}'}\n    Can you adjust the camera angle up and to the right?\n    {'name': 'control_gimbal', 'arguments': '{\"tilt\": 45, \"pan\": 90}'}\n    I need to tilt the camera up and pan it to the right, can you do that?\n    {'name': 'control_gimbal', 'arguments': '{\"tilt\": 45, \"pan\": 90}'}\n    Can you turn on the lights for the drone\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"on\"}'}\n    I need some extra light, can you activate it on the drone\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"on\"}'}\n    Can you turn off the lights on the drone\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"off\"}'}\n    I don't need the drone lights on, can you switch them off\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"off\"}'}\n    Can you make the drone lights flash?\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"blink\"}'}\n    I want the drone lights to blink, can you do that?\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"blink\"}'}\n    Can you switch the drone lights to the SOS mode, just in case?\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"sos\"}'}\n    I need the drone lights to flash SOS, can you set that up?\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"sos\"}'}\n    Can you bring the drone back home now?\n    {'name': 'return_to_home', 'arguments': '{}'}\n    Is it time for the drone to return to base?"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 7d7d92cb-551e-4c41-b916-261267cadd89
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"7d7d92cb-551e-4c41-b916-261267cadd89\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"1cf3e496-4c36-4f11-bab3-16bed89db345\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0fdd17883e26064e0f0f6205551300d9bbfec0355a751388da743268ae446fb9\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"3667cbb7-a9a2-4b08-b429-2d26bce5535a\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"1a6bec9c48cf99d74fd61d434e81a60aaa3ddd01d9c3810b254e5ab9cbd55a46\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 53131, \"end_char_idx\": 55842, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "{'name': 'control_gimbal', 'arguments': '{\"tilt\": 45, \"pan\": 90}'}\n    I need to tilt the camera up and pan it to the right, can you do that?\n    {'name': 'control_gimbal', 'arguments': '{\"tilt\": 45, \"pan\": 90}'}\n    Can you turn on the lights for the drone\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"on\"}'}\n    I need some extra light, can you activate it on the drone\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"on\"}'}\n    Can you turn off the lights on the drone\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"off\"}'}\n    I don't need the drone lights on, can you switch them off\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"off\"}'}\n    Can you make the drone lights flash?\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"blink\"}'}\n    I want the drone lights to blink, can you do that?\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"blink\"}'}\n    Can you switch the drone lights to the SOS mode, just in case?\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"sos\"}'}\n    I need the drone lights to flash SOS, can you set that up?\n    {'name': 'set_drone_lighting', 'arguments': '{\"mode\": \"sos\"}'}\n    Can you bring the drone back home now?\n    {'name': 'return_to_home', 'arguments': '{}'}\n    Is it time for the drone to return to base?\n    {'name': 'return_to_home', 'arguments': '{}'}\n    My phone battery is draining so fast, can you turn on battery saver mode\n    {'name': 'set_battery_saver_mode', 'arguments': '{\"status\": \"on\"}'}\n    I need my laptop battery to last longer, can you switch on battery saver mode\n    {'name': 'set_battery_saver_mode', 'arguments': '{\"status\": \"on\"}'}\n    My phone battery is draining too quickly, can you turn off the battery saver mode\n    {'name': 'set_battery_saver_mode', 'arguments': '{\"status\": \"off\"}'}\n    I feel like my device is slower with battery saver on, can we turn it off?\n    {'name': 'set_battery_saver_mode', 'arguments': '{\"status\": \"off\"}'}\n    I want the car to avoid obstacles, can you turn on that feature?\n    {'name': 'set_obstacle_avoidance', 'arguments': '{\"mode\": \"on\"}'}\n    Can you activate the obstacle avoidance mode for safety purposes?\n    {'name': 'set_obstacle_avoidance', 'arguments': '{\"mode\": \"on\"}'}\n    I'd like to turn off obstacle detection, how do I do that?\n    {'name': 'set_obstacle_avoidance', 'arguments': '{\"mode\": \"off\"}'}\n    Can you disable the obstacle avoidance feature for now?\n    {'name': 'set_obstacle_avoidance', 'arguments': '{\"mode\": \"off\"}'}\n    Can you activate the follow me mode?\n    {'name': 'set_follow_me_mode', 'arguments': '{\"status\": \"on\"}'}\n    I want the car to follow me, can you turn on that feature?"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 3667cbb7-a9a2-4b08-b429-2d26bce5535a
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"3667cbb7-a9a2-4b08-b429-2d26bce5535a\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"7d7d92cb-551e-4c41-b916-261267cadd89\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"6c122ba9bb203650dedb06cb1beee2a8bdc27f059441d7c80baa2be871402255\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"6c6c056d-3604-41b4-af21-0e43ceb6d18c\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"797aab6d7d11d1d1075087796c844f8ae191289886b6f95d598b867a854e7d66\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 54369, \"end_char_idx\": 57087, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "{'name': 'return_to_home', 'arguments': '{}'}\n    Is it time for the drone to return to base?\n    {'name': 'return_to_home', 'arguments': '{}'}\n    My phone battery is draining so fast, can you turn on battery saver mode\n    {'name': 'set_battery_saver_mode', 'arguments': '{\"status\": \"on\"}'}\n    I need my laptop battery to last longer, can you switch on battery saver mode\n    {'name': 'set_battery_saver_mode', 'arguments': '{\"status\": \"on\"}'}\n    My phone battery is draining too quickly, can you turn off the battery saver mode\n    {'name': 'set_battery_saver_mode', 'arguments': '{\"status\": \"off\"}'}\n    I feel like my device is slower with battery saver on, can we turn it off?\n    {'name': 'set_battery_saver_mode', 'arguments': '{\"status\": \"off\"}'}\n    I want the car to avoid obstacles, can you turn on that feature?\n    {'name': 'set_obstacle_avoidance', 'arguments': '{\"mode\": \"on\"}'}\n    Can you activate the obstacle avoidance mode for safety purposes?\n    {'name': 'set_obstacle_avoidance', 'arguments': '{\"mode\": \"on\"}'}\n    I'd like to turn off obstacle detection, how do I do that?\n    {'name': 'set_obstacle_avoidance', 'arguments': '{\"mode\": \"off\"}'}\n    Can you disable the obstacle avoidance feature for now?\n    {'name': 'set_obstacle_avoidance', 'arguments': '{\"mode\": \"off\"}'}\n    Can you activate the follow me mode?\n    {'name': 'set_follow_me_mode', 'arguments': '{\"status\": \"on\"}'}\n    I want the car to follow me, can you turn on that feature?\n    {'name': 'set_follow_me_mode', 'arguments': '{\"status\": \"on\"}'}\n    I don't want the drone following me anymore, can you turn that off?\n    {'name': 'set_follow_me_mode', 'arguments': '{\"status\": \"off\"}'}\n    Can you disable the follow-me mode on the drone?\n    {'name': 'set_follow_me_mode', 'arguments': '{\"status\": \"off\"}'}\n    The sensors are acting up, can you recalibrate them\n    {'name': 'calibrate_sensors', 'arguments': '{}'}\n    My device doesn't seem to be sensing correctly, can you adjust it\n    {'name': 'calibrate_sensors', 'arguments': '{}'}\n    I'm too tired to drive, can you turn on the autopilot\n    {'name': 'set_autopilot', 'arguments': '{\"status\": \"on\"}'}\n    Let the car drive itself, turn on autopilot\n    {'name': 'set_autopilot', 'arguments': '{\"status\": \"on\"}'}\n    I'm feeling more confident, turn off the autopilot\n    {'name': 'set_autopilot', 'arguments': '{\"status\": \"off\"}'}\n    I think I can handle it, deactivate the automatic pilot\n    {'name': 'set_autopilot', 'arguments': '{\"status\": \"off\"}'}\n    Can you set the display to a steady yellow color?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"solid\", \"color\": \"yellow\"}'}\n    I'd like the LED display to be a solid yellow, please."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 6c6c056d-3604-41b4-af21-0e43ceb6d18c
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"6c6c056d-3604-41b4-af21-0e43ceb6d18c\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"3667cbb7-a9a2-4b08-b429-2d26bce5535a\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"ee64ba8fc290e7dc10a58c4e2c8289762fbb4b227afe16d11550f4907d286d83\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"8036964c-1f82-4948-b53e-607019d59736\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"0e3df9ed3688dbde6e4c977b6bf84579733b0b3c71682a44a843005124c17d1b\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 55716, \"end_char_idx\": 58453, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "{'name': 'set_follow_me_mode', 'arguments': '{\"status\": \"on\"}'}\n    I want the car to follow me, can you turn on that feature?\n    {'name': 'set_follow_me_mode', 'arguments': '{\"status\": \"on\"}'}\n    I don't want the drone following me anymore, can you turn that off?\n    {'name': 'set_follow_me_mode', 'arguments': '{\"status\": \"off\"}'}\n    Can you disable the follow-me mode on the drone?\n    {'name': 'set_follow_me_mode', 'arguments': '{\"status\": \"off\"}'}\n    The sensors are acting up, can you recalibrate them\n    {'name': 'calibrate_sensors', 'arguments': '{}'}\n    My device doesn't seem to be sensing correctly, can you adjust it\n    {'name': 'calibrate_sensors', 'arguments': '{}'}\n    I'm too tired to drive, can you turn on the autopilot\n    {'name': 'set_autopilot', 'arguments': '{\"status\": \"on\"}'}\n    Let the car drive itself, turn on autopilot\n    {'name': 'set_autopilot', 'arguments': '{\"status\": \"on\"}'}\n    I'm feeling more confident, turn off the autopilot\n    {'name': 'set_autopilot', 'arguments': '{\"status\": \"off\"}'}\n    I think I can handle it, deactivate the automatic pilot\n    {'name': 'set_autopilot', 'arguments': '{\"status\": \"off\"}'}\n    Can you set the display to a steady yellow color?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"solid\", \"color\": \"yellow\"}'}\n    I'd like the LED display to be a solid yellow, please.\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"solid\", \"color\": \"yellow\"}'}\n    Can you make the lights flash on and off\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\"}'}\n    I want the LED display to blink, can you set that up\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\"}'}\n    Can you make the lights flash in red?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\", \"color\": \"red\"}'}\n    How do I set the display to blink in red?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\", \"color\": \"red\"}'}\n    Can you make the lights flash in yellow?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\", \"color\": \"yellow\"}'}\n    How do I set the display to blink in yellow?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\", \"color\": \"yellow\"}'}\n    Can you make the lights blink instead of staying steady\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\"}'}\n    I want the LEDs to flash, not stay solid\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\"}'}\n    Can you make the LED display pulse in red, please?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"red\"}'}\n    I'd like the LED display to flash in red, can you set that up?"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 8036964c-1f82-4948-b53e-607019d59736
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"8036964c-1f82-4948-b53e-607019d59736\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6c6c056d-3604-41b4-af21-0e43ceb6d18c\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"8d66bfdb35e87fae9aa80e8f90e5881469d82385aab99e364396a4cfb398cdd4\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"ab22f63d-6d5a-49d4-8ca3-0940b7b0f09f\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"37948defa57c3dc413b978b059d8fbc1954583b7a938d988b9dd7ad53131799c\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 56939, \"end_char_idx\": 59865, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "{'name': 'configure_led_display', 'arguments': '{\"pattern\": \"solid\", \"color\": \"yellow\"}'}\n    I'd like the LED display to be a solid yellow, please.\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"solid\", \"color\": \"yellow\"}'}\n    Can you make the lights flash on and off\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\"}'}\n    I want the LED display to blink, can you set that up\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\"}'}\n    Can you make the lights flash in red?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\", \"color\": \"red\"}'}\n    How do I set the display to blink in red?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\", \"color\": \"red\"}'}\n    Can you make the lights flash in yellow?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\", \"color\": \"yellow\"}'}\n    How do I set the display to blink in yellow?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"blink\", \"color\": \"yellow\"}'}\n    Can you make the lights blink instead of staying steady\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\"}'}\n    I want the LEDs to flash, not stay solid\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\"}'}\n    Can you make the LED display pulse in red, please?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"red\"}'}\n    I'd like the LED display to flash in red, can you set that up?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"red\"}'}\n    I want the LED lights to flash in blue\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"blue\"}'}\n    Can you set the display to pulse with a blue color\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"blue\"}'}\n    Can you make the lights flash and change to green\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"green\"}'}\n    Let's set the LEDs to blink and switch to green\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"green\"}'}\n    Can you change the flashy lights to yellow and make them pulse\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"yellow\"}'}\n    I want the LED display to blink in yellow, can you do that\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"yellow\"}'}\n    Can you change the colors on the display to red and set it to a rainbow pattern?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"red\"}'}\n    I want the LED display to show a rainbow pattern in red, can you set that up?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"red\"}'}\n    Can you change the color and pattern of the lights to blue and rainbow?"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: ab22f63d-6d5a-49d4-8ca3-0940b7b0f09f
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"ab22f63d-6d5a-49d4-8ca3-0940b7b0f09f\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"8036964c-1f82-4948-b53e-607019d59736\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"449ac00d22ba37f1e4468df2be4027288889d6485bfea981a2e9a8681ad774bc\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"ed73dcab-593f-4c09-b2bb-e7c39a3dd20f\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"544c704c8cfb682d49df0b297cafcfdaea993250985d47f999b0d519e39c011a\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 58458, \"end_char_idx\": 61305, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "{'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"red\"}'}\n    I want the LED lights to flash in blue\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"blue\"}'}\n    Can you set the display to pulse with a blue color\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"blue\"}'}\n    Can you make the lights flash and change to green\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"green\"}'}\n    Let's set the LEDs to blink and switch to green\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"green\"}'}\n    Can you change the flashy lights to yellow and make them pulse\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"yellow\"}'}\n    I want the LED display to blink in yellow, can you do that\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"pulse\", \"color\": \"yellow\"}'}\n    Can you change the colors on the display to red and set it to a rainbow pattern?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"red\"}'}\n    I want the LED display to show a rainbow pattern in red, can you set that up?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"red\"}'}\n    Can you change the color and pattern of the lights to blue and rainbow?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"blue\"}'}\n    I'm feeling like some colorful lights, can you set it to blue and rainbow?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"blue\"}'}\n    Can you set the LED display to show a rainbow pattern in green color?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"green\"}'}\n    I'd like the LED display to cycle through colors, starting with green\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"green\"}'}\n    Can you make the lights do a cool rainbow effect\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"white\"}'}\n    Change the color of the lights to white and make them change like a rainbow\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"white\"}'}\n    I changed my mind, can you cancel that request\n    {'name': 'reject_request', 'arguments': '{}'}\n    I don't want to proceed with the request anymore, can you reject it\n    {'name': 'reject_request', 'arguments': '{}'}\n\n\nNow, back to the rejection function. Let's generate some prompts that are _nearly_ possible, but should result in the `reject_request` function being called. To do so, we queried `gpt-4o` asking for requests that are related to, but not quite possible with, the given list of functions."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: ed73dcab-593f-4c09-b2bb-e7c39a3dd20f
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"ed73dcab-593f-4c09-b2bb-e7c39a3dd20f\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"ab22f63d-6d5a-49d4-8ca3-0940b7b0f09f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"da20987caea537602a55c57953a857e66532b5ebf892b7a8a868376b240e9063\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"6c58932e-9140-45ab-a012-d5750a5f1d6d\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"d37fa88715bc67e4b7c7ff0f1153428d21fd61ef017f0faed51973022612a0f0\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 59701, \"end_char_idx\": 62894, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "{'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"red\"}'}\n    Can you change the color and pattern of the lights to blue and rainbow?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"blue\"}'}\n    I'm feeling like some colorful lights, can you set it to blue and rainbow?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"blue\"}'}\n    Can you set the LED display to show a rainbow pattern in green color?\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"green\"}'}\n    I'd like the LED display to cycle through colors, starting with green\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"green\"}'}\n    Can you make the lights do a cool rainbow effect\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"white\"}'}\n    Change the color of the lights to white and make them change like a rainbow\n    {'name': 'configure_led_display', 'arguments': '{\"pattern\": \"rainbow\", \"color\": \"white\"}'}\n    I changed my mind, can you cancel that request\n    {'name': 'reject_request', 'arguments': '{}'}\n    I don't want to proceed with the request anymore, can you reject it\n    {'name': 'reject_request', 'arguments': '{}'}\n\n\nNow, back to the rejection function. Let's generate some prompts that are _nearly_ possible, but should result in the `reject_request` function being called. To do so, we queried `gpt-4o` asking for requests that are related to, but not quite possible with, the given list of functions.\n\n\n\n```python\nreject_list = [\n    \"Translate broadcast message to another language\",\n    \"Automatically capture photos when face is detected\",\n    \"Detect nearby drones\",\n    \"Measure wind resistance\",\n    \"Capture slow motion video\",\n    \"Move the drone forward and backward by same distance at the same time.\",\n    \"Adjust drone's altitude to ground level changes\",\n    \"Display custom message on LED display\",\n    \"Sync drone's time with smartphone\",\n    \"Alert when drone travels out of designated area\",\n    \"Calibrate sensors and land simultaneously\",\n    \"Detect moisture levels\",\n    \"Automatically follow GPS tagged object\",\n    \"Toggle night vision mode\",\n    \"Maintain current altitude when battery is low\",\n    \"Decide best landing spot using AI\",\n    \"Program drone's route based on wind direction\",\n]\n```\n\n\n```python\nreject_training_list = []\nfor prompt in reject_list:\n    # Adjust formatting\n    tool_calls = [\n        {\n            \"id\": \"call_id\",\n            \"type\": \"function\",\n            \"function\": {\"name\": \"reject_request\", \"arguments\": \"{}\"},\n        }\n    ]\n    reject_training_list.append(\n        {\n            \"messages\": [\n                {\"role\": \"system\", \"content\": DRONE_SYSTEM_PROMPT},\n                {\"role\": \"user\", \"content\": prompt},\n                {\"role\": \"assistant\", \"tool_calls\": tool_calls},\n            ],\n            \"parallel_tool_calls\": False,\n            \"tools\": modified_function_list,\n        }\n    )\n```\n\nNow combine all the training examples together\n\n\n\n```python\ntraining_list_total = training_examples + reject_training_list\n```"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 6c58932e-9140-45ab-a012-d5750a5f1d6d
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"6c58932e-9140-45ab-a012-d5750a5f1d6d\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"ed73dcab-593f-4c09-b2bb-e7c39a3dd20f\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2752fca23ff1b0eb6023508e67bc4d4546419193f95a531600393bc72501ef1a\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"9edf2869-bb12-4660-b689-e8a3653a16bf\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"8ee4aa8f0781deaadc80c94163088e4a70694cf7d6289efa93755013f883fd6e\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 61019, \"end_char_idx\": 63158, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "Now, back to the rejection function. Let's generate some prompts that are _nearly_ possible, but should result in the `reject_request` function being called. To do so, we queried `gpt-4o` asking for requests that are related to, but not quite possible with, the given list of functions.\n\n\n\n```python\nreject_list = [\n    \"Translate broadcast message to another language\",\n    \"Automatically capture photos when face is detected\",\n    \"Detect nearby drones\",\n    \"Measure wind resistance\",\n    \"Capture slow motion video\",\n    \"Move the drone forward and backward by same distance at the same time.\",\n    \"Adjust drone's altitude to ground level changes\",\n    \"Display custom message on LED display\",\n    \"Sync drone's time with smartphone\",\n    \"Alert when drone travels out of designated area\",\n    \"Calibrate sensors and land simultaneously\",\n    \"Detect moisture levels\",\n    \"Automatically follow GPS tagged object\",\n    \"Toggle night vision mode\",\n    \"Maintain current altitude when battery is low\",\n    \"Decide best landing spot using AI\",\n    \"Program drone's route based on wind direction\",\n]\n```\n\n\n```python\nreject_training_list = []\nfor prompt in reject_list:\n    # Adjust formatting\n    tool_calls = [\n        {\n            \"id\": \"call_id\",\n            \"type\": \"function\",\n            \"function\": {\"name\": \"reject_request\", \"arguments\": \"{}\"},\n        }\n    ]\n    reject_training_list.append(\n        {\n            \"messages\": [\n                {\"role\": \"system\", \"content\": DRONE_SYSTEM_PROMPT},\n                {\"role\": \"user\", \"content\": prompt},\n                {\"role\": \"assistant\", \"tool_calls\": tool_calls},\n            ],\n            \"parallel_tool_calls\": False,\n            \"tools\": modified_function_list,\n        }\n    )\n```\n\nNow combine all the training examples together\n\n\n\n```python\ntraining_list_total = training_examples + reject_training_list\n```\n\n\n```python\ntraining_file = \"data/drone_training.jsonl\"\nwith open(training_file, \"w\") as f:\n    for item in training_list_total:\n        json_str = json.dumps(item)\n        f.write(f\"{json_str}\\n\")\n```\n\n# Fine tuning\n\n\nFinally, we can kick off the fine-tuning job"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 9edf2869-bb12-4660-b689-e8a3653a16bf
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"9edf2869-bb12-4660-b689-e8a3653a16bf\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6c58932e-9140-45ab-a012-d5750a5f1d6d\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"0a655fb8d75245d5ebd45b660efa26b488d16bfe4a7f8cd4e26d09f54cec8acc\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"6885e9bf-916f-428c-86a8-e40d28ababdf\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"0e32d6c301c6ed367dd287503dcdf5f16e20361765e7d170c43ff05f9dd8a968\", \"class_name\": \"RelatedNodeInfo\"}}, \"text\": \"\", \"mimetype\": \"text/plain\", \"start_char_idx\": 62126, \"end_char_idx\": 64872, \"text_template\": \"{metadata_str}\\n\\n{content}\", \"metadata_template\": \"{key}: {value}\", \"metadata_seperator\": \"\\n\", \"class_name\": \"TextNode\"}", "_node_type": "TextNode", "document_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "```python\nreject_training_list = []\nfor prompt in reject_list:\n    # Adjust formatting\n    tool_calls = [\n        {\n            \"id\": \"call_id\",\n            \"type\": \"function\",\n            \"function\": {\"name\": \"reject_request\", \"arguments\": \"{}\"},\n        }\n    ]\n    reject_training_list.append(\n        {\n            \"messages\": [\n                {\"role\": \"system\", \"content\": DRONE_SYSTEM_PROMPT},\n                {\"role\": \"user\", \"content\": prompt},\n                {\"role\": \"assistant\", \"tool_calls\": tool_calls},\n            ],\n            \"parallel_tool_calls\": False,\n            \"tools\": modified_function_list,\n        }\n    )\n```\n\nNow combine all the training examples together\n\n\n\n```python\ntraining_list_total = training_examples + reject_training_list\n```\n\n\n```python\ntraining_file = \"data/drone_training.jsonl\"\nwith open(training_file, \"w\") as f:\n    for item in training_list_total:\n        json_str = json.dumps(item)\n        f.write(f\"{json_str}\\n\")\n```\n\n# Fine tuning\n\n\nFinally, we can kick off the fine-tuning job\n\n\n\n```python\n# Upload the training file\nfile = client.files.create(\n    file=open(\"data/drone_training.jsonl\", \"rb\"),\n    purpose=\"fine-tune\",\n)\nfile_id = file.id\nprint(f\"FileID: {file_id}\")\n\n# Create a fine-tuning job\n\nft = client.fine_tuning.jobs.create(\n    model=\"gpt-3.5-turbo\",\n    training_file=file_id,\n    suffix=\"drone\",\n)\n\nprint(f\"Fine-tuning job created: {ft}\")\n```\n\n    FileID: file-blg0IytwIivZQzc9mbfnS8Pm\n    Fine-tuning job created: FineTuningJob(id='ftjob-84PQg97hoIAKf21IPnhiNlU1', created_at=1718580285, error=Error(code=None, message=None, param=None), fine_tuned_model=None, finished_at=None, hyperparameters=Hyperparameters(n_epochs='auto', batch_size='auto', learning_rate_multiplier='auto'), model='gpt-3.5-turbo-0125', object='fine_tuning.job', organization_id='org-lb41cclBdkq5pm6BgDhx8DHP', result_files=[], seed=1513865891, status='validating_files', trained_tokens=None, training_file='file-blg0IytwIivZQzc9mbfnS8Pm', validation_file=None, estimated_finish=None, integrations=[], user_provided_suffix='drone')\n\n\nIn addition to creating a fine-tuning job, you can also list existing jobs, retrieve the status of a job, or cancel a job.\n\n\n\n```python\nftjob_id = \"ftjob-84PQg97hoIAKf21IPnhiNlU1\"\n# List 10 fine-tuning jobs\n# client.fine_tuning.jobs.list(limit=10)\n\n# Retrieve the state of a fine-tune\nclient.fine_tuning.jobs.retrieve(ftjob_id)\n\n# Cancel a job\n# client.fine_tuning.jobs.cancel(\"ftjob-abc123\")\n\n# List up to 10 events from a fine-tuning job\n# client.fine_tuning.jobs.list_events(fine_tuning_job_id=\"ftjob-abc123\", limit=10)\n\n# Delete a fine-tuned model (must be an owner of the org the model was created in)\n# client.models.delete(\"ft:gpt-3.5-turbo:abc:suffix:abc123\")\n```"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 6885e9bf-916f-428c-86a8-e40d28ababdf
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"6885e9bf-916f-428c-86a8-e40d28ababdf\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"9edf2869-bb12-4660-b689-e8a3653a16bf\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"8ba3739cfafb9214f72506904d6456f1a9112f8d064ad0cfe48a144965dd9058\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4f065ed2-b92a-4fb6-8198-9d896ce67930\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"ed10c97f446ea5370f11505fba19064dd2f9761643787c41d01f58ea4522fa88\", \"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": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "In addition to creating a fine-tuning job, you can also list existing jobs, retrieve the status of a job, or cancel a job.\n\n\n\n```python\nftjob_id = \"ftjob-84PQg97hoIAKf21IPnhiNlU1\"\n# List 10 fine-tuning jobs\n# client.fine_tuning.jobs.list(limit=10)\n\n# Retrieve the state of a fine-tune\nclient.fine_tuning.jobs.retrieve(ftjob_id)\n\n# Cancel a job\n# client.fine_tuning.jobs.cancel(\"ftjob-abc123\")\n\n# List up to 10 events from a fine-tuning job\n# client.fine_tuning.jobs.list_events(fine_tuning_job_id=\"ftjob-abc123\", limit=10)\n\n# Delete a fine-tuned model (must be an owner of the org the model was created in)\n# client.models.delete(\"ft:gpt-3.5-turbo:abc:suffix:abc123\")\n```\n\n\n\n\n    FineTuningJob(id='ftjob-84PQg97hoIAKf21IPnhiNlU1', created_at=1718580285, error=Error(code=None, message=None, param=None), fine_tuned_model='ft:gpt-3.5-turbo-0125:openai-gtm:drone:9atiPjeC', finished_at=1718581004, hyperparameters=Hyperparameters(n_epochs=3, batch_size=1, learning_rate_multiplier=2), model='gpt-3.5-turbo-0125', object='fine_tuning.job', organization_id='org-lb41cclBdkq5pm6BgDhx8DHP', result_files=['file-F6XPJFLVG9f3mR04KBmwUI9H'], seed=1513865891, status='succeeded', trained_tokens=145983, training_file='file-blg0IytwIivZQzc9mbfnS8Pm', validation_file=None, estimated_finish=None, integrations=[], user_provided_suffix='drone')\n\n\n\nAfter a fine-tuning job has finished, you can also see metrics around how the training process went by querying a fine-tuning job, extracting a file ID from the result_files, and then retrieving that files content. Each results CSV file has the following columns: step, train_loss, train_accuracy, valid_loss, and valid_mean_token_accuracy. While metrics can he helpful, evaluating samples from the fine-tuned model provides the most relevant sense of model quality.\n\n\n\n```python\nfine_tune_results = client.fine_tuning.jobs.retrieve(ftjob_id).result_files\nresult_file_id = client.files.retrieve(fine_tune_results[0]).id\n\n# Retrieve the result file\nresult_file = client.files.content(file_id=result_file_id)\ndecoded_content = base64.b64decode(result_file.read()).decode(\"utf-8\")\nprint(decoded_content)\n```\n\n    step,train_loss,train_accuracy,valid_loss,valid_mean_token_accuracy\n    1,3.63265,0.5,\n    2,2.45992,0.80952,\n    3,2.77939,0.80952,\n    4,3.53073,0.65,\n    5,2.61654,0.8,\n    6,2.16,0.85714,\n    7,2.73706,0.8,\n    8,2.56944,0.625,\n    9,2.06096,0.78947,"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 4f065ed2-b92a-4fb6-8198-9d896ce67930
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"4f065ed2-b92a-4fb6-8198-9d896ce67930\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"6885e9bf-916f-428c-86a8-e40d28ababdf\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"096e46b707c84199892128973c1f6bc4df07cef93f43fbbaf0d43c84867b00d8\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"b0788c7e-a993-41d0-95df-7413a8610c42\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"6ff5d6ca3070ea80a38552907819697d6cefb2c5ba678771185038dccbfe2f22\", \"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": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "After a fine-tuning job has finished, you can also see metrics around how the training process went by querying a fine-tuning job, extracting a file ID from the result_files, and then retrieving that files content. Each results CSV file has the following columns: step, train_loss, train_accuracy, valid_loss, and valid_mean_token_accuracy. While metrics can he helpful, evaluating samples from the fine-tuned model provides the most relevant sense of model quality.\n\n\n\n```python\nfine_tune_results = client.fine_tuning.jobs.retrieve(ftjob_id).result_files\nresult_file_id = client.files.retrieve(fine_tune_results[0]).id\n\n# Retrieve the result file\nresult_file = client.files.content(file_id=result_file_id)\ndecoded_content = base64.b64decode(result_file.read()).decode(\"utf-8\")\nprint(decoded_content)\n```\n\n    step,train_loss,train_accuracy,valid_loss,valid_mean_token_accuracy\n    1,3.63265,0.5,\n    2,2.45992,0.80952,\n    3,2.77939,0.80952,\n    4,3.53073,0.65,\n    5,2.61654,0.8,\n    6,2.16,0.85714,\n    7,2.73706,0.8,\n    8,2.56944,0.625,\n    9,2.06096,0.78947,\n    10,1.69598,0.8,\n    11,1.94268,0.77778,\n    12,1.61752,0.86667,\n    13,1.2442,0.8,\n    14,0.73411,0.875,\n    15,0.34285,0.875,\n    16,0.22229,0.95238,\n    17,0.04635,0.95,\n    18,0.00626,1.0,\n    19,0.60888,0.90909,\n    20,0.00092,1.0,\n    21,0.8001,0.95,\n    22,0.04982,1.0,\n    23,0.35494,0.92857,\n    24,0.00023,1.0,\n    25,0.00034,1.0,\n    26,0.0029,1.0,\n    27,0.58017,0.875,\n    28,0.13018,0.9375,\n    29,0.00109,1.0,\n    30,6e-05,1.0,\n    31,0.61665,0.95,\n    32,3e-05,1.0,\n    33,0.23598,0.95,\n    34,3e-05,1.0,\n    35,0.03566,1.0,\n    36,1e-05,1.0,\n    37,1e-05,1.0,\n    38,2e-05,1.0,\n    39,2e-05,1.0,\n    40,0.00034,1.0,"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: b0788c7e-a993-41d0-95df-7413a8610c42
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"b0788c7e-a993-41d0-95df-7413a8610c42\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"4f065ed2-b92a-4fb6-8198-9d896ce67930\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"f1a85244a376ae05c10e6749c9c1599e35e583256cb0223440fef3ce5dbd6e84\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"f1f38175-2295-432a-920f-99c08a4e5317\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"ba9e5b58a54751dad74772258f171edc70d5ab149e399d7b60c45916cdb1b08b\", \"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": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "86667,\n    13,1.2442,0.8,\n    14,0.73411,0.875,\n    15,0.34285,0.875,\n    16,0.22229,0.95238,\n    17,0.04635,0.95,\n    18,0.00626,1.0,\n    19,0.60888,0.90909,\n    20,0.00092,1.0,\n    21,0.8001,0.95,\n    22,0.04982,1.0,\n    23,0.35494,0.92857,\n    24,0.00023,1.0,\n    25,0.00034,1.0,\n    26,0.0029,1.0,\n    27,0.58017,0.875,\n    28,0.13018,0.9375,\n    29,0.00109,1.0,\n    30,6e-05,1.0,\n    31,0.61665,0.95,\n    32,3e-05,1.0,\n    33,0.23598,0.95,\n    34,3e-05,1.0,\n    35,0.03566,1.0,\n    36,1e-05,1.0,\n    37,1e-05,1.0,\n    38,2e-05,1.0,\n    39,2e-05,1.0,\n    40,0.00034,1.0,\n    41,0.0,1.0,\n    42,0.0,1.0,\n    43,0.0,1.0,\n    44,0.0,1.0,\n    45,0.0,1.0,\n    46,0.91896,0.95,\n    47,0.0,1.0,\n    48,0.12006,0.95,\n    49,0.0,1.0,\n    50,3.92872,0.75,\n    51,0.0,1.0,\n    52,0.98277,0.90476,\n    53,0.0,1.0,\n    54,0.0,1.0,\n    55,1e-05,1.0,\n    56,0.00401,1.0,\n    57,0.07366,1.0,\n    58,0.0,1.0,\n    59,0.0,1.0,\n    60,0.0,1.0,\n    61,0.0,1.0,\n    62,0.10347,0.875,\n    63,0.0,1.0,\n    64,0.0,1.0,\n    65,1e-05,1.0,\n    66,2.97112,0.85714,\n    67,1.12396,0.875,\n    68,2e-05,"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: f1f38175-2295-432a-920f-99c08a4e5317
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"f1f38175-2295-432a-920f-99c08a4e5317\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"b0788c7e-a993-41d0-95df-7413a8610c42\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"92a5ae16c405fbf376e3019c7980885160a98c3bbbbe9b96cbedb4f2c902a1ee\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4a2a6c29-8a6d-4eaa-9373-3e302b088b7e\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"c0c71ec11b527bc840168a4c135b213a458783e152d5ee6931b64ae4c7d40822\", \"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": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "2e-05,1.0,\n    40,0.00034,1.0,\n    41,0.0,1.0,\n    42,0.0,1.0,\n    43,0.0,1.0,\n    44,0.0,1.0,\n    45,0.0,1.0,\n    46,0.91896,0.95,\n    47,0.0,1.0,\n    48,0.12006,0.95,\n    49,0.0,1.0,\n    50,3.92872,0.75,\n    51,0.0,1.0,\n    52,0.98277,0.90476,\n    53,0.0,1.0,\n    54,0.0,1.0,\n    55,1e-05,1.0,\n    56,0.00401,1.0,\n    57,0.07366,1.0,\n    58,0.0,1.0,\n    59,0.0,1.0,\n    60,0.0,1.0,\n    61,0.0,1.0,\n    62,0.10347,0.875,\n    63,0.0,1.0,\n    64,0.0,1.0,\n    65,1e-05,1.0,\n    66,2.97112,0.85714,\n    67,1.12396,0.875,\n    68,2e-05,1.0,\n    69,0.00067,1.0,\n    70,0.0,1.0,\n    71,0.0,1.0,\n    72,0.0,1.0,\n    73,0.0,1.0,\n    74,0.0,1.0,\n    75,0.02064,1.0,\n    76,0.5146,0.86667,\n    77,0.18756,0.95,\n    78,6e-05,1.0,\n    79,0.0,1.0,\n    80,0.21298,0.93333,\n    81,0.0,1.0,\n    82,0.0,1.0,\n    83,0.0,1.0,\n    84,0.00139,1.0,\n    85,0.0,1.0,\n    86,0.85297,0.875,\n    87,0.0,1.0,\n    88,0.0,1.0,\n    89,1.45164,0.875,\n    90,0.0,1.0,\n    91,0.05329,0.92857,\n    92,0.55506,0.93333,\n    93,0.42187,0.92857,\n    94,0.0,1.0,\n    95,0.0,1.0,"}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 4a2a6c29-8a6d-4eaa-9373-3e302b088b7e
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"4a2a6c29-8a6d-4eaa-9373-3e302b088b7e\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"f1f38175-2295-432a-920f-99c08a4e5317\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"562ebd256f0595bfbdfd0fddc08e58e453ebb2c51e08c76e4c5f9159fcd6c0e0\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"4737d63d-361b-447c-a2f7-67a5159523d4\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"658db7898fc4f64fa195b9bea209c4f54dceef54d0130a0b1b7654fbbe4f7b1a\", \"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": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "85714,\n    67,1.12396,0.875,\n    68,2e-05,1.0,\n    69,0.00067,1.0,\n    70,0.0,1.0,\n    71,0.0,1.0,\n    72,0.0,1.0,\n    73,0.0,1.0,\n    74,0.0,1.0,\n    75,0.02064,1.0,\n    76,0.5146,0.86667,\n    77,0.18756,0.95,\n    78,6e-05,1.0,\n    79,0.0,1.0,\n    80,0.21298,0.93333,\n    81,0.0,1.0,\n    82,0.0,1.0,\n    83,0.0,1.0,\n    84,0.00139,1.0,\n    85,0.0,1.0,\n    86,0.85297,0.875,\n    87,0.0,1.0,\n    88,0.0,1.0,\n    89,1.45164,0.875,\n    90,0.0,1.0,\n    91,0.05329,0.92857,\n    92,0.55506,0.93333,\n    93,0.42187,0.92857,\n    94,0.0,1.0,\n    95,0.0,1.0,\n    96,0.0,1.0,\n    97,0.0,1.0,\n    98,0.0,1.0,\n    99,0.0,1.0,\n    100,0.0,1.0,\n    101,0.0,1.0,\n    102,0.0,1.0,\n    103,0.09194,0.95455,\n    104,0.0,1.0,\n    105,0.0,1.0,\n    106,0.05531,0.95,\n    107,0.0,1.0,\n    108,0.39621,0.95238,\n    109,0.0,1.0,\n    110,0.8449,0.95,\n    111,0.01258,1.0,\n    112,0.0,1.0,\n    113,0.0,1.0,\n    114,0.0,1.0,\n    115,0.00355,1.0,\n    116,0.0,1.0,\n    117,0.3954,0.94118,\n    118,0.00259,1.0,\n    119,0.0,1.0,\n    120,0.0,1.0,\n    121,0.35876,0.95,\n    122,0.0,1.0,\n    123,0.0,1."}


created_at: 2024-08-26 20:31:21
topic: persistent://default/default/47f0afae-77ee-4e4a-bcd4-0b050f4de62c
id: 4737d63d-361b-447c-a2f7-67a5159523d4
encoding: FLOAT32
metadata:
{"url": "https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb", "title": "Fine tuning with function-calling", "tokens": 26666, "retrieve_doc": false, "source": "openai_cookbooks", "_node_content": "{\"id_\": \"4737d63d-361b-447c-a2f7-67a5159523d4\", \"embedding\": null, \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"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\": \"d5b2b0e6-e9a5-4090-8377-78ae98366ce1\", \"node_type\": \"4\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"2aea7678eb93141493c86671ff644a0d6e245e50fb8bcbdf589d99dbf4fa0d0d\", \"class_name\": \"RelatedNodeInfo\"}, \"2\": {\"node_id\": \"4a2a6c29-8a6d-4eaa-9373-3e302b088b7e\", \"node_type\": \"1\", \"metadata\": {\"url\": \"https://github.com/openai/openai-cookbook/blob/main/examples/Fine_tuning_for_function_calling.ipynb\", \"title\": \"Fine tuning with function-calling\", \"tokens\": 26666, \"retrieve_doc\": false, \"source\": \"openai_cookbooks\"}, \"hash\": \"7170e582efe33c5193177555dd8cb6f9301c4af7796ae067997569aaff289217\", \"class_name\": \"RelatedNodeInfo\"}, \"3\": {\"node_id\": \"214728b7-785d-418f-92fc-866b0af6b272\", \"node_type\": \"1\", \"metadata\": {}, \"hash\": \"7c623d6051c360588130e60d9b3afe240ef4a0588a94f390124282dff50a7767\", \"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": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "ref_doc_id": "d5b2b0e6-e9a5-4090-8377-78ae98366ce1", "chroma:document": "94,0.0,1.0,\n    95,0.0,1.0,\n    96,0.0,1.0,\n    97,0.0,1.0,\n    98,0.0,1.0,\n    99,0.0,1.0,\n    100,0.0,1.0,\n    101,0.0,1.0,\n    102,0.0,1.0,\n    103,0.09194,0.95455,\n    104,0.0,1.0,\n    105,0.0,1.0,\n    106,0.05531,0.95,\n    107,0.0,1.0,\n    108,0.39621,0.95238,\n    109,0.0,1.0,\n    110,0.8449,0.95,\n    111,0.01258,1.0,\n    112,0.0,1.0,\n    113,0.0,1.0,\n    114,0.0,1.0,\n    115,0.00355,1.0,\n    116,0.0,1.0,\n    117,0.3954,0.94118,\n    118,0.00259,1.0,\n    119,0.0,1.0,\n    120,0.0,1.0,\n    121,0.35876,0.95,\n    122,0.0,1.0,\n    123,0.0,1.0,\n    124,5e-05,1.0,\n    125,0.0,1.0,\n    126,0.0,1.0,\n    127,0.0,1.0,\n    128,0.0,1.0,\n    129,0.0,1.0,\n    130,0.01336,1.0,\n    131,0.0,1.0,\n    132,0.23362,0.95,\n    133,0.00157,1.0,\n    134,0.0,1.0,\n    135,0.00031,1.0,\n    136,0.0,1.0,\n    137,0.08313,0.92857,\n    138,0.0,1.0,\n    139,0.0,1.0,\n    140,0.0,1.0,\n    141,0.43608,0.95,\n    142,0.0,1.0,\n    143,0.0,1.0,\n    144,0.0,1.0,\n    145,2e-05,1.0,\n    146,1.20409,0.85714,\n    147,0.0,1.0,\n    148,0.0,1.0,\n    149,0.0,1.0,\n    150,0.0,1.0,\n    151,0.0,"}


