small fixes to tutorials (#205)

This commit is contained in:
Francisco Ingham
2023-11-20 11:10:02 -08:00
committed by GitHub
parent 4e4cc52083
commit 5964df3689
3 changed files with 15 additions and 22 deletions
+5 -5
View File
@@ -967,15 +967,15 @@
"3) Key concepts and their relationships from a research paper.\n",
"4) Entities and their relationships from a news article.\n",
"\n",
"As an excercise, try to implement one of the above examples.\n",
"As an exercise, try to implement one of the above examples.\n",
"\n",
"All of them will follow an idea of iteratively extracting more and more information and accumulating it some state."
"All of them will follow an idea of iteratively extracting more and more information and accumulating it into some state."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -989,9 +989,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
+6 -5
View File
@@ -15,9 +15,9 @@
"source": [
"Instead of framing \"self-critique\" or \"self-reflection\" in AI as new concepts, we can view them as validation errors with clear error messages that the systen can use to self correct.\n",
"\n",
"Pydantic offers an customizable and expressive validation framework for Python. Instructor leverages Pydantic's validation framework to provide a uniform developer experience for both code-based and LLM-based validation, as well as a reasking mechanism for correcting LLM outputs based on validation errors. To learn more check out the Pydantic docs on validators.\n",
"Pydantic offers an customizable and expressive validation framework for Python. Instructor leverages Pydantic's validation framework to provide a uniform developer experience for both code-based and LLM-based validation, as well as a reasking mechanism for correcting LLM outputs based on validation errors. To learn more check out the Pydantic [docs](https://docs.pydantic.dev/latest/) on validators.\n",
"\n",
"Note: For the majourity of this notebook we won't be calling openai, just using validators to see how we can control the validation of the objects."
"Note: For the majority of this notebook we won't be calling openai, just using validators to see how we can control the validation of the objects."
]
},
{
@@ -686,7 +686,7 @@
"source": [
"Integrating these validation examples with the OpenAI API is streamlined using `instructor`. After patching the OpenAI client with `instructor`, you simply need to specify a `response_model` for your requests. This setup ensures that all the validation processes occur automatically.\n",
"\n",
"Additionally, you can set a maximum number of retries. When calling the OpenAI client, the system can re-attempt to generate a correct answer. It does this by resending the original query along with feedback on why the previous response was rejected, guiding the LLM towards a more accurate answer in subsequent attempts."
"To enable reasking you can set a maximum number of retries. When calling the OpenAI client, the system can re-attempt to generate a correct answer. It does this by resending the original query along with feedback on why the previous response was rejected, guiding the LLM towards a more accurate answer in subsequent attempts."
]
},
{
@@ -736,6 +736,7 @@
{
"cell_type": "code",
"execution_count": 80,
"id": "0328bbc5",
"metadata": {},
"outputs": [
{
@@ -808,7 +809,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -822,7 +823,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.10.12"
}
},
"nbformat": 4,
+4 -12
View File
@@ -672,14 +672,6 @@
"This gives us the final definition of our `RewrittenSummary` class as seen below"
]
},
{
"cell_type": "markdown",
"id": "10645bf5-ad66-4fd8-9340-3f9cf208966d",
"metadata": {},
"source": [
"This gives us the final definition of our `RewrittenSummary` class as seen below"
]
},
{
"cell_type": "code",
"execution_count": 17,
@@ -954,7 +946,7 @@
"For those looking to delve deeper, here are some to-do lists to explore.\n",
"\n",
"- **Validate Increasing Entity Density**: `Pydantic` exposes a more complex validator that can take in an arbitrary python dictionary. Use the validation context to check the entity density of the previous summary and the new summary to validate that our model has generated a more entity-dense rewrite\n",
"- **Fine-Tuning** : `Instructor` comes with a simple to use interface to help you fine-tune other OpenAI models for your needs. This can be accomplished by capturing the outputs of LLMs using the `Instructions` module to generate training data for fine-tuning.\n",
"- **Fine-Tuning** : `Instructor` comes with a simple to use interface to help you fine-tune other OpenAI models for your needs. This can be accomplished by capturing the outputs of LLMs using the `Instructions` module to generate training data for fine-tuning. In this specific case, finetuning a model to generate dense summaries could decrease latency and cost significantly by replacing the iterative LLM calls that we make .\n",
"\n",
"By accomplishing these tasks, you'll gain practical experience in tuning your models to suit your specific tasks as well as build in more complex validation processes when working with LLMs to ensure more reliable, accurate and consistent outputs."
]
@@ -962,9 +954,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "instructor-env",
"display_name": "pampa-labs",
"language": "python",
"name": "instructor-env"
"name": "pampa-labs"
},
"language_info": {
"codemirror_mode": {
@@ -976,7 +968,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.10.12"
}
},
"nbformat": 4,