From f7757ef8a6392926a7eb85ec696ad6de875072ee Mon Sep 17 00:00:00 2001 From: Andreas Kollegger Date: Wed, 27 Mar 2024 11:39:11 +0000 Subject: [PATCH] initial Semantic Kernel page --- .gitignore | 1 + modules/genai-ecosystem/nav.adoc | 2 + modules/genai-ecosystem/pages/index.adoc | 1 + .../pages/semantic-kernel.adoc | 97 +++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 modules/genai-ecosystem/pages/semantic-kernel.adoc diff --git a/.gitignore b/.gitignore index 109f9eb..f3095ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store build node_modules/ +.vscode/ \ No newline at end of file diff --git a/modules/genai-ecosystem/nav.adoc b/modules/genai-ecosystem/nav.adoc index 435c77b..e6ee3a9 100644 --- a/modules/genai-ecosystem/nav.adoc +++ b/modules/genai-ecosystem/nav.adoc @@ -20,3 +20,5 @@ // **** link:xxx[Documentation] **** xref:haystack.adoc[Haystack] // **** link:xxx[Documentation] +**** xref:semantic-kernel.adoc[Sematic Kernel] +// **** link:xxx[Documentation] diff --git a/modules/genai-ecosystem/pages/index.adoc b/modules/genai-ecosystem/pages/index.adoc index def0ffa..a093262 100644 --- a/modules/genai-ecosystem/pages/index.adoc +++ b/modules/genai-ecosystem/pages/index.adoc @@ -53,6 +53,7 @@ image::https://cdn.graphacademy.neo4j.com/assets/img/courses/banners/llm-fundame * xref:spring-ai.adoc[Spring AI] * xref:langchain4j.adoc[LangChain4j] * xref:haystack.adoc[Haystack] +* xref:semantic-kernel.adoc[Semantic Kernel] == Highlighted Articles diff --git a/modules/genai-ecosystem/pages/semantic-kernel.adoc b/modules/genai-ecosystem/pages/semantic-kernel.adoc new file mode 100644 index 0000000..1bc7b31 --- /dev/null +++ b/modules/genai-ecosystem/pages/semantic-kernel.adoc @@ -0,0 +1,97 @@ += Semantic Kernel Neo4j Integration (preview) +:slug: semantic-kernel +:author: +:category: genai-ecosystem +:tags: semantic-kernel, integration, llm, neo4j, vector index +:neo4j-versions: 5.x +:page-pagination: +:page-product: semantic-kernel + + +An integration of Neo4j graph database with Microsoft's https://github.com/microsoft/semantic-kernel[Semantic Kernel^], +through Microsoft https://microsoft.github.io/kernel-memory/[Kernel Memory^]. Neo4j's vector search index is used for storing document embeddings and dense retrievals. + +The library allows using Neo4j as a DocumentStore, and implements the required Protocol methods. You can start working with the implementation by importing it from neo4_haystack package. + +== Installation + +Hello world example: + +[source,csharp] +---- +# dotnet add package Neo4j.KernelMemory.MemoryStorage +# dotnet add package Neo4j.Driver + +using Microsoft.KernelMemory; +using Neo4j.KernelMemory.MemoryStorage; +using Neo4j.Driver; + +var env = System.Environment.GetEnvironmentVariables(); + +var neo4jConfig = new Neo4jConfig +{ + Uri = env["NEO4J_URI"], + Username = env["NEO4J_USERNAME"], + Password = env["NEO4J_PASSWORD"] +}; + +var kernelMemory = new KernelMemoryBuilder() + .WithOpenAIDefaults(env["OPENAI_API_KEY"]) + .WithNeo4j(neo4jConfig) + .Build(); + +// First, provide some text to the Kernel Memory, which will be indexed and stored in Neo4j +await kernelMemory.ImportTextAsync(""" +The "Hello, World!" program, often attributed to Brian Kernighan's work in the 1970s, serves as the quintessential introduction to programming languages, demonstrating basic syntax with a simple output function. Originating as a test phrase in Bell Laboratories for the B programming language, it has evolved into a universal starter program for beginners in coding, symbolizing the initiation into software development. Its simplicity makes it an ideal tool for education and system testing, illustrating the minimal requirements to execute a program across various computing environments. As a cultural staple in the tech community, "Hello, World!" represents both a rite of passage for new programmers and the universal joy of creating with code. This tradition showcases the evolution of programming languages and the shared beginnings of developers worldwide. +""", + documentId: "HelloWorld"); + +// Now ask a question +var question = "What's Kernel Memory?"; + +var answer = await kernelMemory.AskAsync(question); + +Console.WriteLine($"Question: {question}\n\nAnswer: {answer.Result}"); + +---- + +== Functionality Includes + +* `Neo4jMemory` - implementation of `IMemoryDb`. +* `WithNeo4j` - extension to the KernelMemoryBuilder. +* Integation with Semantic Kernel +* Develop in serverless, deploy as server + +== Relevant Links +[cols="1,4"] +|=== +| icon:user[] Authors | https://github.com/prosto[Sergey Bondarenco^] +| icon:comments[] Community Support | https://community.neo4j.com/[Neo4j Online Community^] +| icon:github[] Repository | https://github.com/neo4j-labs/Neo4j.KernelMemory.MemoryStorage[GitHub] +| icon:github[] Issues | https://github.com/neo4j-labs/Neo4j.KernelMemory.MemoryStorage/issues +| icon:book[] Documentation | https://haystack.deepset.ai/integrations/neo4j-document-store +| icon:book[] Example Notebook | https://github.com/prosto/neo4j-haystack-playground +|=== + + +== Videos & Tutorials + +Online Meetup / Livestream with Sergey Bondarenco and Andreas Kollegger + +Neo4j & Haystack Part 1: Knowledge Graphs for RAG: + +++++ + +++++ + +Neo4j & Haystack Part 2: How the Integration Works: + +++++ + +++++ + +//// +== Highlighted Articles + +// link:https://medium.com/neo4j/....[article^] +////