Skip to content

Commit

Permalink
Update modes.md (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnl authored Jan 30, 2024
1 parent d62edd1 commit 89ae3a9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/concepts/modes.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Modes
# Patching Modes

Instructor enhances client functionality with three new keywords for backwards compatibility. This allows use of the enhanced client as usual, with structured output benefits.

- `response_model`: Defines the response type for `chat.completions.create`.
- `max_retries`: Determines retry attempts for failed `chat.completions.create` validations.
- `validation_context`: Provides extra context to the validation process.

There are three methods for structured output:
## What's a `mode`?

1. **Function Calling**: The primary method. Use this for stability and testing.
2. **Tool Calling**: Useful in specific scenarios; lacks the reasking feature of OpenAI's tool calling API.
3. **JSON Mode**: Offers closer adherence to JSON but with more potential validation errors. Suitable for specific non-function calling clients.
There are many ways of extracting structured data from LLMs. Each provider or model may have a limited subset of these capabilities. The Instructor patch allows us to easily switch between any of these modes. The recommendation is to always use tool calling unless you are a provider. However, not all open source models currently support tool calling. In such cases, we can use alternatives like JSON or MD_JSON.

1. **Function Calling**: Users open AI's function calling method. This method will soon be deprecated in favor of tool calling.
2. **Tool Calling**: Tool calling supports multiple parallel tool calls, but for the sake of using the instructor and simplicity, we limit you to one response model.
3. **JSON Mode**: Offers closer adherence to JSON but with the potential for more validation errors. This mode is suitable for specific non-function calling clients.

## Function Calling

Expand Down

0 comments on commit 89ae3a9

Please sign in to comment.