From a9198a04cdc730f35014c04587e131b50c7d7718 Mon Sep 17 00:00:00 2001 From: David Okpare Date: Wed, 12 Jul 2023 03:43:36 +0100 Subject: [PATCH] Fix typos (#58) --- docs/chat-completion.md | 2 +- docs/examples/autodataframe.md | 2 +- docs/examples/exact_citations.md | 6 +++--- docs/examples/index.md | 2 +- docs/examples/planning-tasks.md | 6 +++--- docs/examples/recursive.md | 2 +- docs/examples/search.md | 2 +- docs/multitask.md | 2 +- docs/philosophy.md | 6 +++--- docs/writing-prompts.md | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/chat-completion.md b/docs/chat-completion.md index d7cd364..e4af3d8 100644 --- a/docs/chat-completion.md +++ b/docs/chat-completion.md @@ -10,7 +10,7 @@ The `ChatCompletion` object is the starting point for constructing your API call ## Messages Types -The basis of a message is defined as a `dataclass`. However we provide helper functions and classes that provide additional functionality in the form of templates. +The basis of a message is defined as a `dataclass`. However, we provide helper functions and classes that provide additional functionality in the form of templates. ::: openai_function_call.dsl.messages.base diff --git a/docs/examples/autodataframe.md b/docs/examples/autodataframe.md index 6c8194f..66b1d20 100644 --- a/docs/examples/autodataframe.md +++ b/docs/examples/autodataframe.md @@ -3,7 +3,7 @@ In this example, we'll demonstrate how to convert a text into dataframes using OpenAI Function Call. We will define the necessary data structures using Pydantic and show how to convert the text into dataframes. !!! note "Motivation" - Often times when we parse data we have an opportunity to extract structured data, what if we could extract an arbitrary number of tables with arbitray schemas? By pulling out dataframes we could write tables or csv files and attach them to our retrived data. + Often times when we parse data we have an opportunity to extract structured data, what if we could extract an arbitrary number of tables with arbitrary schemas? By pulling out dataframes we could write tables or .csv files and attach them to our retrieved data. ## Defining the Data Structures diff --git a/docs/examples/exact_citations.md b/docs/examples/exact_citations.md index c9d45ec..382b119 100644 --- a/docs/examples/exact_citations.md +++ b/docs/examples/exact_citations.md @@ -11,7 +11,7 @@ In this example, we'll demonstrate how to use OpenAI Function Call to ask an AI Let's start by defining the data structures required for this task: `Fact` and `QuestionAnswer`. !!! tip "Prompting as documentation" - Make sure to include detailed and useful docstrings and fields for your class definitions. Naming becomes very important since they are semantically meaninful in the prompt. + Make sure to include detailed and useful docstrings and fields for your class definitions. Naming becomes very important since they are semantically meaningful in the prompt. * `substring_quote` performs better than `quote` since it suggests it should be a substring of the original content. * Notice that there are instructions on splitting facts in the docstring which will be used by OpenAI @@ -73,8 +73,8 @@ The `Fact` class represents a single statement in the answer. It contains a `fac The `QuestionAnswer` class represents a question and its answer. It consists of a `question` attribute for the question asked and a list of `Fact` objects in the `answer` attribute. !!! tip "Embedding computation" - While its not thet best idea to get too crazy with adding 100 methods to your class - colocating some computation is oftentimes useful, here we implement the substring search directly with the `Fact` class. + While it's not the best idea to get too crazy with adding 100 methods to your class + collocating some computation is oftentimes useful, here we implement the substring search directly with the `Fact` class. ## Asking AI a Question diff --git a/docs/examples/index.md b/docs/examples/index.md index 03e7226..94382fe 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -22,7 +22,7 @@ In this section, you will find examples demonstrating different aspects of our p - [Exact Citations](exact_citations.md): Find out how to generate exact citations by using smart prompting and regular expressions -- [Automated Dataframe Extraction](autodataframe.md): Discover how to automate dataframe extraction to not only return a table, but possibilty multiple tables. +- [Automated Dataframe Extraction](autodataframe.md): Discover how to automate dataframe extraction to not only return a table, but possibly multiple tables. Feel free to explore these examples to gain a better understanding of various patterns on how creative prompting, description, and structuring of `OpenAISchema` and unlock new capabilities. diff --git a/docs/examples/planning-tasks.md b/docs/examples/planning-tasks.md index 7170ac0..3928e86 100644 --- a/docs/examples/planning-tasks.md +++ b/docs/examples/planning-tasks.md @@ -64,7 +64,7 @@ class QueryPlan(OpenAISchema): ``` !!! warning "Graph Generation" - Notice that this example produces a flat list of items with dependencies that resemble a graph, while pydantic allows for recursive definitions, its much easier and less confusing for the model to generate flat schemas rather than recursive schemas. If y ou want to see a recursive example see [recursive schemas](recursive.md) + Notice that this example produces a flat list of items with dependencies that resemble a graph, while pydantic allows for recursive definitions, it's much easier and less confusing for the model to generate flat schemas rather than recursive schemas. If you want to see a recursive example, see [recursive schemas](recursive.md) ## Planning a Query Plan @@ -110,7 +110,7 @@ plan.dict() ``` !!! warning "No RAG" - While we build the query plan in this example we do not propose a method to actually answer the question. You can implement your own answer function that perhaps makes a retrival and calls openai for retrival augmented generation. That step would also make use of function calls but goes beyond the scope of this example. + While we build the query plan in this example, we do not propose a method to actually answer the question. You can implement your own answer function that perhaps makes a retrival and calls openai for retrival augmented generation. That step would also make use of function calls but goes beyond the scope of this example. ```python {'query_graph': [{'dependancies': [], @@ -138,7 +138,7 @@ In the above code, we define a `query_planner` function that takes a question as In this example, we demonstrated how to use the OpenAI Function Call `ChatCompletion` model to plan and execute a query plan using a question-answering system. We defined the necessary structures using Pydantic, created a query planner function. -If you want to see multiple version of this style of code please visit +If you want to see multiple versions of this style of code, please visit: 1. [query planning example](https://github.com/jxnl/openai_function_call/blob/main/examples/query_planner_execution/query_planner_execution.py) 2. [task planning with topo sort](https://github.com/jxnl/openai_function_call/blob/main/examples/task_planner/task_planner_topological_sort.py) diff --git a/docs/examples/recursive.md b/docs/examples/recursive.md index 9aae43b..7ac5a17 100644 --- a/docs/examples/recursive.md +++ b/docs/examples/recursive.md @@ -7,7 +7,7 @@ In this example, we will demonstrate how define and use a recursive class defini We will use Pydantic to define the necessary data structures representing the directory tree and its nodes. We have two classes, `Node` and `DirectoryTree`, which are used to model individual nodes and the entire directory tree, respectively. !!! warning "Flat is better than nested" - While its easier to model thing as nested returning flat items with depedencies tends to yield better results. for a flat example check out [planning tasks](planning-tasks.md) where we model a query plan as a dag. + While it's easier to model things as nested, returning flat items with dependencies tends to yield better results. For a flat example, check out [planning tasks](planning-tasks.md) where we model a query plan as a dag. ```python import enum diff --git a/docs/examples/search.md b/docs/examples/search.md index 3fc25b4..416ec21 100644 --- a/docs/examples/search.md +++ b/docs/examples/search.md @@ -1,6 +1,6 @@ # Example: Segmenting Search Queries -In this example, we will demonstrate how to leverage the `MultiTask` and `enum.Enum` features of OpenAI Function Call to segment search queries. We will define the necessary structures using Pydantic and demonstrate how segment query into multiple sub queries and execute them in parallel with `asyncio`. +In this example, we will demonstrate how to leverage the `MultiTask` and `enum.Enum` features of OpenAI Function Call to segment search queries. We will define the necessary structures using Pydantic and demonstrate how segment queries into multiple sub queries and execute them in parallel with `asyncio`. !!! tips "Motivation" diff --git a/docs/multitask.md b/docs/multitask.md index 83c4133..27d7757 100644 --- a/docs/multitask.md +++ b/docs/multitask.md @@ -1,6 +1,6 @@ # MultiTask -Defining a task and creating a list of classes is a common enough pattern that we define a helper function `MultiTask` that dynamitcally creates a new schema that has a task attribute defined as a list of the task subclass, it including some prebuild prompts and allows us to avoid writing some extra code. +Defining a task and creating a list of classes is a common enough pattern that we define a helper function `MultiTask` that dynamically creates a new schema that has a task attribute defined as a list of the task subclass, including some prebuilt prompts and allows us to avoid writing some extra code. !!! example "Extending user details" diff --git a/docs/philosophy.md b/docs/philosophy.md index ddbb29c..2e97a3c 100644 --- a/docs/philosophy.md +++ b/docs/philosophy.md @@ -5,15 +5,15 @@ The philosophy behind this library is to provide a **lightweight** and **flexibl By treating LLMs as just another function that returns a typed object, this library aims to remove the perceived complexity and make working with LLMs more approachable. It provides a flexible foundation for incorporating LLMs into your projects while allowing you to leverage the full power of Python to write your own code. 1. Define a Schema `#!python class StructuredData(OpenAISchema):` -2. Excapsulate all your LLM logic into a function `#!python def extract(a) -> StructuredData:` +2. Encapsulate all your LLM logic into a function `#!python def extract(a) -> StructuredData:` 3. Define typed computations against your data with `#!python def compute(data: StructuredData):` Here are some key points to understand: -* **Minimal Installation:** This library is designed to be lightweight. If you prefer not to install the library and its two dependencies, you can simply extract the `function_calls.py` file from the code and incorporate it directly into your project. Own it. Its a single script. +* **Minimal Installation:** This library is designed to be lightweight. If you prefer not to install the library and its two dependencies, you can simply extract the `function_calls.py` file from the code and incorporate it directly into your project. Own it. It is a single script. -* **Code as prompts:** With both the DSL and the structured extraction we don't make a distinction between a code vs a `prompt template`. We believe the prompts that go into a LLM should be constructed and colocated with the code we need to execute. Prompts are created via docstrings, descriptions and functions that construct messages. +* **Code as prompts:** With both the DSL and the structured extraction we don't make a distinction between a code vs a `prompt template`. We believe the prompts that go into a LLM should be constructed and collocated with the code we need to execute. Prompts are created via docstrings, descriptions and functions that construct messages. * **Writing Prompts:** The library also includes an experimental prompt pipeline api. The DSL is a thin wrapper that aims to improve code readability by adding light abstraction around templates as messages. It provides a slightly more syntax for working with LLMs, making the prompting easier to read. diff --git a/docs/writing-prompts.md b/docs/writing-prompts.md index 5a9fb81..3faae51 100644 --- a/docs/writing-prompts.md +++ b/docs/writing-prompts.md @@ -71,7 +71,7 @@ task = ( 2. SystemTask augments the `task` with "You are a *world class* ... *correctly* complete the task: {task}" 3. TaggedMessage wraps content with `` to set clear boundaries for the data you wish to process 4. TipsMessages allows you to pass a list of strings as tips as a result we can potentially create this list dynamically -5. Last step defines the output model you want to use to parse the results if no outpout model is defined we revert to the usual openai completion. +5. Last step defines the output model you want to use to parse the results if no output model is defined we revert to the usual openai completion. The `ChatCompletion` class is responsible for model configuration, while the `|` operator allows us to construct the prompt in a readable manner. We can add `Messages` or `OpenAISchema` components to the prompt pipeline using `|`, and the `ChatCompletion` class will handle the prompt construction for us.