PHP code example of prism-orm / embedding-openai
1. Go to this page and download the library: Download prism-orm/embedding-openai library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
prism-orm / embedding-openai example snippets
use Prism\Embedding\OpenAi\OpenAiCompatibleProvider;
use Symfony\Component\HttpClient\HttpClient;
$provider = new OpenAiCompatibleProvider(
HttpClient::create(),
baseUrl: 'http://ollama:11434/v1',
model: 'nomic-embed-text:v1.5',
dimensions: 768,
apiKey: null, // 'sk-…' for OpenAI or Mistral
batchSize: 64, // texts per request
);