Efficient models optimized for coding and technical tasks
'deepseek' => [
'api_key' => env('DEEPSEEK_API_KEY', ''),
'url' => env('DEEPSEEK_URL', 'https://api.deepseek.com/v1')
]
use Prism\Prism\Facades\Prism;
use Prism\Prism\Enums\Provider;
$response = Prism::text()
->using(Provider::DeepSeek, 'deepseek-chat')
->withPrompt('Write a PHP function to validate email addresses')
->asText();
echo $response->text;
return Prism::text()
->using('deepseek', 'deepseek-chat')
->withPrompt(request('message'))
->asEventStreamResponse();
use Prism\Prism\Facades\Prism;
use Prism\Prism\Schema\ObjectSchema;
use Prism\Prism\Schema\StringSchema;
use Prism\Prism\Schema\ArraySchema;
$schema = new ObjectSchema(
'code_review',
'Code review analysis',
[
new StringSchema('summary', 'Overall code quality summary'),
new ArraySchema('issues', 'List of issues found',
new StringSchema('issue', 'Individual issue')
),
new ArraySchema('suggestions', 'Improvement suggestions',
new StringSchema('suggestion', 'Individual suggestion')
),
],
['summary', 'issues', 'suggestions']
);
$response = Prism::structured()
->using('deepseek', 'deepseek-chat')
->withSchema($schema)
->withPrompt('Review this PHP code: function add($a, $b) { return $a + $b; }')
->asStructured();
dump($response->structured);
use Prism\Prism\Facades\Prism;
use Prism\Prism\Tool;
$tools = [
Tool::as('search_docs')
->for('Search Laravel documentation')
->withStringParameter('query', 'Search query')
->using(fn (string $query): string => "Documentation results for: {$query}"),
Tool::as('run_code')
->for('Execute PHP code in sandbox')
->withStringParameter('code', 'PHP code to execute')
->using(fn (string $code): string => "Executed: {$code}"),
];
$response = Prism::text()
->using('deepseek', 'deepseek-chat')
->withTools($tools)
->withMaxSteps(3)
->withPrompt('Search for information about Laravel service containers')
->asText();
$response = Prism::text()
->using('deepseek', 'deepseek-chat')
->withPrompt('Generate a Laravel migration for a users table with email verification')
->asText();
$response = Prism::text()
->using('deepseek', 'deepseek-chat')
->withPrompt('Explain this code: ' . $codeSnippet)
->asText();
$response = Prism::text()
->using('deepseek', 'deepseek-chat')
->withPrompt('Debug this PHP error: ' . $errorMessage)
->asText();
$response = Prism::text()
->using('deepseek', 'deepseek-chat')
->withPrompt('Refactor this code to follow SOLID principles: ' . $oldCode)
->asText();
$response = Prism::text()
->using('deepseek', 'deepseek-chat')
->withTemperature(0.2) // More deterministic
->withPrompt('Generate a PHP class for user authentication')
->asText();
$response = Prism::text()
->using('deepseek', 'deepseek-chat')
->withPrompt("
Task: Generate a PHP function
Requirements:
- Function name: calculateTotal
- Parameters: array of numbers
- Returns: sum of all numbers
- Include error handling
- Add PHPDoc comments
")
->asText();