From 405ba5af5b86fc1e81dec2ec19800b7f3ef05be1 Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Thu, 7 Mar 2024 22:47:18 -0500 Subject: [PATCH] doc: add docs --- README.md | 10 +++++++++- docs/index.md | 17 ++++++++++++++++- instructor/cli/cli.py | 17 +++++++++++++---- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3e40932..4e8eaab 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,15 @@ Including but not limited to: ## Get Started in Moments -Installing Instructor is a breeze. Simply run `pip install instructor` in your terminal and you're on your way to a smoother data handling experience! +``` +pip install -U instructor +``` + +If you ever get stuck, you can always run `instructor docs` to open the documentation in your browser. It even supports searching for specific topics. + +``` +instructor docs [QUERY] +``` ## How Instructor Enhances Your Workflow diff --git a/docs/index.md b/docs/index.md index 54c92df..e84aefb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,7 +12,22 @@ Instructor makes it easy to reliably get structured data like JSON from Large La By leveraging various modes like Function Calling, Tool Calling and even constrained sampling modes like JSON mode, JSON Schema; Instructor stands out for its simplicity, transparency, and user-centric design. We leverage Pydantic to do the heavy lifting, and we've built a simple, easy-to-use API on top of it by helping you manage [validation context](./concepts/reask_validation.md), retries with [Tenacity](./concepts/retrying.md), and streaming [Lists](./concepts/lists.md) and [Partial](./concepts/partial.md) responses. -We also provide library in [Typescript](https://instructor-ai.github.io/instructor-js/), [Elixir](https://github.com/thmsmlr/instructor_ex/) and [PHP](https://github.com/cognesy/instructor-php/). + +We also provide a library in [Typescript](https://instructor-ai.github.io/instructor-js/), [Elixir](https://github.com/thmsmlr/instructor_ex/) and [PHP](https://github.com/cognesy/instructor-php/). + +--- + +## Getting Started + +``` +pip install -U instructor +``` + +If you ever get stuck, you can always run `instructor docs` to open the documentation in your browser. It even supports searching for specific topics. + +``` +instructor docs [QUERY] +``` ## Usage diff --git a/instructor/cli/cli.py b/instructor/cli/cli.py index d6efae9..bbccb04 100644 --- a/instructor/cli/cli.py +++ b/instructor/cli/cli.py @@ -4,12 +4,21 @@ import instructor.cli.files as files import instructor.cli.usage as usage import instructor.cli.hub as hub -app = typer.Typer( - name="instructor-ft", - help="A CLI for fine-tuning OpenAI's models", -) +app = typer.Typer() app.add_typer(jobs.app, name="jobs", help="Monitor and create fine tuning jobs") app.add_typer(files.app, name="files", help="Manage files on OpenAI's servers") app.add_typer(usage.app, name="usage", help="Check OpenAI API usage data") app.add_typer(hub.app, name="hub", help="Interact with the instructor hub") + + +@app.command() +def docs(query: str = typer.Argument(None, help="Search the documentation")): + """ + Open the instructor documentation website. + """ + if query: + typer.launch(f"https://jxnl.github.io/instructor/?q={query}") + else: + typer.launch("https://jxnl.github.io/instructor") +