|
84 | 84 | " You need to wait a couple of seconds for the database to start on `http://localhost:7200/`. The Star Wars dataset `starwars-data.trig` is automatically loaded into the `langchain` repository. The local SPARQL endpoint `http://localhost:7200/repositories/langchain` can be used to run queries against. You can also open the GraphDB Workbench from your favourite web browser `http://localhost:7200/sparql` where you can make queries interactively.\n", |
85 | 85 | "* Set up working environment\n", |
86 | 86 | "\n", |
87 | | - "If you use `conda`, create and activate a new conda env (e.g. `conda create -n graph_ontotext_graphdb_qa python=3.9.18`).\n", |
| 87 | + "If you use `conda`, create and activate a new conda environment, e.g.:\n", |
| 88 | + "\n", |
| 89 | + "```\n", |
| 90 | + "conda create -n graph_ontotext_graphdb_qa python=3.12\n", |
| 91 | + "conda activate graph_ontotext_graphdb_qa\n", |
| 92 | + "```\n", |
88 | 93 | "\n", |
89 | 94 | "Install the following libraries:\n", |
90 | 95 | "\n", |
91 | 96 | "```\n", |
92 | | - "pip install jupyter==1.0.0\n", |
93 | | - "pip install openai==1.6.1\n", |
94 | | - "pip install rdflib==7.0.0\n", |
95 | | - "pip install langchain-openai==0.0.2\n", |
96 | | - "pip install langchain>=0.1.5\n", |
| 97 | + "pip install jupyter==1.1.1\n", |
| 98 | + "pip install rdflib==7.1.1\n", |
| 99 | + "pip install langchain-community==0.3.4\n", |
| 100 | + "pip install langchain-openai==0.2.4\n", |
97 | 101 | "```\n", |
98 | 102 | "\n", |
99 | 103 | "Run Jupyter with\n", |
|
255 | 259 | " ChatOpenAI(temperature=0, model_name=\"gpt-4-1106-preview\"),\n", |
256 | 260 | " graph=graph,\n", |
257 | 261 | " verbose=True,\n", |
| 262 | + " allow_dangerous_requests=True,\n", |
258 | 263 | ")" |
259 | 264 | ] |
260 | 265 | }, |
|
332 | 337 | "\u001b[32;1m\u001b[1;3mPREFIX : <https://swapi.co/vocabulary/>\n", |
333 | 338 | "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n", |
334 | 339 | "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n", |
| 340 | + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n", |
335 | 341 | "\n", |
336 | 342 | "SELECT ?climate\n", |
337 | 343 | "WHERE {\n", |
|
383 | 389 | "\u001b[1m> Entering new OntotextGraphDBQAChain chain...\u001b[0m\n", |
384 | 390 | "Generated SPARQL:\n", |
385 | 391 | "\u001b[32;1m\u001b[1;3mPREFIX : <https://swapi.co/vocabulary/>\n", |
386 | | - "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n", |
387 | | - "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n", |
388 | 392 | "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n", |
389 | 393 | "\n", |
390 | | - "SELECT (AVG(?boxOffice) AS ?averageBoxOffice)\n", |
| 394 | + "SELECT (AVG(?boxOffice) AS ?averageBoxOfficeRevenue)\n", |
391 | 395 | "WHERE {\n", |
392 | 396 | " ?film a :Film .\n", |
393 | 397 | " ?film :boxOffice ?boxOfficeValue .\n", |
|
559 | 563 | "name": "python", |
560 | 564 | "nbconvert_exporter": "python", |
561 | 565 | "pygments_lexer": "ipython3", |
562 | | - "version": "3.10.12" |
| 566 | + "version": "3.12.7" |
563 | 567 | } |
564 | 568 | }, |
565 | 569 | "nbformat": 4, |
|
0 commit comments