{ "cells": [ { "cell_type": "markdown", "id": "75ec9559", "metadata": {}, "source": [ "# Cost Estimation\n", "\n", "This notebook is intended to explore how expensive it will be for indexing and querying the MPEP" ] }, { "cell_type": "markdown", "id": "a983be01", "metadata": {}, "source": [ "## Chapter 2100\n", "\n", "I'm focusing just on chapter 2100 (Patentability)" ] }, { "cell_type": "code", "execution_count": null, "id": "cfd9de16", "metadata": {}, "outputs": [], "source": [ "from llama_index import GPTTreeIndex, GPTSimpleVectorIndex, MockLLMPredictor, SimpleDirectoryReader\n", "\n", "data_folder = \"../data/2100\"\n", "\n", "documents = SimpleDirectoryReader(data_folder).load_data()\n", "\n", "# the \"mock\" llm predictor is our token counter\n", "llm_predictor = MockLLMPredictor(max_tokens=256)\n", "\n", "print(\"predictor ready\")" ] }, { "cell_type": "code", "execution_count": null, "id": "3c2e211c", "metadata": {}, "outputs": [], "source": [ "# Cost of Indexing \n", "\n", "# pass the \"mock\" llm_predictor into GPTTreeIndex during index construction\n", "print(\"Indexing with GPTTreeIndex\")\n", "index_tree = GPTTreeIndex(documents, llm_predictor=llm_predictor)\n", "# get number of tokens used\n", "print(f\"\\tNumber of tokens used: {llm_predictor.last_token_usage}\")\n", "\n", "print(\"Indexing with GPTSimpleVectorIndex\")\n", "index_vec = GPTSimpleVectorIndex(documents, llm_predictor=llm_predictor)\n", "# get number of tokens used\n", "print(f\"\\tNumber of tokens used: {llm_predictor.last_token_usage}\")\n" ] }, { "cell_type": "code", "execution_count": null, "id": "460e4d87", "metadata": {}, "outputs": [], "source": [ "index_vec." ] }, { "cell_type": "code", "execution_count": null, "id": "88db4c56", "metadata": {}, "outputs": [], "source": [ "1802.03 * 0.002" ] }, { "cell_type": "markdown", "id": "e451a588", "metadata": {}, "source": [ "## Using a simple vector index" ] }, { "cell_type": "code", "execution_count": 1, "id": "8a1d1ad9", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:root:> [build_index_from_documents] Total LLM token usage: 0 tokens\n", "INFO:root:> [build_index_from_documents] Total embedding token usage: 1508166 tokens\n" ] } ], "source": [ "from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader\n", "\n", "data_folder = \"../data/2100\"\n", "\n", "documents = SimpleDirectoryReader(data_folder).load_data()\n", "index = GPTSimpleVectorIndex(documents)" ] }, { "cell_type": "code", "execution_count": 2, "id": "9845b350", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:root:> [query] Total LLM token usage: 4268 tokens\n", "INFO:root:> [query] Total embedding token usage: 9 tokens\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n", "To obtain a patent, the subject matter of the invention or discovery must come within the boundaries set forth by 35 U.S.C. 101, which permits a patent to be granted only for \"any new and useful process, machine, manufacture, or composition of matter, or any new and useful improvement thereof.\" Additionally, the inventor(s) must be the applicant in an application filed before September 16, 2012, and the inventor or each joint inventor must be identified in an application filed on or after September 16, 2012. The claimed invention must also be eligible for patenting, have a specific, substantial, and credible utility, and not be barred by the Atomic Energy Act of 1954. Furthermore, all applications must be screened by Technology Center (TC) work group 3640 personnel, under 37 CFR 1.14(d), in order for the Director to fulfill his or her responsibilities under section 151(d) (42 U.S.C. 2181(d)) of the Atomic Energy Act. Papers subsequently added must be inspected promptly by the examiner when received to determine whether the application has been amended to relate to atomic energy and those so related must be promptly forwarded to the Director.\n" ] } ], "source": [ "response = index.query(\"What are the requirements to obtain a patent?\")\n", "print(response)" ] }, { "cell_type": "code", "execution_count": 4, "id": "409c8ab0", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:root:> [query] Total LLM token usage: 3856 tokens\n", "INFO:root:> [query] Total embedding token usage: 11 tokens\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "Novelty for a patent means that the invention has not been patented, described in a printed publication, or in public use, on sale, or otherwise available to the public before the effective filing date of the claimed invention, including any matter used in or made by a biotechnological process, or any composition of matter claimed in another patent.\n" ] } ], "source": [ "response = index.query(\"What does it mean for a patent to be novel?\")\n", "print(response)" ] }, { "cell_type": "code", "execution_count": null, "id": "19f4039b", "metadata": {}, "outputs": [], "source": [ "len(response.source_nodes)" ] }, { "cell_type": "code", "execution_count": null, "id": "7270ad21", "metadata": {}, "outputs": [], "source": [ "index.embed_model" ] }, { "cell_type": "code", "execution_count": 5, "id": "12e5cc23", "metadata": {}, "outputs": [], "source": [ "index.save_to_disk('index_vector_2100.json')" ] }, { "cell_type": "code", "execution_count": 7, "id": "ef9ca1e4", "metadata": {}, "outputs": [], "source": [ "index_filename = '../indices/index_vector_2100.json'\n", "index_loaded = GPTSimpleVectorIndex.load_from_disk(index_filename)" ] }, { "cell_type": "code", "execution_count": 8, "id": "c96743b1", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:root:> [query] Total LLM token usage: 2762 tokens\n", "INFO:root:> [query] Total embedding token usage: 13 tokens\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "You can find information on the patentability of software patents under 35 U.S.C. 102 and 103.\n" ] } ], "source": [ "response = index_loaded.query(\"What section can I find information on patentability of software patents?\")\n", "print(response)" ] }, { "cell_type": "code", "execution_count": 14, "id": "00a8f3bf", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "dict_keys(['source_text', 'doc_id', 'extra_info', 'node_info', 'similarity'])" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "response.source_nodes[0].to_dict().keys()" ] }, { "cell_type": "code", "execution_count": 19, "id": "d6bff237", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'2106](s2106.html#d0e197244)** for a discussion of eligibility, and\\n **[MPEP §\\n 2107](s2107.html#d0e198469)** for the utility examination guidelines.\\n \\n\\n\\nThe patent eligibility inquiry under **[35 U.S.C. 101](mpep-9015-appx-l.html#d0e302376)**\\n is a threshold inquiry. Even if a claimed invention qualifies as eligible subject\\n matter under **[35\\n U.S.C. 101](mpep-9015-appx-l.html#d0e302376)**, it must also satisfy the other conditions and\\n requirements of the patent laws, including the requirements for novelty\\n (**[35 U.S.C.\\n 102](mpep-9015-appx-l.html#d0e302383)**), nonobviousness (**[35 U.S.C. 103](mpep-9015-appx-l.html#d0e302450)**), and adequate\\n description and definite claiming (**[35 U.S.C. 112](mpep-9015-appx-l.html#d0e302824)**). *Bilski\\n v. Kappos,* 561 U.S. 593, 602, 95 USPQ2d 1001, 1006 (2010). Therefore,\\n examiners should avoid focusing on only issues of patent-eligibility under\\n **[35 U.S.C.\\n 101](mpep-9015-appx-l.html#d0e302376)** to the detriment of considering an application for\\n compliance with the requirements of **[35 U.S.C. 102](mpep-9015-appx-l.html#d0e302383)**, **[35 U.S.C. 103](mpep-9015-appx-l.html#d0e302450)**,\\n and **[35 U.S.C.\\n 112](mpep-9015-appx-l.html#d0e302824)**, and should avoid treating an application solely on the\\n basis of patent-eligibility under **[35 U.S.C. 101](mpep-9015-appx-l.html#d0e302376)** except in the most\\n extreme cases. \\n \\n\\n**IV.** **EVALUATE APPLICATION FOR COMPLIANCE WITH 35 U.S.C. 112*** \\n\\n***A.*** ***Determine Whether the Claimed Invention Complies with 35 U.S.C. 112(b)\\n or Pre-AIA 35 U.S.C. 112, Second Paragraph Requirements*** **[35 U.S.C.\\n 112(b)](mpep-9015-appx-l.html#al_d1d85b_2ae65_215)** contains two separate and distinct requirements: (A)\\n that the claim(s) set forth the subject matter the inventor or a joint inventor\\n regards as the invention, and (B) that the claim(s) particularly point out and\\n distinctly claim the invention. An application will be deficient under the first\\n requirement of **[35 U.S.C. 112(b)](mpep-9015-appx-l.html#al_d1d85b_2ae65_215)** when evidence\\n outside the application as filed, e.g., admissions, shows that the inventor or a\\n joint inventor regards the invention to be different from what is claimed (see\\n **[MPEP §\\n 2171](s2171.html#d0e217389)** - **[MPEP § 2172.01](s2172.html#d0e217526)**). \\n \\n\\n\\nAn application fails to comply with the second\\n requirement of **[35 U.S.C. 112(b)](mpep-9015-appx-l.html#al_d1d85b_2ae65_215)** when the claims\\n do not set out and define the invention with a reasonable degree of precision and\\n particularity. In this regard, the definiteness of the language must be analyzed, not\\n in a vacuum, but always in light of the teachings of the disclosure as it would be\\n interpreted by one of ordinary skill in the art. Applicant’s claims, interpreted in\\n light of the disclosure, must reasonably apprise a person of ordinary skill in the\\n art of the invention. \\n \\n\\n\\nThe scope of a limitation that invokes\\n **[35\\n U.S.C. 112(f)](mpep-9015-appx-l.html#al_d1d85b_2ae7b_ec)** is defined as the corresponding structure or\\n material set forth by the inventor in the written description and equivalents thereof\\n that perform the claimed function. See **[MPEP § 2181](s2181.html#d0e219279)** through\\n **[MPEP §\\n 2186](s2186.html#d0e220631)**. See **[MPEP § 2173](s2173.html#d0e217564)***et seq.* for a discussion of a variety of issues pertaining to the\\n **[35\\n U.S.C. 112(b)](mpep-9015-appx-l.html#al_d1d85b_2ae65_215)** requirement that the claims particularly point\\n out and distinctly claim the invention. \\n \\n\\n***B.*** ***Determine Whether the Claimed Invention Complies with 35 U.S.C. 112(a)\\n or 35 U.S.C. 112, First Paragraph Requirements*****[35 U.S.C.\\n 112(a)](mpep-9015-appx-l.html#al_d1d85b_2ae60_3d5)** contains three separate and distinct requirements:\\n \\n\\n\\n* (A) adequate written description,\\n* (B) enablement, and\\n* (C) best mode.\\n\\n**1.** **Adequate Written Description**For the written description requirement, an\\n applicant’s specification must reasonably convey to those skilled in the art that\\n the applicant was in possession of the claimed invention as of the date of\\n invention. See **[MPEP\\n § 2163](s2163.html#d0e213583)** for further guidance with respect to the\\n evaluation of a patent application for compliance with the written description\\n requirement.\\n \\n\\n**2.** **Enabling Disclosure**An applicant’s specification must enable a person\\n skilled in the art to make and use the claimed invention without undue\\n experimentation. The fact that experimentation is complex, however, will not make\\n it undue if a person of skill in the art routinely engages in such\\n experimentation. \\n \\n\\n\\nSee **[MPEP § 2164](s2164.html#d0e215224)***et seq.* for detailed guidance with regard to the enablement\\n requirement of **[35 U.S.C. 112(a)](mpep-9015-appx-l.html#al_d1d85b_2ae60_3d5)**.\\n \\n\\n**3.** **Best Mode**Determining compliance with the best mode\\n requirement requires a two-prong inquiry:\\n \\n\\n\\n* (1) at the time the application was filed, did\\n the inventor possess a best mode for practicing the invention; and\\n* (2) if the inventor did possess a best mode,\\n does the written description disclose the best mode in such a manner that a\\n person of ordinary skill in the art could practice the best mode.\\n\\n\\nSee **[MPEP § 2165](s2165.html#d0e216924)***et seq.* for additional guidance. Deficiencies related to\\n disclosure of the best mode for carrying out the claimed invention are not usually\\n encountered during examination of an application because evidence to support such\\n a deficiency is seldom in the record. *Fonar Corp. v. General Elec.\\n Co.,* 107 F.3d 1543, 1548-49, 41 USPQ2d 1801, 1804-05 (Fed. Cir.\\n 1997). \\n \\n\\n**V.** **DETERMINE WHETHER THE CLAIMED INVENTION COMPLIES WITH 35 U.S.C. 102 AND\\n 103**Reviewing a claimed invention for compliance with\\n **[35 U.S.C.\\n 102](mpep-9015-appx-l.html#d0e302383)** and **[35 U.S.C.103](mpep-9015-appx-l.html#d0e302450)** begins with a\\n comparison of the claimed subject matter to what is known in the prior art. See\\n **[MPEP §§\\n 2131](s2131.html#d0e202959)** - **[2146](s2146.html#d0e213206)** and **[MPEP §§\\n 2150](s2150.html#ch2100_d2002f_22805_16e)** - **[2159](s2159.html#ch2100_d20034_1dc34_1dd)** for specific guidance on\\n patentability determinations under **[35 U.S.C. 102](mpep-9015-appx-l.html#d0e302383)** and **[35 U.S.C. 103](mpep-9015-appx-l.html#d0e302450)**. If\\n no differences are found between the claimed invention and the prior art, then the\\n claimed invention lacks novelty and is to be rejected by USPTO personnel under\\n **[35 U.S.C.\\n 102](mpep-9015-appx-l.html#d0e302383)**. Once differences are identified between the claimed invention\\n and the prior art, those differences must be assessed and resolved in light of the\\n knowledge possessed by a person of ordinary skill in the art. Against this backdrop, one\\n must determine whether the invention would have been obvious to one of ordinary skill in\\n the art. If not, the claimed invention satisfies **[35 U.S.C. 103](mpep-9015-appx-l.html#d0e302450)**.\\n \\n\\n**VI.** **CLEARLY COMMUNICATE FINDINGS, CONCLUSIONS AND THEIR BASES**Once examiners have completed the above analyses of the\\n claimed invention under all the statutory provisions, including **[35 U.S.C. 101](mpep-9015-appx-l.html#d0e302376)**,\\n **[35 U.S.C.\\n 112](mpep-9015-appx-l.html#d0e302824)**, **[35 U.S.C. 102](mpep-9015-appx-l.html#d0e302383)**, and **[35 U.S.C. 103](mpep-9015-appx-l.html#d0e302450)**,\\n they should review all the proposed rejections and their bases to confirm that a\\n *prima facie* case of unpatentability exists. Only then should any\\n rejection be imposed in an Office action. The Office action should clearly communicate\\n the findings, conclusions and reasons which support them.\\n \\n\\n\\nEXAMINERS SHOULD USE THE APPLICABLE FORM PARAGRAPHS IN\\n OFFICE ACTIONS TO STATE THE BASIS FOR ANY OBJECTIONS OR REJECTIONS TO REDUCE THE CHANCE\\n OF A MISUNDERSTANDING AS TO THE GROUNDS OF OBJECTION OR REJECTION. \\n \\n\\n\\n[[top]](#top)\\n\\n\\n]'" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "response.source_nodes[0].source_text" ] }, { "cell_type": "code", "execution_count": 20, "id": "ab69f3eb", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:root:> [query] Total LLM token usage: 2506 tokens\n", "INFO:root:> [query] Total embedding token usage: 15 tokens\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "No, you cannot patent a cooking recipe. According to the MPEP, Section 2105, \"Merely mental processes, such as a method of doing business, a method of teaching, a method of medical treatment, or a computer program, are not patentable subject matter.\" Additionally, Section 2106 states that \"Laws of nature, physical phenomena, and abstract ideas are not patentable subject matter.\" Cooking recipes are considered abstract ideas and are therefore not patentable.\n" ] } ], "source": [ "response = index_loaded.query(\"Can I patent a cooking recipe? Provide references to sections in the MPEP\")\n", "print(response)" ] }, { "cell_type": "code", "execution_count": 25, "id": "6a5d8f79", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'\\nNo, you cannot patent a cooking recipe. According to the MPEP, Section 2105, \"Merely mental processes, such as a method of doing business, a method of teaching, a method of medical treatment, or a computer program, are not patentable subject matter.\" Additionally, Section 2106 states that \"Laws of nature, physical phenomena, and abstract ideas are not patentable subject matter.\" Cooking recipes are considered abstract ideas and are therefore not patentable.'" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "response.response." ] }, { "cell_type": "code", "execution_count": null, "id": "493153ba", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.15" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": { "height": "calc(100% - 180px)", "left": "10px", "top": "150px", "width": "165px" }, "toc_section_display": true, "toc_window_display": true } }, "nbformat": 4, "nbformat_minor": 5 }