Skip to content

Commit

Permalink
Added symfony/filesystem to dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ddebowczyk committed Nov 1, 2024
1 parent a177250 commit e410357
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 53 deletions.
1 change: 1 addition & 0 deletions bin/instructor
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if ($argc < 2) {
fwrite(STDERR, " Scripts:\n");
fwrite(STDERR, " setup - publish Instructor bundled assets to your project dir\n");
fwrite(STDERR, " hub - view and execute Instructor examples\n");
fwrite(STDERR, "\n");
exit(1);
}

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"phpstan/phpdoc-parser": "^1.29",
"psr/event-dispatcher": "^1.0",
"psr/log": "^3.0",
"symfony/filesystem": "^7.1",
"symfony/intl": "^7.1",
"symfony/property-access": "^6.4 || ^7.0",
"symfony/property-info": "^6.4 || ^7.0",
Expand Down
129 changes: 76 additions & 53 deletions docs/cookbook/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,53 +1,76 @@
## Running cookbooks with Instructor Hub tool

Welcome to Instructor cookbooks. The goal of this section is to provide a set of tutorials and examples to help you get started.



## CLI Usage

Instructor comes with a CLI tool that allows you to view and interact with the tutorials and examples and allows you to find the code snippets you may need to get solution to your problem.



### List Cookbooks

Run `./hub.sh list` you can see all the available tutorials and examples.

```bash
$ ./hub.sh list
```
...or on Windows:

```cli
$ ./hub.bat list
```

### Reading a Cookbook

To read a tutorial, you can run `./hub.sh show {id}` to see the full tutorial in the terminal.

```bash
$ ./hub.sh show {name or id}
```

Currently, there is no way to page through the tutorial - feel free to contribute :)


### Running a Cookbook

To run a tutorial, you run `./hub.sh run {id}` in terminal - it will execute the code and show the output. You need to have your OPENAI_API_KEY set in your environment (.env file in root directory of your copy of instructor-php repo).

```bash
$ ./hub.sh run {name or id}
```


### Running all Cookbooks

This is mostly for testing if cookbooks are executed properly, but you can run `./hub.sh all {id}` to run all the tutorials and examples in the terminal.

```bash
$ ./hub.sh all {name or id}
```

---
title: Instructor Cookbooks
description: Running and viewing cookbooks with Instructor Hub tool
---

## Overview

Welcome to Instructor cookbooks. The goal of this section is to provide a set of tutorials and examples to help you get started.

Instructor comes with a CLI tool that allows you to view and interact with the tutorials and examples and allows you to find the code snippets you may need to get solution to your problem.

<Warning>
Examples are only available with Instructor project cloned locally.
We did not want to include them in the Composer package to keep it lightweight.
</Warning>

### Step 1: Clone Instructor project from Github

To get access to the tutorials and examples, you need to clone the Instructor project from Github:

```bash
$ git clone https://github.com/cognesy/instructor-php.git
```

### Step 2: Create `.env` file

Create a `.env` file in the root directory of your copy of Instructor project and set your LLM API key(s).
You can use the `.env-dist` file as a template.

### Step 3: Check the available tutorials

You can check the available tutorials and examples by running the following command in terminal:

```bash
$ ./bin/instructor hub list
```


## Available CLI Commands

### List Cookbooks

Run `./hub.sh list` you can see all the available tutorials and examples.

```bash
$ ./bin/instructor hub list
```

### Reading a Cookbook

To read a tutorial, you can run `./hub.sh show {id}` to see the full tutorial in the terminal.

```bash
$ ./bin/instructor hub show {id}
```

Currently, there is no way to page through the tutorial - feel free to contribute :)



### Running a Cookbook

To run a tutorial, you run `./hub.sh run {id}` in terminal - it will execute the code and show the output. You need to have your OPENAI_API_KEY set in your environment (.env file in root directory of your copy of instructor-php repo).

```bash
$ ./bin/instructor hub run {id}
```


### Running all Cookbooks

This is mostly for testing if cookbooks are executed properly, but you can run `./hub.sh all {id}` to run all the tutorials and examples in the terminal, starting from the one you specify.

```bash
$ ./bin/instructor hub all {id}
```

0 comments on commit e410357

Please sign in to comment.