Hello, I am trying to utilize 'apoc.ml.query' (OpenAI API Access - APOC Extended Documentation)
in my database, however i received this error. I dont know what else to configure. I have a Open AI API key already.
For info, Im using Neo4j 5.16 deployed via Docker
version: '3'
services:
neo4j:
container_name: neo4j5
image: neo4j:5.16-enterprise
user: "1000:1000"
ports:
- 7474:7474
- 7473:7473
- 7687:7687
environment:
NEO4J_ACCEPT_LICENSE_AGREEMENT: "yes"
volumes:
- ./data:/data
- ./logs:/logs
- ./conf:/conf
- ./plugins:/plugins
- ./backups:/backups
- ./licenses:/licenses
- ./ssl:/var/lib/neo4j/certificates
- ./import:/import
Heres what i have done:
- I have configured apoc.conf
apoc.import.file.enabled=true
apoc.export.file.enabled=true
#openai
apoc.ml.openai.key='xxx'
apoc.ml.openai.type='OPENAI'
apoc.ml.openai.url='https://api.openai.com/v1/chat/completions'
I have configured neo4j.conf
dbms.security.procedures.unrestricted=algo.*,apoc.*,bloom.*,gds.*
dbms.security.procedures.allowlist=apoc.*,bloom.*,gds.*
...
- I have allowed https service in my server firewall
sudo firewall-cmd --zone=public --add-service=https --permanent
sudo firewall-cmd --reload
- In Neo4j Browser, i created a database name "library" and for the data, I ran this query:
CREATE
(florentin:Person { name: 'Florentin', age: 16 }),
(adam:Person { name: 'Adam', age: 18 }),
(veselin:Person { name: 'Veselin', age: 20, ratings: [5.0] }),
(hobbit:Book { name: 'The Hobbit', isbn: 1234, numberOfPages: 310, ratings: [1.0, 2.0, 3.0, 4.5] }),
(frankenstein:Book { name: 'Frankenstein', isbn: 4242, price: 19.99 }),
(florentin)-[:KNOWS { since: 2010 }]->(adam),
(florentin)-[:KNOWS { since: 2018 }]->(veselin),
(florentin)-[:READ { numberOfPages: 4 }]->(hobbit),
(florentin)-[:READ { numberOfPages: 42 }]->(hobbit),
(adam)-[:READ { numberOfPages: 30 }]->(hobbit),
(veselin)-[:READ]->(frankenstein)
-
Then, i docker compose up and down.
-
Once Neo4j is up, i run this query in that database. Then, i received a syntax error.
CALL apoc.ml.query("Who does Florentin knows?", {model: "gpt-3.5-turbo"}) YIELD value, query
RETURN value, query limit 10
Neo.ClientError.Statement.SyntaxError
The transaction has been terminated. Retry your operation in a new transaction, and you should see a successful result. The statement contains invalid or unsupported syntax.