elastic / elastic/elasticsearch-chatgpt-php

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

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
29
Forks
10
PR merge metrics
No merged PRs in 30d

Description

`');

$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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by checking the PHP version and dependency requirements, then reproduce the reported example and inspect vendor/openai-php/client/src/ValueObjects/Transporter/Headers.php at line 20. Done means the example runs without the parse error, with the compatible dependency or supported-environment expectation documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, php
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.