• 09-03-2024, 16:35:55
    #1
    Üyeliği durduruldu
    Merhabalar, gemini kullanacağım https://github.com/gemini-api-php/client bu apiyi buldum ve bu apiden istek atınca bölge desteklenmiyor diyor. proxy kullanıp amerika göstericem ama curl ü bulamadım içinde. baska kütüphane öneriniz varsa veya bunda nereyi editleyeceğimi söylerseniz sevinirim
  • 10-03-2024, 00:34:20
    #2
    Developer
    dökümanda guzzle üzerinden de proxy ile kullanabileceğiniz yazıyor:

    use GeminiAPI\Client as GeminiClient;
    use GeminiAPI\Resources\Parts\TextPart;
    use GuzzleHttp\Client as GuzzleClient;
    
    $guzzle = new GuzzleClient([
      'proxy' => 'http://localhost:8125',
    ]);
    
    $client = new GeminiClient('GEMINI_API_KEY', $guzzle);
    $response = $client->geminiPro()->generateContent(
        new TextPart('PHP in less than 100 chars')
    );
    curl için:

    use GeminiAPI\Client;
    use GeminiAPI\Resources\Parts\TextPart;
    use GeminiAPI\Responses\GenerateContentResponse;
    
    $callback = function (GenerateContentResponse $response): void {
        print $response->text();
    };
    
    $ch = curl_init();
    curl_setopt($ch, \CURLOPT_PROXY, 'http://localhost:8125');
    
    $client = new Client('GEMINI_API_KEY');
    $client->withRequestHeaders([
            'User-Agent' => 'My Gemini-backed app'
        ])
        ->geminiPro()
        ->generateContentStream(
            $callback,
            [new TextPart('PHP in less than 100 chars')],
            $ch,
        );