|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "md_text = \"\"\"\n", |
| 10 | + "# Header\n", |
| 11 | + "\n", |
| 12 | + "**bold**, _ite_, ~~other~~, more...\n", |
| 13 | + "`inline code` here.\n", |
| 14 | + "\n", |
| 15 | + "```python\n", |
| 16 | + "import os\n", |
| 17 | + "os.print('hello')\n", |
| 18 | + "```\n", |
| 19 | + "\n", |
| 20 | + "> Please work through this document in its entirety to better understand how OpenAI’s rate limit system works. We include code examples and possible solutions to handle common issues. It is recommended to **follow** this guidance before filling out the [Rate Limit Increase Request form](https://docs.google.com/forms/d/e/1FAIpQLSc6gSL3zfHFlL6gNIyUcjkEv29jModHGxg5_XGyr-PrE2LaHw/viewform) with details regarding how to fill it out in the last section.\n", |
| 21 | + "\n", |
| 22 | + "divider\n", |
| 23 | + "* * *\n", |
| 24 | + "\n", |
| 25 | + "### image\n", |
| 26 | + "local images:\n", |
| 27 | + "\n", |
| 28 | + "\n", |
| 29 | + "\n", |
| 30 | + "web image:\n", |
| 31 | + "\n", |
| 32 | + "\n", |
| 33 | + "[link](https://docs.microsoft.com/zh-tw/previous-versions/visualstudio/design-tools/expression-studio-2/cc294571(v=expression.10))\n", |
| 34 | + "\n", |
| 35 | + "### Table\n", |
| 36 | + "\n", |
| 37 | + "|header| column1 | column 2\n", |
| 38 | + "|-|-|-\n", |
| 39 | + "|row 1| row 1_1 | row 1_2\n", |
| 40 | + "|row 2| row 2_2 **bold**, _ite_, ~~other~~, more... | row 2_3\n", |
| 41 | + "\n", |
| 42 | + "### list\n", |
| 43 | + "\n", |
| 44 | + "[Why do we have rate limits?](https://platform.openai.com/docs/guides/rate-limits/overview)\n", |
| 45 | + "Rate limits are a common practice for APIs, and they're put in place for a few different reasons:\n", |
| 46 | + "\n", |
| 47 | + "- 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", |
| 48 | + "- 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 the most number of people have an opportunity to use the API without experiencing slowdowns.\n", |
| 49 | + "- 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", |
| 50 | + "\n", |
| 51 | + "number list\n", |
| 52 | + "\n", |
| 53 | + "1. number list1\n", |
| 54 | + "2. numner list2\n", |
| 55 | + "\n", |
| 56 | + "## checkbox\n", |
| 57 | + "\n", |
| 58 | + "Three frogs\n", |
| 59 | + "* [x] The first frog\n", |
| 60 | + "* [ ] The second frog\n", |
| 61 | + "* [ ] The third frog\n", |
| 62 | + "\n", |
| 63 | + "# math and grapth\n", |
| 64 | + "\n", |
| 65 | + "Here is math\n", |
| 66 | + "```math\n", |
| 67 | + "e^{i\\pi} + 1 = 0\n", |
| 68 | + "```\n", |
| 69 | + "\n", |
| 70 | + "mermaid grapth:\n", |
| 71 | + "\n", |
| 72 | + "```mermaid\n", |
| 73 | + "graph TD\n", |
| 74 | + "A[Module A] -->|A1| B( Module B)\n", |
| 75 | + "B --> C{Confidition C}\n", |
| 76 | + "C -->|condition C1| D[Module D]\n", |
| 77 | + "C -->|condition C2| E[Module E]\n", |
| 78 | + "C -->|condition C3| F[Module F]\n", |
| 79 | + "```\n", |
| 80 | + "\n", |
| 81 | + "sequenceDiagram\n", |
| 82 | + "\n", |
| 83 | + "```mermaid\n", |
| 84 | + "sequenceDiagram\n", |
| 85 | + "A->>B: Have you received a message?\n", |
| 86 | + "B-->>A: Message received\n", |
| 87 | + "```\n", |
| 88 | + "\n", |
| 89 | + "gantt\n", |
| 90 | + "\n", |
| 91 | + "```mermaid\n", |
| 92 | + "gantt\n", |
| 93 | + "title Gantt chart\n", |
| 94 | + "dateFormat YYYY-MM-DD\n", |
| 95 | + "section Proj A\n", |
| 96 | + "Task 1 :a1, 2018-06-06, 30d\n", |
| 97 | + "Task 2 :after a1 , 20d\n", |
| 98 | + "section Proj B\n", |
| 99 | + "Task 3 :2018-06-12 , 12d\n", |
| 100 | + "Task 4 : 24d\n", |
| 101 | + "```\n", |
| 102 | + "\n", |
| 103 | + "### chart\n", |
| 104 | + "\n", |
| 105 | + "```chart\n", |
| 106 | + ", budget, income, expenses, debt\n", |
| 107 | + "June,5000,8000,4000,6000\n", |
| 108 | + "July,3000,1000,4000,3000\n", |
| 109 | + "Aug,5000,7000,6000,3000\n", |
| 110 | + "Sep,7000,2000,3000,1000\n", |
| 111 | + "Oct,6000,5000,4000,2000\n", |
| 112 | + "Nov,4000,3000,5000,\n", |
| 113 | + "\n", |
| 114 | + "type: pie\n", |
| 115 | + "title: 每月收益\n", |
| 116 | + "x.title: Amount\n", |
| 117 | + "y.title: Month\n", |
| 118 | + "y.suffix: $\n", |
| 119 | + "```\n", |
| 120 | + "\n", |
| 121 | + "```chart\n", |
| 122 | + ",Budget,Income,Expenses,Debt\n", |
| 123 | + "June,5000,8000,4000,6000\n", |
| 124 | + "July,3000,1000,4000,3000\n", |
| 125 | + "Aug,5000,7000,6000,3000\n", |
| 126 | + "Sep,7000,2000,3000,1000\n", |
| 127 | + "Oct,6000,5000,4000,2000\n", |
| 128 | + "Nov,4000,3000,5000,\n", |
| 129 | + "\n", |
| 130 | + "type: line\n", |
| 131 | + "title: Monthly Revenue\n", |
| 132 | + "x.title: Amount\n", |
| 133 | + "y.title: Month\n", |
| 134 | + "y.suffix: $\n", |
| 135 | + "```\n", |
| 136 | + "\"\"\"" |
| 137 | + ] |
| 138 | + }, |
| 139 | + { |
| 140 | + "cell_type": "code", |
| 141 | + "execution_count": null, |
| 142 | + "metadata": {}, |
| 143 | + "outputs": [], |
| 144 | + "source": [ |
| 145 | + "import re\n", |
| 146 | + "\n", |
| 147 | + "def extract_code_blocks(md_text):\n", |
| 148 | + " code_pattern = re.compile(r'```(\\w+)?\\n(.*?)```', re.DOTALL)\n", |
| 149 | + " matches = code_pattern.findall(md_text)\n", |
| 150 | + " code_blocks = [{'language': match[0], 'code': match[1]} for match in matches]\n", |
| 151 | + " return code_blocks\n", |
| 152 | + "\n", |
| 153 | + "\n", |
| 154 | + "code_blocks = extract_code_blocks(md_text)\n", |
| 155 | + "\n", |
| 156 | + "for block in code_blocks:\n", |
| 157 | + " print(f\"Language: {block['language']}\")\n", |
| 158 | + " print(f\"Code: {block['code']}\\n\")\n" |
| 159 | + ] |
| 160 | + } |
| 161 | + ], |
| 162 | + "metadata": { |
| 163 | + "kernelspec": { |
| 164 | + "display_name": "notion", |
| 165 | + "language": "python", |
| 166 | + "name": "python3" |
| 167 | + }, |
| 168 | + "language_info": { |
| 169 | + "codemirror_mode": { |
| 170 | + "name": "ipython", |
| 171 | + "version": 3 |
| 172 | + }, |
| 173 | + "file_extension": ".py", |
| 174 | + "mimetype": "text/x-python", |
| 175 | + "name": "python", |
| 176 | + "nbconvert_exporter": "python", |
| 177 | + "pygments_lexer": "ipython3", |
| 178 | + "version": "3.11.2" |
| 179 | + }, |
| 180 | + "orig_nbformat": 4 |
| 181 | + }, |
| 182 | + "nbformat": 4, |
| 183 | + "nbformat_minor": 2 |
| 184 | +} |
0 commit comments