Skip to content

Commit 8d808d7

Browse files
committed
Release version 0.14.6
1 parent c9be20f commit 8d808d7

File tree

113 files changed

+826
-460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+826
-460
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Thumbs.db
3434
/.idea/
3535
/.vscode/
3636
.cursorignore
37+
/docs/.idea/
3738

3839
# PHPUnit, Pest, and other test result files
3940
.phpunit.result.cache

composer.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,25 @@
3838
},
3939
"autoload-dev": {
4040
"psr-4": {
41-
"Cognesy\\InstructorHub\\": "packages/hub/src/",
4241
"Cognesy\\Auxiliary\\": "packages/auxiliary/src/",
43-
"Cognesy\\Tell\\": "packages/tell/src/",
42+
"Cognesy\\InstructorHub\\": "packages/hub/src/",
43+
"Cognesy\\Evals\\": "packages/evals/src/",
4444
"Cognesy\\Experimental\\": "packages/experimental/src/",
45-
"Cognesy\\Evals\\": "evals/",
46-
"Examples\\": "examples/",
47-
"Tests\\": "tests/",
45+
"Cognesy\\Tell\\": "packages/tell/src/",
4846
"Cognesy\\Addons\\Tests\\": "packages/addons/tests/",
4947
"Cognesy\\Auxiliary\\Tests\\": "packages/auxiliary/tests/",
5048
"Cognesy\\Experimental\\Tests\\": "packages/experimental/tests/",
49+
"Cognesy\\Evals\\Tests\\": "packages/evals/tests/",
5150
"Cognesy\\Http\\Tests\\": "packages/http-client/tests/",
5251
"Cognesy\\InstructorHub\\Tests\\": "packages/hub/tests/",
5352
"Cognesy\\Instructor\\Tests\\": "packages/instructor/tests/",
5453
"Cognesy\\Polyglot\\Tests\\": "packages/polyglot/tests/",
5554
"Cognesy\\Setup\\Tests\\": "packages/setup/tests/",
5655
"Cognesy\\Tell\\Tests\\": "packages/tell/tests/",
57-
"Cognesy\\Utils\\Tests\\": "packages/utils/tests/"
56+
"Cognesy\\Utils\\Tests\\": "packages/utils/tests/",
57+
"Evals\\": "evals/",
58+
"Examples\\": "examples/",
59+
"Tests\\": "tests/"
5860
},
5961
"files": [
6062
"packages/instructor/tests/Examples/Call/test_functions.php"

docs-build/polyglot/overview.mdx

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,30 @@ The core philosophy behind Polyglot is to create a consistent, provider-agnostic
1414

1515
Polyglot was developed as part of the Instructor for PHP library, which focuses on structured outputs from LLMs, but can also be used as a standalone library for general LLM interactions.
1616

17+
18+
19+
1720
## Key Features
1821

19-
### Unified API
22+
### Unified LLM API
2023

2124
Polyglot's primary feature is its unified API that works across multiple LLM providers:
2225

23-
- Consistent interface for making inference requests
26+
- Consistent interface for making inference or embedding requests
2427
- Common message format across all providers
2528
- Standardized response handling
2629
- Unified error handling
2730

31+
32+
### Framework-Agnostic
33+
34+
Polyglot is designed to work with any PHP framework or even in plain PHP applications. It does not depend on any specific framework, making it easy to integrate into existing projects.
35+
36+
- Compatible with Laravel, Symfony, CodeIgniter, and others
37+
- Can be used in CLI scripts or web applications
38+
- Lightweight and easy to install
39+
40+
2841
### Comprehensive Provider Support
2942

3043
Polyglot supports a wide range of LLM providers, including:
@@ -79,7 +92,23 @@ The library is built with extensibility in mind:
7992
- Event system for request/response monitoring
8093
- Ability to add custom providers
8194

82-
## Supported LLM Providers
95+
96+
97+
## Use Cases
98+
99+
Polyglot is a good choice for a variety of use cases:
100+
101+
- **Applications requiring LLM provider flexibility**: Switch between providers based on cost, performance, or feature needs
102+
- **Multi-environment deployments**: Use different LLM providers in development, staging, and production
103+
- **Redundancy and fallback**: Implement fallback strategies when a provider is unavailable
104+
- **Hybrid approaches**: Combine different providers for different tasks based on their strengths
105+
- **Local + cloud development**: Use local models (via Ollama) for development and cloud providers for production
106+
107+
108+
109+
## Supported Providers
110+
111+
### Inference Providers
83112

84113
Polyglot currently supports the following LLM providers for chat completion:
85114

@@ -102,7 +131,7 @@ Polyglot currently supports the following LLM providers for chat completion:
102131
- **Together**: Together AI hosted models
103132
- **xAI**: xAI's Grok models
104133

105-
## Supported Embeddings Providers
134+
### Embeddings Providers
106135

107136
For embeddings generation, Polyglot supports:
108137

@@ -113,33 +142,3 @@ For embeddings generation, Polyglot supports:
113142
- **Mistral**: Mistral embedding models
114143
- **Ollama**: Self-hosted embedding models
115144
- **OpenAI**: OpenAI embeddings
116-
117-
## Use Cases
118-
119-
Polyglot is ideal for a variety of use cases:
120-
121-
- **Applications requiring LLM provider flexibility**: Switch between providers based on cost, performance, or feature needs
122-
- **Multi-environment deployments**: Use different LLM providers in development, staging, and production
123-
- **Redundancy and fallback**: Implement fallback strategies when a provider is unavailable
124-
- **Hybrid approaches**: Combine different providers for different tasks based on their strengths
125-
- **Local + cloud development**: Use local models (via Ollama) for development and cloud providers for production
126-
127-
## Getting Started
128-
129-
To start using Polyglot, you'll need to:
130-
131-
1. Install the library via Composer
132-
2. Configure your LLM provider credentials
133-
3. Create your first inference request
134-
135-
Basic example:
136-
137-
```php
138-
<?php
139-
use Cognesy\Polyglot\LLM\Inference;
140-
141-
// Simple text generation with default provider
142-
$answer = Inference::text('What is the capital of France?');
143-
144-
echo "Answer: $answer";
145-
```

docs-build/polyglot/quickstart.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ For detailed setup instructions, see [Setup](setup).
1010

1111
## Install Polyglot with Composer
1212

13-
Run following command in your terminal:
13+
To install Polyglot in your project, run following command in your terminal:
1414

1515
```bash
16-
composer require cognesy/instructor-php
16+
composer require cognesy/instructor-polyglot
1717
```
1818

19-
> NOTE: Currently Polyglot is only available as a part of InstructorPHP package.
20-
> In the future it will be available as a standalone package.
19+
> NOTE: Polyglot is already included in Instructor for PHP package, so if you have it installed, you don't need to install Polyglot separately.
2120
2221

2322
## Create and Run Example

docs-build/polyglot/setup.mdx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,31 @@ description: 'Setup of Polyglot in your PHP project'
55

66
This chapter will guide you through the initial steps of setting up and using Polyglot in your PHP project. We'll cover installation and configuration to get you up and running quickly.
77

8+
9+
10+
811
## Installation
912

10-
Polyglot is currently distributed as part of the Instructor PHP package. You can install it using Composer:
13+
You can install it using Composer:
1114

1215
```bash
13-
composer require cognesy/instructor-php
16+
composer require cognesy/instructor-polyglot
1417
```
1518

1619
This will install Polyglot along with its dependencies.
1720

21+
22+
> NOTE: Polyglot is distributed as part of the Instructor PHP package, so if you have it installed, you don't need to install Polyglot separately.
23+
1824
## Requirements
1925

2026
- PHP 8.2 or higher
2127
- Composer
2228
- Valid API keys for at least one supported LLM provider
2329

30+
31+
32+
2433
## Configuration
2534

2635
### Setting Up API Keys
@@ -141,6 +150,8 @@ INSTRUCTOR_CONFIG_PATH=/path/to/your/config
141150
```
142151

143152

153+
154+
144155
## Troubleshooting
145156

146157
### Common Installation Issues
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- (addons) Moved Cognesy\Addons\Evals to a separate package under packages/evals and new
2+
namespace Cognesy\Evals
3+
- (polyglot) Corrected warning on missing 'thinking' key in the non-reasoning responses
4+
- (docs) Minor corrections in docs

docs/release-notes/v0.14.6.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- (addons) Moved Cognesy\Addons\Evals to a separate package under packages/evals and new
2+
namespace Cognesy\Evals
3+
- (polyglot) Corrected warning on missing 'thinking' key in the non-reasoning responses
4+
- (docs) Minor corrections in docs
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
<?php
2-
3-
namespace Cognesy\Evals\ComplexExtraction;
4-
5-
/** Represents a project event */
6-
class ProjectEvent {
7-
/** Title of the event - this should be a short, descriptive title of the event */
8-
public string $title = '';
9-
/** Concise, informative description of the event */
10-
public string $description = '';
11-
/** Type of the event */
12-
public ProjectEventType $type = ProjectEventType::Other;
13-
/** Status of the event */
14-
public ProjectEventStatus $status = ProjectEventStatus::Unknown;
15-
/** Stakeholders involved in the event */
16-
/** @var Stakeholder[] */
17-
public array $stakeholders = [];
18-
/** Date of the event if reported in the text */
19-
public ?string $date = '';
20-
}
1+
<?php
2+
3+
namespace Evals\ComplexExtraction;
4+
5+
/** Represents a project event */
6+
class ProjectEvent {
7+
/** Title of the event - this should be a short, descriptive title of the event */
8+
public string $title = '';
9+
/** Concise, informative description of the event */
10+
public string $description = '';
11+
/** Type of the event */
12+
public ProjectEventType $type = ProjectEventType::Other;
13+
/** Status of the event */
14+
public ProjectEventStatus $status = ProjectEventStatus::Unknown;
15+
/** Stakeholders involved in the event */
16+
/** @var Stakeholder[] */
17+
public array $stakeholders = [];
18+
/** Date of the event if reported in the text */
19+
public ?string $date = '';
20+
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<?php
2-
3-
namespace Cognesy\Evals\ComplexExtraction;
4-
5-
/** Represents status of project event */
6-
enum ProjectEventStatus: string {
7-
case Open = 'open';
8-
case Closed = 'closed';
9-
case Unknown = 'unknown';
10-
}
1+
<?php
2+
3+
namespace Evals\ComplexExtraction;
4+
5+
/** Represents status of project event */
6+
enum ProjectEventStatus: string {
7+
case Open = 'open';
8+
case Closed = 'closed';
9+
case Unknown = 'unknown';
10+
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<?php
2-
3-
namespace Cognesy\Evals\ComplexExtraction;
4-
5-
/** Represents type of project event */
6-
enum ProjectEventType: string {
7-
case Risk = 'risk';
8-
case Issue = 'issue';
9-
case Action = 'action';
10-
case Progress = 'progress';
11-
case Other = 'other';
12-
}
1+
<?php
2+
3+
namespace Evals\ComplexExtraction;
4+
5+
/** Represents type of project event */
6+
enum ProjectEventType: string {
7+
case Risk = 'risk';
8+
case Issue = 'issue';
9+
case Action = 'action';
10+
case Progress = 'progress';
11+
case Other = 'other';
12+
}

0 commit comments

Comments
 (0)