From cb6da53d8c3a3fc87b852c81e36d0acb69fb1fee Mon Sep 17 00:00:00 2001 From: Dan Selman Date: Fri, 31 May 2024 13:52:45 +0100 Subject: [PATCH] feat: sample questions read from model Signed-off-by: Dan Selman --- docs/classes/Conversation.md | 10 ++-- docs/classes/GraphModel.md | 75 +++++++++++++++--------- docs/functions/getOpenAiEmbedding.md | 2 +- docs/type-aliases/Context.md | 2 +- docs/type-aliases/ConversationOptions.md | 2 +- docs/type-aliases/EmbeddingCacheNode.md | 2 +- docs/type-aliases/EmbeddingFunction.md | 2 +- docs/type-aliases/FullTextIndex.md | 2 +- docs/type-aliases/GraphModelOptions.md | 2 +- docs/type-aliases/GraphNodeProperties.md | 2 +- docs/type-aliases/Logger.md | 2 +- docs/type-aliases/OpenAiOptions.md | 2 +- docs/type-aliases/PropertyBag.md | 2 +- docs/type-aliases/SimilarityResult.md | 2 +- docs/type-aliases/ToolOptions.md | 2 +- docs/type-aliases/ToolResponse.md | 2 +- docs/type-aliases/VectorIndex.md | 2 +- docs/variables/ConsoleLogger.md | 2 +- docs/variables/EMBEDDINGS_MAGIC.md | 2 +- src/demo/index.ts | 18 +++--- src/graphmodel.ts | 23 ++++++++ 21 files changed, 104 insertions(+), 56 deletions(-) diff --git a/docs/classes/Conversation.md b/docs/classes/Conversation.md index 7a1fa62..fa294e3 100644 --- a/docs/classes/Conversation.md +++ b/docs/classes/Conversation.md @@ -29,7 +29,7 @@ Creates a new Conversation #### Source -[Conversation.ts:26](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/Conversation.ts#L26) +[Conversation.ts:26](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/Conversation.ts#L26) ## Properties @@ -65,7 +65,7 @@ the final result message #### Source -[Conversation.ts:81](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/Conversation.ts#L81) +[Conversation.ts:81](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/Conversation.ts#L81) *** @@ -91,7 +91,7 @@ the system message for the conversation #### Source -[Conversation.ts:68](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/Conversation.ts#L68) +[Conversation.ts:68](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/Conversation.ts#L68) *** @@ -110,7 +110,7 @@ or undefined if a user message has not been added #### Source -[Conversation.ts:111](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/Conversation.ts#L111) +[Conversation.ts:111](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/Conversation.ts#L111) *** @@ -136,4 +136,4 @@ all the messages #### Source -[Conversation.ts:41](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/Conversation.ts#L41) +[Conversation.ts:41](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/Conversation.ts#L41) diff --git a/docs/classes/GraphModel.md b/docs/classes/GraphModel.md index 69aa16d..c0a4b2b 100644 --- a/docs/classes/GraphModel.md +++ b/docs/classes/GraphModel.md @@ -31,7 +31,7 @@ Creates a new instance of GraphModel #### Source -[graphmodel.ts:26](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L26) +[graphmodel.ts:26](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L26) ## Properties @@ -65,7 +65,7 @@ the query results #### Source -[graphmodel.ts:581](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L581) +[graphmodel.ts:604](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L604) *** @@ -87,7 +87,7 @@ Closes a database context. #### Source -[graphmodel.ts:143](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L143) +[graphmodel.ts:166](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L166) *** @@ -103,7 +103,7 @@ Connects to Neo4J #### Source -[graphmodel.ts:42](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L42) +[graphmodel.ts:42](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L42) *** @@ -119,7 +119,7 @@ Create Neo4J constraints for the model #### Source -[graphmodel.ts:275](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L275) +[graphmodel.ts:298](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L298) *** @@ -135,7 +135,7 @@ Create fulltext indexes for the model #### Source -[graphmodel.ts:345](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L345) +[graphmodel.ts:368](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L368) *** @@ -152,7 +152,7 @@ for the model #### Source -[graphmodel.ts:266](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L266) +[graphmodel.ts:289](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L289) *** @@ -168,7 +168,7 @@ Create vector indexes for the model #### Source -[graphmodel.ts:327](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L327) +[graphmodel.ts:350](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L350) *** @@ -184,7 +184,7 @@ Delete all nodes/edges in the graph #### Source -[graphmodel.ts:363](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L363) +[graphmodel.ts:386](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L386) *** @@ -210,7 +210,7 @@ the result #### Source -[graphmodel.ts:463](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L463) +[graphmodel.ts:486](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L486) *** @@ -226,7 +226,7 @@ Drop all Neo4J indexes for the model. #### Source -[graphmodel.ts:237](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L237) +[graphmodel.ts:260](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L260) *** @@ -252,7 +252,7 @@ the items #### Source -[graphmodel.ts:615](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L615) +[graphmodel.ts:638](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L638) *** @@ -270,7 +270,7 @@ the concerto models as a string #### Source -[graphmodel.ts:562](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L562) +[graphmodel.ts:585](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L585) *** @@ -296,7 +296,7 @@ specified #### Source -[graphmodel.ts:74](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L74) +[graphmodel.ts:74](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L74) *** @@ -312,7 +312,28 @@ Get all the full text indexes for the model #### Source -[graphmodel.ts:310](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L310) +[graphmodel.ts:333](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L333) + +*** + +### getQuestions() + +> **getQuestions**(): `string`[] + +Retrieves an array of questions for the graph nodes in +the model. Questions are specified using the '@questions' +decorator on GraphNodes. + +#### Returns + +`string`[] + +an array of the questions associated with all the +graph nodes + +#### Source + +[graphmodel.ts:96](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L96) *** @@ -336,7 +357,7 @@ an array of OpenAI tool definitions #### Source -[graphmodel.ts:709](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L709) +[graphmodel.ts:732](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L732) *** @@ -352,7 +373,7 @@ Get all the vector indexes for the model #### Source -[graphmodel.ts:292](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L292) +[graphmodel.ts:315](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L315) *** @@ -369,7 +390,7 @@ from the graph and populates the ModelManager #### Source -[graphmodel.ts:126](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L126) +[graphmodel.ts:149](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L149) *** @@ -387,7 +408,7 @@ promise to indicate the operation is complete #### Source -[graphmodel.ts:93](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L93) +[graphmodel.ts:116](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L116) *** @@ -416,7 +437,7 @@ the graph node #### Source -[graphmodel.ts:440](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L440) +[graphmodel.ts:463](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L463) *** @@ -445,7 +466,7 @@ the source node #### Source -[graphmodel.ts:478](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L478) +[graphmodel.ts:501](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L501) *** @@ -470,7 +491,7 @@ a promise to a Context for the database. #### Source -[graphmodel.ts:58](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L58) +[graphmodel.ts:58](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L58) *** @@ -496,7 +517,7 @@ the query results #### Source -[graphmodel.ts:410](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L410) +[graphmodel.ts:433](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L433) *** @@ -515,7 +536,7 @@ returns the concerto model from the graph #### Source -[graphmodel.ts:108](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L108) +[graphmodel.ts:131](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L131) *** @@ -542,7 +563,7 @@ an array of similar nodes, up to the count limit #### Source -[graphmodel.ts:537](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L537) +[graphmodel.ts:560](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L560) *** @@ -567,7 +588,7 @@ Performs a similarity search on nodes with text content #### Source -[graphmodel.ts:379](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L379) +[graphmodel.ts:402](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L402) *** @@ -591,4 +612,4 @@ the Cypher query #### Source -[graphmodel.ts:571](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/graphmodel.ts#L571) +[graphmodel.ts:594](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/graphmodel.ts#L594) diff --git a/docs/functions/getOpenAiEmbedding.md b/docs/functions/getOpenAiEmbedding.md index 53dd6d9..427e821 100644 --- a/docs/functions/getOpenAiEmbedding.md +++ b/docs/functions/getOpenAiEmbedding.md @@ -26,4 +26,4 @@ a promise to an array of numbers ## Source -[functions.ts:12](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/functions.ts#L12) +[functions.ts:12](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/functions.ts#L12) diff --git a/docs/type-aliases/Context.md b/docs/type-aliases/Context.md index 8a8bb3b..a9b2552 100644 --- a/docs/type-aliases/Context.md +++ b/docs/type-aliases/Context.md @@ -18,4 +18,4 @@ Runtime context ## Source -[types.ts:115](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L115) +[types.ts:115](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L115) diff --git a/docs/type-aliases/ConversationOptions.md b/docs/type-aliases/ConversationOptions.md index 008c2d6..a8eea67 100644 --- a/docs/type-aliases/ConversationOptions.md +++ b/docs/type-aliases/ConversationOptions.md @@ -40,4 +40,4 @@ Which tools to register on the conversation ## Source -[types.ts:79](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L79) +[types.ts:79](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L79) diff --git a/docs/type-aliases/EmbeddingCacheNode.md b/docs/type-aliases/EmbeddingCacheNode.md index 1e4e66b..58ca02b 100644 --- a/docs/type-aliases/EmbeddingCacheNode.md +++ b/docs/type-aliases/EmbeddingCacheNode.md @@ -26,4 +26,4 @@ A Node type that is used to cache vector embeddings ## Source -[types.ts:122](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L122) +[types.ts:122](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L122) diff --git a/docs/type-aliases/EmbeddingFunction.md b/docs/type-aliases/EmbeddingFunction.md index 9728926..6d3f76a 100644 --- a/docs/type-aliases/EmbeddingFunction.md +++ b/docs/type-aliases/EmbeddingFunction.md @@ -24,4 +24,4 @@ vector embeddings for text ## Source -[types.ts:151](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L151) +[types.ts:151](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L151) diff --git a/docs/type-aliases/FullTextIndex.md b/docs/type-aliases/FullTextIndex.md index b0a97de..375f2ce 100644 --- a/docs/type-aliases/FullTextIndex.md +++ b/docs/type-aliases/FullTextIndex.md @@ -26,4 +26,4 @@ Definition of a full text index over some properties ## Source -[types.ts:106](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L106) +[types.ts:106](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L106) diff --git a/docs/type-aliases/GraphModelOptions.md b/docs/type-aliases/GraphModelOptions.md index b93bdb6..36d39b1 100644 --- a/docs/type-aliases/GraphModelOptions.md +++ b/docs/type-aliases/GraphModelOptions.md @@ -44,4 +44,4 @@ Options to configure Open AI ## Source -[types.ts:172](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L172) +[types.ts:172](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L172) diff --git a/docs/type-aliases/GraphNodeProperties.md b/docs/type-aliases/GraphNodeProperties.md index 30c255e..87f0037 100644 --- a/docs/type-aliases/GraphNodeProperties.md +++ b/docs/type-aliases/GraphNodeProperties.md @@ -12,4 +12,4 @@ The properties allowed on graph nodes ## Source -[types.ts:145](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L145) +[types.ts:145](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L145) diff --git a/docs/type-aliases/Logger.md b/docs/type-aliases/Logger.md index c081002..e0f49b0 100644 --- a/docs/type-aliases/Logger.md +++ b/docs/type-aliases/Logger.md @@ -89,4 +89,4 @@ Function signature for a logger ## Source -[types.ts:156](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L156) +[types.ts:156](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L156) diff --git a/docs/type-aliases/OpenAiOptions.md b/docs/type-aliases/OpenAiOptions.md index 700ae31..7b2bc4c 100644 --- a/docs/type-aliases/OpenAiOptions.md +++ b/docs/type-aliases/OpenAiOptions.md @@ -44,4 +44,4 @@ Tool choice ## Source -[types.ts:49](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L49) +[types.ts:49](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L49) diff --git a/docs/type-aliases/PropertyBag.md b/docs/type-aliases/PropertyBag.md index 3007635..ffec1d8 100644 --- a/docs/type-aliases/PropertyBag.md +++ b/docs/type-aliases/PropertyBag.md @@ -12,4 +12,4 @@ A untyped set of properties ## Source -[types.ts:140](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L140) +[types.ts:140](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L140) diff --git a/docs/type-aliases/SimilarityResult.md b/docs/type-aliases/SimilarityResult.md index 2819bc4..871dcf6 100644 --- a/docs/type-aliases/SimilarityResult.md +++ b/docs/type-aliases/SimilarityResult.md @@ -26,4 +26,4 @@ Result of a vector similarity search ## Source -[types.ts:131](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L131) +[types.ts:131](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L131) diff --git a/docs/type-aliases/ToolOptions.md b/docs/type-aliases/ToolOptions.md index a3fa38b..1c18857 100644 --- a/docs/type-aliases/ToolOptions.md +++ b/docs/type-aliases/ToolOptions.md @@ -38,4 +38,4 @@ Creates tools to retrieve nodes via similarity search of vector indexed properti ## Source -[types.ts:27](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L27) +[types.ts:27](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L27) diff --git a/docs/type-aliases/ToolResponse.md b/docs/type-aliases/ToolResponse.md index a172007..2646b59 100644 --- a/docs/type-aliases/ToolResponse.md +++ b/docs/type-aliases/ToolResponse.md @@ -26,4 +26,4 @@ The string that we should compute embedding vectors for ## Source -[types.ts:188](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L188) +[types.ts:188](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L188) diff --git a/docs/type-aliases/VectorIndex.md b/docs/type-aliases/VectorIndex.md index 07c7fe7..1139742 100644 --- a/docs/type-aliases/VectorIndex.md +++ b/docs/type-aliases/VectorIndex.md @@ -34,4 +34,4 @@ Definition of a vector (embeddings) index ## Source -[types.ts:16](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L16) +[types.ts:16](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L16) diff --git a/docs/variables/ConsoleLogger.md b/docs/variables/ConsoleLogger.md index 703ea4e..09bc830 100644 --- a/docs/variables/ConsoleLogger.md +++ b/docs/variables/ConsoleLogger.md @@ -10,4 +10,4 @@ ## Source -[ConsoleLogger.ts:10](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/ConsoleLogger.ts#L10) +[ConsoleLogger.ts:10](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/ConsoleLogger.ts#L10) diff --git a/docs/variables/EMBEDDINGS_MAGIC.md b/docs/variables/EMBEDDINGS_MAGIC.md index 534d891..119b95b 100644 --- a/docs/variables/EMBEDDINGS_MAGIC.md +++ b/docs/variables/EMBEDDINGS_MAGIC.md @@ -14,4 +14,4 @@ that include semantic embeddings ## Source -[types.ts:11](https://github.com/accordproject/lab-concerto-graph/blob/bea41ec87924201b9fbf2eb7e09102b1acce5799/src/types.ts#L11) +[types.ts:11](https://github.com/accordproject/lab-concerto-graph/blob/bb2157507ab9fc0933aed80f61ecfe646c993a37/src/types.ts#L11) diff --git a/src/demo/index.ts b/src/demo/index.ts index 7171d66..061f1e4 100644 --- a/src/demo/index.ts +++ b/src/demo/index.ts @@ -38,6 +38,7 @@ concept Person extends GraphNode { --> Movie[] directed optional } +@questions("Which actor is related to Fear and Loathing in Las Vegas?") concept Actor extends Person { } @@ -54,6 +55,7 @@ concept User extends Person { concept Genre extends GraphNode { } +@questions("How many movies do we have?") concept Movie extends GraphNode { o Double[] embedding optional @vector_index("embedding", 1536, "COSINE") @@ -192,12 +194,14 @@ async function run() { }); let result = await convo.appendUserMessage('Tell me a joke about actors'); logger.success(result); - result = await convo.appendUserMessage('Which actor is related to Fear and Loathing in Las Vegas?'); - logger.success(result); - result = await convo.appendUserMessage('Which director directed that movie?'); - logger.success(result); - result = await convo.appendUserMessage('How many movies do we have?'); - logger.success(result); + result = await convo.appendUserMessage('Which director directed Fear and Loathing in Las Vegas?'); + logger.success(result); + const questions = graphModel.getQuestions(); + for(let n=0; n < questions.length; n++) { + const q = questions[n]; + result = await convo.appendUserMessage(q); + logger.success(result); + } } { @@ -211,7 +215,7 @@ async function run() { maxContextSize: 64000, logger }); - const messages = await convo.runMessages([convo.getSystemMessage()], 'Which director is related to Brazil?'); + const messages = await convo.runMessages([convo.getSystemMessage()], 'Which director is related to the movie Brazil?'); logger.success('messages', messages); } diff --git a/src/graphmodel.ts b/src/graphmodel.ts index 0c87437..354567a 100644 --- a/src/graphmodel.ts +++ b/src/graphmodel.ts @@ -86,6 +86,29 @@ export class GraphModel { return undefined; } + /** + * Retrieves an array of questions for the graph nodes in + * the model. Questions are specified using the '@questions' + * decorator on GraphNodes. + * @returns an array of the questions associated with all the + * graph nodes + */ + getQuestions() : Array { + const results:Array = []; + const decls = this.getGraphNodeDeclarations(); + for(let n=0; n < decls.length; n++) { + const decl = decls[n]; + const questions = decl.getDecorator('questions'); + if(questions) { + const args = questions.getArguments(); + args.forEach( arg => { + results.push(arg.toString()) + }) + } + } + return results; + } + /** * Stores the Concerto Models in the graph * @returns promise to indicate the operation is complete