@@ -95,12 +95,12 @@ The embeddings are stored as properties on nodes or relationships with the type
9595====
9696
9797.Create an embedding property for the Godfather
98- [source,cypher,role=test-skip ]
98+ [source,cypher]
9999----
100100MATCH (m:Movie {title:'Godfather, The'})
101101WHERE m.plot IS NOT NULL AND m.title IS NOT NULL
102102WITH m, m.title || ' ' || m.plot AS titleAndPlot // <1>
103- WITH m, genai.vector.encode(titleAndPlot, 'OpenAI', { token: $token }) AS propertyVector // <2>
103+ WITH m, genai.vector.encode(titleAndPlot, 'OpenAI', { token: $openaiToken }) AS propertyVector // <2>
104104CALL db.create.setNodeVectorProperty(m, 'embedding', propertyVector) // <3>
105105RETURN m.embedding AS embedding
106106----
@@ -158,14 +158,14 @@ Each returned row contains the following columns:
158158.Create embeddings from a limited number of properties and store them
159159====
160160
161- [source, cypher, role=test-skip ]
161+ [source, cypher]
162162----
163163MATCH (m:Movie WHERE m.plot IS NOT NULL)
164164WITH m
165165LIMIT 20
166166WITH collect(m) AS moviesList // <1>
167167WITH moviesList, [movie IN moviesList | movie.title || ': ' || movie.plot] AS batch // <2>
168- CALL genai.vector.encodeBatch(batch, 'OpenAI', { token: $token }) YIELD index, vector
168+ CALL genai.vector.encodeBatch(batch, 'OpenAI', { token: $openaiToken }) YIELD index, vector
169169WITH moviesList, index, vector
170170CALL db.create.setNodeVectorProperty(moviesList[index], 'embedding', vector) // <3>
171171----
@@ -177,7 +177,7 @@ CALL db.create.setNodeVectorProperty(moviesList[index], 'embedding', vector) //
177177
178178.Create embeddings from a large number of properties and store them
179179====
180- [source, cypher, role=test-skip ]
180+ [source, cypher]
181181----
182182MATCH (m:Movie WHERE m.plot IS NOT NULL)
183183WITH collect(m) AS moviesList, // <1>
@@ -186,9 +186,9 @@ WITH collect(m) AS moviesList, // <1>
186186UNWIND range(0, total-1, batchSize) AS batchStart // <3>
187187CALL (moviesList, batchStart, batchSize) { // <4>
188188 WITH [movie IN moviesList[batchStart .. batchStart + batchSize] | movie.title || ': ' || movie.plot] AS batch // <5>
189- CALL genai.vector.encodeBatch(batch, 'OpenAI', { token: $token }) YIELD index, vector
189+ CALL genai.vector.encodeBatch(batch, 'OpenAI', { token: $openaiToken }) YIELD index, vector
190190 CALL db.create.setNodeVectorProperty(moviesList[batchStart + index], 'embedding', vector) // <6>
191- } IN CONCURRENT TRANSACTIONS OF 1 ROW <7>
191+ } IN CONCURRENT TRANSACTIONS OF 1 ROW // <7>
192192----
193193
194194<1> xref:functions/aggregating.adoc#functions-collect[Collect] all returned `Movie` nodes into a `LIST<NODE>`.
0 commit comments