Skip to content

Parse error: syntax error, unexpected token "array", expecting variable in /var/www/html/elkchatgpt/vendor/openai-php/client/src/ValueObjects/Transporter/Headers.php on line 20 #2

@irianvillalba

Description

@irianvillalba

`<?php

ini_set('display_errors',1);
ini_set('display_startup_erros',1);
error_reporting(E_ALL);
/**

$openAI = OpenAI::client('');

$elasticsearch = ClientBuilder::create()
->setHosts(["http://10.20.132.17:9200"])
->setApiKey("")
->build();

$chatGPT = new ChatGPT($elasticsearch, $openAI);

$result = $chatGPT->search('stocks', 'Return the first 10 documents of 2017');
//$result = $chatGPT->search('stocks', 'Return the first 30 names of all the different stock names');
//$result = $chatGPT->search('stocks', 'Return the max value of the field "high" for each stock in 2015');
//$result = $chatGPT->search('stocks', 'Return the average value of the field "high" for each stock in 2015');
//$result = $chatGPT->search('stocks', 'Return the max value of the field "high" for all the documents with name MON in 2014');
//$result = $chatGPT->search('stocks', 'Return the documents that have the difference between close and open fields > 20');

print_r($result->asArray());
printf("--- Last query:\n%s\n", $chatGPT->getLastQuery());

?>`

I just added the generated API keys to the code above and when running it gives me the following error:

Parse error: syntax error, unexpected token "array", expecting variable in /var/www/html/elkchatgpt/vendor/openai-php/client/src/ValueObjects/Transporter/Headers.php on line 20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions