Skip to content

Commit

Permalink
docs: how to inject api keys
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienbrault committed Apr 22, 2024
1 parent 6369a81 commit a147afe
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Instructrice

A PHP library to make structured data extraction as easy and accessible as possible.
Structured Data Extraction in PHP.

Features and design choices:
- Flexible JSON-Schema options
Expand Down Expand Up @@ -93,6 +93,26 @@ https://github.com/adrienbrault/instructrice/assets/611271/da69281d-ac56-4135-b2

You can find the list of supported models within each ProviderModel.

You can specify which provider to use with the `llm` argument:
```php
use AdrienBrault\Instructrice\InstructriceFactory;
use AdrienBrault\Instructrice\LLM\ProviderModel\OpenAi;

InstructriceFactory::create(
llm: OpenAi::GPT_4T, // will use environment variable
);
```

If you want to inject the API key directly, all `ProviderModel` have a `createConfig` method:
```php
use AdrienBrault\Instructrice\InstructriceFactory;
use AdrienBrault\Instructrice\LLM\ProviderModel\OpenAi;

InstructriceFactory::create(
llm: OpenAi::GPT_4T->createConfig($myOpenAiApiKey),
);
```

## Supported models

Legend:
Expand Down

0 comments on commit a147afe

Please sign in to comment.