Road to NODES 2026 — Crie sua primeira camada de conhecimento
Autoria: Neo4j · Assistir no YouTube
Vídeo de autoria do canal indicado, não da IANIA; todos os direitos pertencem ao criador. Transcrição, resumo e tradução gerados automaticamente; o conteúdo no idioma original é preservado na versão em idioma original.
Idioma original: inglês
Vídeo original: Road to NODES 2026 - Build Your First Knowledge Layer · Canal: Neo4j · 2:01:25 · Assistir no YouTube
Tópicos: Agentes de IA, Dados, bancos de dados e embeddings, RAG, busca e recuperação de informação
Neste workshop, a equipe da Neo4j demonstra como criar uma camada de conhecimento básica que conecta dados estruturados de um data warehouse a documentos técnicos. O exemplo usa dados simulados de uma rede de oficinas e combina uma camada semântica, navegação hierárquica de documentos e agrupamento de temas com Graph Data Science. Os participantes também veem como usar Claude Code, o Neo4j CLI e skills para consultar o grafo e responder a perguntas com evidências. Ao final, são discutidas adaptações para outros setores, atualizações de documentos e controle de versões.
Pontos-chave
Seção intitulada “Pontos-chave”- Uma camada de conhecimento fica entre os agentes e os dados de origem e ajuda a fornecer contexto, governança e explicabilidade.
- O exemplo conecta tabelas de um data warehouse a documentos PDF, como manuais, boletins de serviço e avisos de recall.
- A camada semântica mapeia tabelas, colunas e relações do warehouse no Neo4j, sem copiar os dados de origem.
- Uma estrutura hierárquica de biblioteca, documentos e seções permite navegar pelos documentos e seguir links entre eles, além de usar busca textual.
- O algoritmo Leiden, via Graph Data Science, agrupa documentos relacionados para revelar temas recorrentes.
- O Neo4j CLI e as skills ajudam agentes a escrever Cypher e executar tarefas com o grafo.
- A busca zero-copy pode melhorar a compreensão semântica do agente, mas não oferece o mesmo desempenho de consultas multi-hop que armazenar os dados no grafo.
- A estrutura apresentada pode servir de ponto de partida para outros setores, desde que os dados e documentos sejam adaptados ao modelo.
- Para manter o grafo atualizado, é possível recarregar documentos ou atualizar partes da hierarquia; revisões podem ser representadas no modelo de dados.
Capítulos
Seção intitulada “Capítulos”| Início | Capítulo | Resumo |
|---|---|---|
| 00:00 | Apresentação do workshop e do caso de uso | O apresentador introduz os materiais, as credenciais e o exemplo de uma rede de oficinas com dados estruturados e documentos técnicos. |
| 08:06 | Grafos e a camada de conhecimento | São apresentados nós, relações e propriedades, além do papel da camada de conhecimento entre os agentes e os dados de origem. |
| 14:27 | Configuração do ambiente | O apresentador orienta a configuração do GitHub Codespaces, das credenciais, do sandbox do Neo4j e do Claude Code. |
| 26:29 | Contexto e camada semântica para dados estruturados | A sessão explica como pensar no contexto necessário ao modelo e como mapear o esquema do warehouse para facilitar consultas SQL. |
| 31:15 | Mapeamento do warehouse com Neocarta | O workshop usa Neocarta para representar tabelas, colunas e relações do Databricks no Neo4j e testar consultas pelo MCP. |
| 43:47 | Consultas, escala e abordagem zero-copy | São demonstradas consultas ao esquema e discutidas escala, desempenho multi-hop e as vantagens e limitações de não copiar os dados. |
| 53:39 | Estrutura e navegação de documentos | Manuais, boletins e recalls são organizados como uma hierarquia navegável de bibliotecas, documentos e seções conectadas. |
| 1:02:19 | Neo4j CLI, skills e busca textual | O apresentador mostra como usar skills para gerar consultas Cypher, percorrer a estrutura dos documentos e fazer busca textual. |
| 1:15:05 | Quando extrair conceitos de domínio | A sessão explica por que começar com a estrutura dos documentos pode bastar e quando vale a pena extrair entidades para conectar grafos. |
| 1:21:28 | Descoberta de temas com Graph Data Science | O algoritmo Leiden agrupa documentos relacionados e ajuda a revelar temas, como falhas em componentes automotivos. |
| 1:36:02 | Adaptação do método a outros setores | São discutidas a reutilização do modelo em outros domínios e as possibilidades de integrar dados expostos por APIs. |
| 1:40:25 | Neo4j CLI e skills para agentes | O apresentador mostra como a CLI permite executar Cypher, consultar esquemas e orientar agentes com skills atualizadas. |
| 1:47:21 | Perguntas combinando documentos e warehouse | O agente combina buscas nos documentos e consultas ao warehouse para investigar reparos, divergências e temas recorrentes. |
| 1:56:02 | Atualização, versões e encerramento | A equipe explica como atualizar o grafo documental, representar revisões e continuar o workshop com credenciais próprias ou BigQuery. |
Citações
Seção intitulada “Citações”O problema é como combinar esses dados e navegar por eles de forma razoável. — 05:18
A camada de conhecimento pode guardar informações úteis e ajudar seus modelos de IA a serem mais precisos. — 10:11
Que formato de dados preciso fornecer ao modelo de IA? — 30:09
Queremos dar ao nosso agente um sumário que ele possa percorrer. — 54:42
Esse padrão funciona com qualquer warehouse e, em teoria, com qualquer conjunto de documentos em armazenamento na nuvem. — 1:55:28
Conceitos e entidades
Seção intitulada “Conceitos e entidades”- Neo4j (empresa): Empresa e plataforma de banco de dados de grafos usada no workshop para representar e consultar a camada de conhecimento.
- Graph Academy (ferramenta): Plataforma de cursos da Neo4j que hospeda o workshop prático.
- Databricks (ferramenta): Data warehouse usado no exemplo para armazenar os dados estruturados da rede de oficinas.
- Claude Code (ferramenta): Ferramenta usada no workshop para interagir com o agente e executar tarefas de desenvolvimento.
- Neocarta (ferramenta): Projeto de laboratório que mapeia o esquema de um warehouse em um grafo semântico no Neo4j.
- Neo4j CLI (ferramenta): Interface de linha de comando apresentada para executar Cypher, consultar esquemas e instalar skills do Neo4j.
- Graph Data Science (ferramenta): Biblioteca usada para projetar o grafo e aplicar o algoritmo Leiden na identificação de comunidades de documentos.
- Camada de conhecimento (conceito): Camada entre os agentes ou usuários e os dados de origem que reúne informações semânticas, regras e conhecimento útil para a IA.
- Camada semântica (conceito): Representação do esquema e das relações dos dados que ajuda o agente a interpretar a terminologia de negócio e formular consultas SQL.
- Modelo de grafo de propriedades (conceito): Modelo de dados que representa entidades como nós, associações como relações e atributos como propriedades.
- Busca zero-copy (conceito): Abordagem em que o Neo4j armazena o mapeamento semântico dos dados, enquanto os dados permanecem no warehouse de origem.
- Leiden (conceito): Algoritmo de detecção de comunidades usado para agrupar documentos conectados e identificar temas recorrentes.
- Cypher (conceito): Linguagem de consulta do Neo4j usada para encontrar padrões e percorrer relações no grafo.
- Neo4j Aura (ferramenta): Oferta em nuvem do Neo4j mencionada como alternativa ao sandbox do workshop.
Tradução completa (pt-BR)
Seção intitulada “Tradução completa (pt-BR)”00:00 Vamos lá. Podemos criar camadas de conhecimento, mas às vezes ainda temos dificuldade para compartilhar a tela. Então, há basicamente dois links que serão importantes para vocês, e espero que sejam publicados no chat daqui a pouco. Se não forem, Alex ou Ryan, por favor, me ajudem e coloquem os links lá. Há o curso do workshop propriamente dito. Ao abri-lo, vocês verão um workshop da Graph Academy. Acessem e façam login, caso ainda não façam parte da Graph Academy, e inscrevam-se no
00:32 workshop; as instruções estão lá. Vocês podem até fazer tudo sem a gente falar. Podem fazer por conta própria. Uma coisa de que também vão precisar é um arquivo de credenciais. Nesse link, haverá uma chave da Anthropic e uma chave da Databricks, que usaremos para nosso data warehouse. Agora, quero dizer que estamos fornecendo uma chave da Anthropic para todos usarem. Somos todos adultos. Todos podemos usar as chaves com responsabilidade. Vou ficar de olho. Então, se alguém… usem o bom
01:05 senso. Não peguem a chave para sair usando e fazer outras coisas fora do workshop. Vamos desativá-la quando o workshop terminar. Se alguém estiver abusando da chave, infelizmente vou ter que desativá-la e, então, ela será desativada para todos. Se vocês tiverem uma chave própria que queiram usar, se quiserem usar o Cloud Code com sua própria chave da Anthropic ou apenas com sua própria assinatura, também podem fazer isso sem problema. Isso não fará diferença para o workshop. Só queremos garantir que todos tenham acesso à Anthropic e ao Claude, caso ainda não tenham, porque vamos depender do Claude Code.
01:37 Então, antes de começarmos, vou passar por alguns slides bem rapidamente, só para alinharmos as ideias sobre o que estamos fazendo aqui. Falamos bastante sobre camadas de conhecimento e Neo4j. Eu queria criar algo que mostrasse, de forma concreta, como construir algo assim. Uma versão simples, não aquela versão grande e complicada, com seis a oito camadas, que talvez acabem criando em uma grande empresa, mas algo como uma camada de conhecimento básica, nível 101. Temos uma ótima equipe que preparou um workshop para vocês. Ela inclui Ryan, que está na chamada, arquiteto de soluções sênior, que ajudou especialmente com os conectores para a Databricks e com alguns aspectos do backend. Ben Squire, nosso desenvolvedor e um de nossos defensores de desenvolvedores, ajudou a testar o curso e a percorrê-lo, além de pensar em como torná-lo uma experiência de aprendizagem melhor.
02:10 E eu, que sou pesquisador de IA aqui na Neo4j. O que vamos fazer é abordar um caso de uso empresarial. Pensem em uma rede de oficinas mecânicas. Nos Estados Unidos, temos grandes grupos que fazem troca de óleo, outros diagnósticos e coisas do tipo, e onde você pode levar seu carro. Imaginem que eles tenham muitos documentos, como boletins sobre
02:40 carros, recalls e coisas do tipo, além de transações armazenadas em um banco de dados operacional e, mais tarde, em um data warehouse. Por exemplo, todos os reparos anteriores e diferentes transações feitas com os clientes, entre outras coisas. Há vários tipos de perfis que podem se interessar por diferentes problemas relacionados a esse negócio. Por exemplo, um técnico pode precisar encontrar uma solução específica. Também pode haver pessoas mais experientes na organização se perguntando como implementar IA para que todos possam usá-la e como fazer perguntas mais analíticas para relatórios. Por exemplo: o que está faltando? Quais são nossos pontos cegos? Esse tipo de coisa. E depois há os engenheiros de IA, que talvez sejam muitos de nós nesta chamada e que realmente precisam criar um copiloto para tudo isso, certo? Neste caso, os dados com que vamos trabalhar são todos simulados, mas vêm em duas partes,
03:11 uma estruturada e outra não estruturada. Como eu dizia antes, temos uma lakehouse, e a parte estruturada contém tabelas sobre as ordens de serviço: veículos, diferentes códigos desses veículos, procedimentos, ordens de serviço e as peças utilizadas. Há relações de chave primária e estrangeira implícitas, acredito, na Databricks e em alguns desses outros data warehouses, como o BigQuery, por exemplo. E depois vocês terão
03:41 os documentos, que neste caso estamos representando com PDFs. Serão manuais, boletins de serviço e avisos de recall. Basicamente, informações sobre segurança ou problemas que um fabricante identifica em determinado veículo, algo importante para quem vai fabricar ou consertar veículos. Chegamos a um ponto em que recuperar dados dessas fontes não é um problema, certo? É relativamente fácil recuperar documentos e dados do data warehouse. Muitas vezes, esses fornecedores de data warehouses, como Snowflake e Databricks, oferecem ferramentas de texto para SQL, e há busca vetorial para recuperar informações dos documentos. Portanto, obter os dados não é o problema. O problema é como combinar esses dados e como navegar por eles de forma razoável, para que o modelo de IA tenha todo o contexto de que precisa. Há situações bem específicas em que isso se torna um grande problema. Por exemplo, se você quiser navegar de verdade pelos documentos, digamos: “Tenho uma ordem de serviço que se conecta a uma série de manuais e boletins de segurança”.
04:13 Fazer apenas uma busca vetorial nesses documentos significa que você está pesquisando, mas essa busca pode deixar lacunas ou dar peso excessivo a apenas um documento, retornando muitos resultados duplicados. Então, existe esse problema de precisão e revocação: você pode não recuperar todas as informações de que precisa e, às vezes, se o valor de K retornado for muito baixo, sua precisão é prejudicada. Portanto, é preciso ir um pouco
04:46 além da busca semântica e talvez percorrer os links dentro dos documentos, a estrutura deles. Da mesma forma, se você precisar fazer perguntas sobre informações negativas, como o que não existe nos meus dados ou onde falta algo, isso é muito difícil com busca vetorial. E, claro, também há a questão de encontrar conexões entre coisas diferentes. Como conectar meus dados não estruturados e encontrar as conexões com meus dados estruturados consultados com texto para SQL, garantindo que, inclusive dentro das minhas tabelas, eu faça conexões entre elas de forma eficiente, de acordo com a linguagem do negócio ou com a semântica empresarial usada por quem realmente trabalha nesse negócio.
05:18 Então, vamos analisar três estruturas específicas que podem nos ajudar. A primeira é criar sumários ou árvores a partir dos nossos documentos. Também vamos analisar conexões: como formar caminhos, especialmente entre os dados estruturados da lakehouse ou do data warehouse, e temas, que é como extrair comunidades e revelar padrões que ninguém nomeou antes. Por exemplo, digam-me sobre algo que, basicamente, eu não sei o que estou procurando, mas quero descobrir contradições ou erros, identificar o que está faltando ou encontrar padrões recorrentes nos meus dados, temas que se repetem. Como faço isso? Tenho certeza de que muitos de vocês, se estão aqui, já sabem bastante sobre grafos, mas vou explicar o Neo4j e
05:51 ordem de serviço e, então, isso se conecta a uma série de manuais e boletins de segurança.” Ao fazer apenas uma busca vetorial nesses documentos, você está pesquisando, mas essa busca pode ter lacunas ou pode dar peso excessivo a apenas uma parte da documentação e trazer muitos resultados duplicados. Então, você tem esse problema de precisão e revocação: nem sempre recupera todas as informações de que precisa e, às vezes, se o valor de K retornado for muito baixo, sua precisão sofre. Então, você precisa ir um pouco além
06:25 da busca semântica e talvez navegar pelos links dentro dos seus documentos, pela estrutura deles. E, da mesma forma, se você precisar fazer perguntas sobre aspectos negativos, como o que não existe nos meus dados ou onde está faltando algo, isso é muito difícil com busca vetorial. E, claro, tentar encontrar conexões entre coisas diferentes. Então, como conectar meus dados não estruturados e encontrar as conexões com meus dados estruturados de texto para SQL, garantindo que, mesmo dentro de
06:57 minhas tabelas, eu esteja conectando as tabelas de forma eficiente, de acordo com a linguagem de negócios ou com a semântica de negócios usada pelas pessoas que realmente trabalham na empresa. Então, vamos analisar três formas específicas que podem nos ajudar. A primeira é criar sumários ou árvores a partir dos nossos documentos. Também vamos analisar conexões, ou seja, como formar caminhos, especialmente entre os dados estruturados do nosso lakehouse ou do nosso data warehouse, e
07:32 temas, que consistem em extrair comunidades e revelar padrões que ninguém havia nomeado antes. Então, digamos que eu não saiba o que estou procurando, mas queira descobrir contradições ou erros, encontrar lacunas ou padrões comuns e temas recorrentes nos meus dados: como faço isso? E tenho certeza de que muitos de vocês, se estão aqui, já sabem bastante sobre grafos, mas vou explicar o Neo4j e
08:06 como pensamos em grafos bem, bem rapidamente, para que todos fiquem mais ou menos no mesmo nível, porque vamos usar grafos para expressar essas estruturas e superar os problemas de que falei antes. Então, quando nos referimos a um grafo aqui na Neo4j, muitas vezes estamos falando de um modelo de dados de grafo de propriedades. Existem outros tipos de modelos de dados de grafo. No fim das contas, todos modelam basicamente a mesma coisa. Este aqui é só muito, muito simples e fácil de entender. Então, há três
08:37 elementos importantes que você precisa conhecer em um modelo de dados de grafo de propriedades. Há os nós, que representam pessoas, lugares e coisas, certo? Ou seja, entidades. Há os relacionamentos, que são os verbos ou as associações entre essas pessoas, lugares e coisas. Então, como podem ver aqui, uma pessoa pode ser proprietária de um carro, ou pode dirigir um carro, ou pode haver relacionamentos entre pessoas, como uma pessoa ser irmão ou irmã de outra.
09:09 E então a outra parte realmente importante são as propriedades, que podem ser strings, datas, vetores — por exemplo, para busca vetorial —, listas de coisas, datas, números e todos esses tipos de dados, que podem estar nos atributos dos nós e dos relacionamentos. Isso ajuda na busca, na filtragem e em todo tipo de coisa que usaríamos. E a ideia, certo, é que isso é quase como tabelas com junções prévias, porque, em vez de ter chaves primárias e estrangeiras, posso
09:40 ir de um nó a outro em vários saltos com muita facilidade. Tudo já está, sabe, previamente conectado, então você pode percorrer tudo rapidinho. E, quando falamos da camada de conhecimento — que é o nosso título para esta apresentação —, talvez seja útil explicar o que ela é, certo? Você pode pensar na camada de conhecimento como algo que fica entre seus agents ou usuários finais e seus dados de origem. E essa
10:11 camada de conhecimento, onde a Neo4j se encaixa na stack, pode armazenar muitas informações úteis: grafos de vários tipos. Grafos de conhecimento, que descrevem seu conhecimento semântico, como as coisas se relacionam; ontologias, que descrevem sua semântica e seus esquemas, como eles se relacionam com o mundo real e definem o significado dos seus dados; memória; regras de negócio; conhecimento procedural, como a forma de executar tarefas. E todas essas coisas
10:44 ajudam seus modelos de IA a se tornarem mais precisos. Elas oferecem uma forma de governança e explicabilidade, e você pode destilar e conectar muito do conhecimento dos seus agents e da experiência humana dentro dessa camada de conhecimento, além de torná-la portátil, para que possa conectar qualquer agent a ela e compartilhar esse conhecimento entre agents. Há muitos componentes em uma camada de conhecimento, e hoje vamos nos concentrar mais no lado dos grafos de conhecimento e no lado da ontologia ou camada semântica, com um pouco de regras de negócio
11:16 misturadas. Em outras palestras, há muitas informações que oferecemos sobre memória: como criar esses grafos de memória incríveis, grafos virtuais, grafos de contexto e conhecimento procedural. Eu abordo esses assuntos em outras palestras, assim como muitos dos meus colegas. E você pode facilmente ampliar o que estamos fazendo aqui, mas quero apresentar a base de uma camada de conhecimento introdutória, e é por isso que estou me concentrando principalmente nessas duas áreas e meia. E é assim que vai ficar quando entrarmos no workshop. Basicamente, o que vamos construir
11:50 hoje é o seguinte: você terá seu agent aqui e seu lakehouse. Neste caso, vamos usar Databricks. Você terá suas tabelas estruturadas e os documentos que eu estava mostrando. Vamos criar um grafo de camada semântica com algo chamado Neo4j. Ele vai ser como uma ontologia, de certa forma. Alguém está perguntando se podemos disponibilizar os slides. Posso compartilhá-los depois. Se você participar do workshop,
12:20 as imagens também estão lá. Não estão todas as imagens que mostrei, mas este diagrama está no workshop. Então, vocês terão acesso a elas. Mas, sim, posso ver se consigo compartilhá-las aqui depois da palestra. A camada semântica, novamente, será um reflexo do que há no data warehouse e vai dizer ao agent como escrever consultas text-to-SQL realmente boas. E, então, vamos analisar nossos documentos e inseri-los no grafo. Vou fazer isso de uma maneira
12:52 idempotente. Vou explicar isso quando chegarmos a essa parte, mas muitas vezes as pessoas têm dificuldade com resolução de entidades — ou melhor, extração de entidades. Alguns desses workflows podem ser um pouco complicados quando você os aborda pela primeira vez. Vou fazer aqui algo que se concentra mais na estrutura dos documentos. É um código determinístico muito, muito simples, que você pode enriquecer depois com extração de entidades, se quiser. Então, novamente, com esse tema introdutório em mente, aqui está apenas o tipo de tema inicial da camada de conhecimento. Com isso em mente, vamos
13:24 começar o curso. Deixe-me mudar de aba. Alguém pode me dizer, Martin ou Alex, se postamos no chat os links para estas duas coisas aqui? Deixe-me conferir. >> Sim. >> Certo. Então, todos têm isso. >> Sim, esses links foram postados e também fixados no topo do chat do workshop. Se não estiverem vendo agora,
13:55 role para cima e procure as mensagens fixadas. Há o conteúdo do workshop e também o conteúdo com as credenciais que você compartilhou neste arquivo do Google Docs com as chaves de API. >> Certo. Ótimo. Perfeito. Então, este é o início do workshop. Já fiz a maior parte desta introdução. Vocês já viram isso. A próxima coisa que quero que façam é ir até a parte do ambiente. E vocês vão abrir… Vou
14:27 explicar estas etapas. Vocês vão abrir um ambiente no GitHub CodeSpaces para fazer isso, se quiserem acompanhar. Se quiserem, também podem executar tudo localmente. Todo o código disso é open source, então podem acessar o repo que contém todo o código e começar a executá-lo localmente. Podem conectá-lo ao Orin, fazer o que quiserem. Caso contrário, podem criar um novo ambiente no CodeSpace. Eu já tenho um CodeSpace aberto no qual estou trabalhando, então não vou
14:59 apertar nenhum botão aqui, mas é isso que vocês fariam. Quando estiverem aqui, basicamente precisam fazer o seguinte: a inicialização vai demorar, então isso vai levar de 3 a 5 minutos. Há um arquivo de ambientes, e vocês vão precisar preencher estes campos; é aí que entra o arquivo de credenciais que temos de antes. Então, basicamente, se eu rolar para baixo, há uma chave de IA da Anthropic e estas chaves do data warehouse.
15:32 Aqui estão as credenciais do workshop. Parece muito errado da minha parte mostrar as credenciais do workshop durante o compartilhamento de tela. Mas vamos apagar tudo depois. Então, por favor, usem isso com responsabilidade. Vou entrar no meu ambiente e colar tudo lá. Ah, na verdade, colei por cima da coisa errada. Então, aqui está a chave da Anthropic, e depois os dados do warehouse
16:02 vocês vão colocar ali embaixo, junto com os outros dados do warehouse. Vou inserir isso aqui embaixo. Depois que tiverem preenchido, vão precisar iniciar um sandbox da Neo4j. Há instruções aqui sobre como fazer isso. Vocês precisam acessar “Open Sandbox”. E, quando estiverem lá, eu já tenho um sandbox de graph data science selecionado, porque estava, sabe, executando
16:36 isso antes, como preparação. Mas, no seu caso, você iria para um novo projeto e, como eu já tenho um, ele não aparece para mim, mas deve estar em seus próprios dados. Não o sandbox em branco comum, mas o sandbox em branco com graph data science. Deve aparecer aqui uma imagem mostrando como fica durante a configuração. Então, é o sandbox em branco com graph data science. Também há uma maneira de conectar isso ao Aura. Enquanto vocês estiverem fazendo isso, vou dizer que
17:08 em algum momento vamos atualizar este curso para usar o Aura. A única coisa que impede isso é um detalhe técnico sobre como fazer algumas coisas de GDS ao criar projeções, porque lá é usado um mecanismo diferente. Não quero entrar nisso neste workshop. É um detalhe técnico. E, na verdade, como o Ryan disse, ele colocou aqui embaixo mais ou menos o que seria preciso corrigir no workshop para fazê-lo funcionar com o Aura, que é nossa oferta na nuvem. Mas, por hoje, vamos usar o sandbox.
17:43 Depois de hoje, eu recomendaria dar uma olhada: se você voltar àquela seção de credenciais e consultar estas instruções, recomendo entrar aqui e segui-las, usando o Aura em vez de um sandbox de GDS. A experiência provavelmente será muito melhor. Certo. Enfim, depois de criar isso, você vai abrir seu sandbox. No seu caso, ele deve estar em branco. Basicamente,
18:16 se eu abrir meu sandbox, ele vai mostrar as credenciais, e você basicamente só precisa inserir os detalhes de conexão. O nome de usuário será Neo4j, e depois vem sua senha. Quando eu me conectar ao meu, ele vai mostrar que tenho coisas dentro do meu grafo, porque eu já estava usando antes. Vamos salvar. Vai mostrar que tenho coisas dentro do meu grafo porque eu já estava usando antes. Para você, não vai haver nada, porque é apenas
18:47 um sandbox novo e em branco. Depois que estiver pronto, você basicamente pega suas credenciais. Ao fazer isso, você vai baixar as credenciais. Ele vai fornecer um arquivo para baixar, e você coloca essas credenciais no arquivo de ambiente. No meu caso, elas vieram para cá; tenho as minhas aqui, então é só copiar. Depois eu iria para o meu
19:23 meu espaço de código e as colocaria aqui, dentro do meu arquivo de ambiente. Depois que tudo isso estiver feito — e muitos de vocês talvez ainda estejam esperando tudo inicializar —, vocês vão iniciar o Claude, que os guiará por uma série de etapas. Então, se eu for aqui… Outra coisa: este script bash — ou melhor, o terminal bash — foi iniciado muitas vezes,
19:57 por causa de uma condição de corrida, antes que o arquivo de ambiente fosse criado, antes de vocês inserirem as credenciais. Então, vocês podem executar o source no bash aqui. Há instruções para fazer isso aqui, mas o que eu faço, que é um pouco mais fácil, é criar um novo terminal bash. Aí posso digitar Claude. E, se quiser facilitar um pouco, digo para ativar o modo automático. Assim, ele me faz menos perguntas. Depois, vocês vão
20:29 selecionar o que quiserem aqui. Quando ele pedir sua chave de API, digam que sim. Insiram-na para continuar e usem as configurações recomendadas. Confiem na pasta. Ele vai perguntar sobre um servidor MCP, que está aqui. Este será usado para se comunicar com o Databricks, e vocês devem dizer que sim. Eu digo para usar tudo aqui. Depois, vocês devem chegar ao terminal do Claude. Agora, se vocês escolherem alguma opção errada em alguma dessas
21:01 instruções, ele vai dizer como corrigir. Se precisarem reiniciar, podem remover isso das configurações. Se escolherem a opção errada de MCP, podem redefinir as escolhas do projeto aqui. Quando terminarem, podem fazer esta pergunta. A resposta deve ser zero. No meu caso, não será zero porque eu já comecei a carregar coisas,
21:35 O que estamos fazendo aqui? No meu caso, não será zero porque eu já comecei a carregar coisas do workshop. Outra coisa: testamos este workshop principalmente com Opus, mas com versões mais antigas do Opus. Talvez eu esteja sendo um pouco ousado. Na verdade, vou… Não preciso abrir um novo script para isso. Mas vou tentar com Sonnet. Eu estava testando com Haiku
22:09 mais cedo hoje, e estava funcionando. Mas vou tentar com Sonnet. Se não funcionar — embora eu ache que vai —, volto para Opus. Quer saber? Vou parar por aqui e talvez deixar um tempo para perguntas. Já se passaram cerca de 25 minutos. Vamos ver se há perguntas no chat que precisamos responder. Na verdade, acho que já respondemos a tudo.
22:40 >> Acho que sim. Martin respondeu gentilmente à maioria das perguntas. Acho que a que apareceu algumas vezes foi: por quanto tempo as chaves de API ficarão disponíveis para quem quiser assistir hoje e fazer o workshop depois, no próprio horário? >> Não podemos mantê-las disponíveis por tanto tempo. Sei que preciso desativar a chave da Anthropic praticamente assim que o curso terminar. Vou deixá-la ativa por mais um tempinho, talvez. Espero que vocês consigam uma assinatura do Claude. Ela
23:13 não deve custar muito para vocês fazerem o curso inteiro. Vocês só vão pedir ao Claude que responda a alguns prompts diferentes. Ele não vai fazer extração de entidades nem nada do tipo. Ryan, e no caso do Databricks, o que você acha? Podemos deixar isso ativo por um dia ou queremos desativar imediatamente? >> Também vamos ter que desativar isso imediatamente. >> Sim, sim. Mas, se vocês olharem o curso, há uma opção para usar o BigQuery como seu data warehouse de apoio. E essa
23:44 opção eu deixo ativa o tempo todo, porque é muito barata. E não deve mudar em nada o funcionamento do workshop. Então, vocês podem usar a opção do BigQuery. Talvez eu precise adicionar a chave do BigQuery de volta às credenciais do workshop, mas fico mais do que feliz em fazer isso. Na verdade, acho que ela já está no ambiente. Sim, está. Então, esqueçam. Não preciso fazer isso. Já está tudo configurado automaticamente para vocês.
24:18 >> Sim, Nile, vocês vão receber um e-mail com a gravação de hoje e também com os materiais. Assim, podem continuar quando quiserem e, claro, decidir como querem fazer. Assistam ao Zach e ao Ryan fazendo e depois façam vocês mesmos, lembrando que as chaves não vão ficar ativas. Ou continuem fazendo hoje e… >> E o workshop em si é seu para sempre, claro, e você pode fazê-lo quando quiser. >> Sim, e tem outra pergunta aqui. Com certeza dá para executar
24:51 isso localmente. Tudo bem. Sim. Fornecemos isso para que todos estejam nas mesmas condições e possam fazer, mas, se fosse eu, também executaria localmente. Beleza. Muito bem. Obrigado. E então, como estamos? Não sei se há uma maneira de receber feedback pelo chat. Está todo mundo… Não sei, existe alguma forma de dar um sinal de positivo se estiver tudo certo com o ambiente?
25:24 … ou precisamos de mais tempo? Sim, avisem no chat se vocês estiverem aí. Sim, estou vendo vários joinhas chegando. Algumas pessoas dizem: “Só mais um pouco de tempo, por favor.” Certo. Vamos dar mais um tempinho. Sim, vamos dar mais alguns minutos. Não tem problema durante a espera: se quiserem avançar, é só clicar em “Continuar”. E isso vai levar vocês para a próxima…
25:57 …parte. Então, vou dar alguns minutos para todo mundo acompanhar, mas vocês podem avançar, conferir as coisas e começar a executar tudo por conta própria também, se já estiverem nessa parte. Parece bom. Legal. Vou só… deixa eu ver se há algo no chat sobre o que possamos falar enquanto as pessoas se preparam. Sim, workshops anteriores… Eu encerrei aquilo. É, não, acho que as pessoas ou já estão prontas ou estão se preparando.
26:29 Certo. Oi, desculpa. Houve uma pergunta do Max: há algum comentário sobre executar evals nesse grafo de conhecimento? Usar um modelo em vez de outras opções, se você tiver alguma opinião sobre isso. Então, executar evals para comparar diferentes modelos era essa a pergunta? >> Sim, exatamente. Sim, e… >> Sim. Para este workshop, eu não tenho…
26:59 …um harness de evals configurado nem nada do tipo, mas vocês podem fazer isso facilmente. E é engraçado, porque, quando criei este workshop, no começo deste ano, lembro que eu tendia a favorecer o Opus e modelos mais avançados, mas, conforme os modelos foram melhorando, pelo menos no universo da Anthropic, percebi que consigo usar modelos menores. Então seria um teste interessante, porque…
27:30 …quando fornecemos uma camada de conhecimento, em teoria, o que estamos fazendo é quase destilar o conhecimento humano para um modelo e dar a ele um grafo para seguir, em vez de exigir que faça muito raciocínio e roteamento por conta própria. Então, em teoria, o maior ganho deveria ser para os modelos menores. Mas isso nem sempre acontece quando o caso de uso é muito complicado e, às vezes, isso… De novo, acho que agora estou vendo isso acontecer mais: os modelos menores estão…
28:01 …se saindo melhor. Uso principalmente a Anthropic, então começo com essa ressalva. No passado, os casos eram complicados o bastante para que você quisesse um modelo maior em alguns dos exemplos que exigiam seis ou sete saltos. Mas não acho que isso ainda seja verdade. Então, eu teria interesse em adicionar um harness a isso, um harness de benchmarking, e realmente ver como os diferentes modelos se comparam. E, obviamente, comparar com simplesmente usar…
28:32 …BigQuery ou Databricks por si só é sempre muito interessante. E o que observo é que, quer dizer, o motivo de termos organizado este workshop, certo, é que é muito difícil fazer esse tipo de coisa sem algum tipo de camada semântica ou ontologia que relacione os dados não estruturados aos estruturados. >> Não. Não. >> Certo. >> Ótimo. Acho que devemos seguir em frente. Talvez você pudesse resumir em uma frase o que quer dizer com…
29:05 …formas e dimensões. >> Então, falamos que o contexto vem em formas — esse é o verbo usado neste workshop. O que quero dizer é o seguinte: como engenheiros de IA — e falo disso como se a engenharia de IA fosse uma disciplina que existisse há décadas. Acho que, enquanto todos nós tentamos acompanhar e aprender o que está acontecendo com a IA, ficamos muito focados nas…
29:37 …ferramentas. Isso acontece bastante com a recuperação de informações. Tipo: “Ah, preciso fazer texto para SQL”, “Ah, preciso fazer RAG” ou “Ah, preciso escrever uma consulta Cypher, uma consulta de grafo, para buscar algo nos dados”. Mas, muitas vezes, se você der um passo atrás e pensar assim: “Certo, sem atribuir características humanas a um LLM, mas, do ponto de vista do LLM, de que contexto ele precisa para responder adequadamente à pergunta de um usuário ou executar algum…
30:09 …tipo de ação autônoma?” Quando você formula assim, a questão passa a ser: que formato de dados preciso fornecer a ele? Como deve ser a visualização? Se você pensar em uma visualização materializada, como ela precisa ser? Aí, você volta a partir disso para decidir quais ferramentas e consultas precisa reunir. Então, em vez de pensar “preciso criar uma consulta Cypher para acessar os dados”, pense mais assim: “preciso dar ao meu modelo de IA um índice que ele possa percorrer”. Agora, como…
30:43 …faço isso? Com uma consulta Cypher? Uma consulta SQL? Outra coisa? Como faço isso, certo? Essa é a ideia. >> Perfeito. Faz sentido. Muito obrigado. Vamos continuar. >> Certo, vamos em frente. Então, vamos passar para nossa primeira forma, que é a forma de conexões. A ideia é: como explicamos ao modelo ou ao nosso agent como navegar pelos dados do nosso warehouse? E, para isso, vamos nos concentrar…
31:15 …especificamente no lado dos dados estruturados. Há algumas métricas que discutimos aqui sobre o desempenho de texto para SQL e esse tipo de coisa. O campo está mudando constantemente, os modelos estão evoluindo. Os diferentes fornecedores lançam o tempo todo coisas que, na prática, fazem texto para SQL. Mas o que estamos tentando fazer o modelo de IA entender é: qual é o formato desses dados? O que se conecta a quê, e por que isso se conecta a isso? Para fazer isso, vamos criar uma camada semântica…
31:48 …ou, de certa forma, uma ontologia. Tenho aqui uma pequena tabela que tenta explicar os diferentes níveis de raciocínio relacionados à ontologia, à camada semântica e ao grafo virtual. Há bastante texto, mas, basicamente, uma ontologia trata de interpretação e de raciocinar sobre os dados. Uma camada semântica trata mais de como consultar os dados para corresponder à terminologia comercial. Então, é um pouco mais funcional, por assim dizer. E também temos os conceitos de grafo virtual, que não vamos…
32:20 …abordar hoje. Na verdade, isso colocaria um grafo virtual diretamente sobre um warehouse, onde você poderia consultar o warehouse com SQL. Basicamente, isso leva o Cypher até a camada de consultas e depois traduz para SQL. Assim, você pode consultar seu warehouse do Databricks como se fosse um grafo. Não vamos abordar isso hoje. Hoje, vamos falar de uma camada semântica. E vamos usar esta ferramenta chamada Neocarta. Neocarta é um projeto do Labs. E…
32:55 …estamos sempre pensando em como integrá-lo ao restante das nossas ofertas de produtos. Um projeto do Labs é algo em que trabalhamos com frequência. Esses projetos serão open source. Pense neles como ferramentas de arquitetura de referência que você pode usar e incorporar às suas soluções, mas que não fazem realmente parte da nossa oferta oficial de produtos nem têm suporte da equipe de engenharia. Basicamente, o Neocarta permite configurar uma conexão com seu warehouse.
33:27 Neste caso, estamos usando Databricks, mas também há BigQuery. Acho que funciona com Postgres e vários outros. E você pode montar essa… Bem, isso não é a camada semântica. Onde está o grafo da camada semântica? Ou talvez fosse isto aqui. Isso serve mais para mostrar como funciona a consulta, mas o que quero mostrar é algo assim, certo? Então, temos seu banco de dados, o esquema, todas as tabelas e as referências entre elas e…
33:59 tudo que, basicamente, é um mapeamento do seu esquema de dados lógico ou físico que fica dentro de um grafo. E essas chaves de referência, que são difíceis de ver, mas vou mostrar depois que carregar, indicam como as coisas se relacionam. Elas podem ser inferidas, por exemplo, a partir de um log de consultas. Muitas vezes, em data warehouses, não há chaves primárias e estrangeiras definidas explicitamente. Elas podem vir de comentários nas tabelas ou de um log de consultas, por exemplo, ou de alguma outra forma de dados.
34:29 E o Neocarta ajuda você a mapear isso. E há outras coisas que ele pode fazer, especificamente em torno de adicionar… Quero ver se isso está aqui. Sim, como adicionar um glossário de negócios, o que não vamos fazer aqui, porque estamos fazendo apenas um exemplo introdutório. Como terminologia de negócios e coisas assim, que você pode sobrepor ao esquema. Isso pode ser muito, muito útil, basicamente, para fazer o seu modelo de IA entender como tudo isso funciona.
35:00 E, novamente, aqui não vamos importar nenhum dado do Databricks para o Neo4j. Tudo isso será sem cópia. O que vamos colocar no Neo4j é esse mapeamento. E então o seu agent vai usar isso para escrever SQL em texto melhor, depois de entender a estrutura dos dados, certo? E vamos continuar. Então, vamos chamar este script Python aqui.
35:33 Vou simplesmente copiá-lo. E vou voltar para o meu projeto aqui. Vou abrir um novo terminal. E vou digitar o comando. Estou correndo um pequeno risco aqui, porque já tenho todos os dados do lakehouse no meu workshop. Então, vou gravá-los duas vezes. Isso pode me causar problemas mais tarde. Mas o que isso vai fazer
36:06 é… Parece ótimo. A operação era idempotente. Então, ele só carregou. Não duplicou os dados ali. É bom saber. Ele vai gravar tabelas e referências ali. E, se você observar como esse script funciona, vamos ver, onde está? Está em load. Em build connections. Basicamente, o que ele vai fazer — a parte importante aqui é onde ele chama e obtém dados do Neo4j. E onde está a parte propriamente dita? Aqui é onde ele instancia o…
36:41 conector de esquema do Databricks. Abre um driver. Executa isto. Mas acho que isto é só uma contagem. Então, aqui é onde fazemos isso. Nesta biblioteca, basicamente… Vou aumentar um pouco. Você está simplesmente dizendo: “Ei, ingira, basicamente, do Databricks”, e então o esquema aqui está, basicamente, lendo o esquema do Databricks. Então, estes são
37:14 as variáveis de ambiente que preenchemos antes. Então, foi isso que foi executado. E, para ver o que ele cria dentro do Neo4j, posso voltar ao meu workshop. E mais uma coisa: aqui diz seis tabelas e cinco referências no catálogo. Eu fiz uma bagunça para o Ryan. E quase culpei o Ryan, o que foi muito injusto, porque esqueci que eu tinha feito a bagunça. Eu estava brincando com a busca de IA dentro do Databricks. E, por isso, há duas tabelas relacionadas a documentos que carreguei, que não deveriam estar ali.
37:45 Mas elas não afetam o curso. Então, vocês vão ver oito tabelas e cinco referências. Mas, sempre que fizerem uma pergunta para o workshop, finjam que há apenas seis ali. E vamos ter que removê-las em algum momento. Aqui está a consulta que vai mostrar mais ou menos como isso se parece. Vou clicar em copiar aqui, para este trecho de Cypher. E acho que, a esta altura, muitos de vocês já sabem o que é Cypher.
38:17 Cypher, só para quem não conhece, é a nossa linguagem de consulta para grafos. Parece SQL, mas faz correspondência de padrões. O que estou dizendo aqui é: “Ei, encontre um caminho que comece em um nó com o rótulo Databricks e, em seguida, percorra qualquer tipo de relacionamento, por quantos saltos forem necessários, e me traga todos os caminhos”. Basicamente, estou dizendo: “Retorne tudo o que estiver conectado a este nó de banco de dados”.
38:53 Eu não faria isso com um banco de dados grande, aliás, porque você pode imaginar que, se houver centenas de milhares de nós aqui, ele vai tentar trazer todos eles. Não tenho algo como “retorne P, limite 2”, certo? Nesse caso, ele retornaria apenas um pedacinho. Estou dizendo: “Retorne tudo”. E ele vai me trazer todo o componente conectado. O que vamos ver aqui é o nosso banco de dados, Databricks. Temos o nosso esquema, que é o esquema AutoFix,
39:23 que é o caso de uso com que estamos trabalhando. E aqui vocês podem ver as nossas tabelas. Por exemplo, a tabela de peças, as ordens de serviço, os procedimentos, os veículos, todas essas coisas legais. E essas tabelas se conectam às nossas colunas. Então, estes são basicamente os nomes das colunas dentro das nossas tabelas no Databricks. E também podemos ter valores de exemplo
39:53 aqui. E destaquei aqui essas junções de referência. Talvez eu as deixe com uma cor bonita. Que tal azul? Vou deixá-las maiores, certo? Estas são as nossas junções de chave primária para chave estrangeira. E há várias maneiras de o Neo4j inferir isso. Obviamente, se você tiver uma chave primária ou estrangeira nomeada explicitamente, como em um banco de dados relacional, ele consegue identificar isso. Também pode
40:24 fazer isso se houver comentários ou metadados; diferentes data warehouses têm maneiras diferentes de fazer isso. Acho que no Snowflake são comentários. Esqueci como isso se chama no Databricks, mas você basicamente diria algo como: “Ah, esta é uma chave estrangeira para tal tabela”. E ele também pode fazer isso por meio de um log de consultas. E isso é muito comum na prática, certo? Porque muitos desses data warehouses, como eu disse antes, não têm… Eles têm essas chaves de junção implícitas, o que pode ser um transtorno quando se tem centenas de tabelas. Então, este exemplo é muito, muito simples,
40:58 mas acho que é bom para fins ilustrativos, para entender mais ou menos como isso funciona. E continuo indo para a coisa errada. Há diferentes operações. Ele pode obter o esquema completo de metadados. Pode listar esquemas. Pode obter contexto por tipo de tabela. Ele tem… Há um servidor MCP do Neo4j; é assim que o agent consome isso. Talvez também haja uma cloud, acho, mas estamos usando o servidor MCP para isso. E damos ao agent a capacidade de executar este script aqui,
41:36 este script para executar SQL. Então, posso copiá-lo e verificar se o meu agent funciona. Na verdade, deixe-me iniciar uma nova cloud aqui. E quero confirmar qual modelo estou usando. Estou usando Sonnet. Ótimo. Certo, vou perguntar quais veículos receberam uma determinada peça, pedir para usar o MCP para obter o esquema do warehouse e escrever o SQL e executá-lo com a coisa aqui.
42:07 E ele deve fazer isso para mim. O que vai fazer é, basicamente, usar esse servidor MCP para ler o esquema do Neo4j. E então vai usá-lo para executar o SQL. E, enquanto ele está trabalhando nisso… Ah, já trouxe o resultado.
42:40 Então, ele respondeu à nossa pergunta. Em 521 veículos. E agora vou perguntar: “Quais pontos MCP você usou para isso?” E ele deve me dizer o que usou. Get context by column e get full metadata schema. Então, basicamente, ele foi ao nosso Neo4j, ao Neo4j, e…
43:15 entendeu isso, e aí posso perguntar: que consulta você executou em SQL? Depois que obteve isso, executou esta outra consulta em SQL. E dá para ver que parece que executou duas. E havia algumas junções ali. Enfim, esse é o padrão básico aqui. Obviamente, isso é muito simples, certo? Porque o que estamos fazendo aqui é que temos o nosso…
43:47 nosso esquema tem apenas umas seis tabelas. Então, não é tão difícil. Eu queria algo que fosse fácil de visualizar. Mas dá para imaginar que as pessoas — nossos clientes — vão usar isso quando tiverem centenas de tabelas. E isso ajuda bastante. Também dá para imaginar, em outra situação em que isso é usado, que você tenha dados no Databricks e também alguns dados no BigQuery ou em outro lugar. Parece que alguém estava falando. Foi você, Alex?
44:17 >> Sim, eu estava… Não, porque eu não queria interromper, mas sim. Há algumas perguntas repetidas sobre onde encontrar o URI do Neo4j e a senha do sandbox. Acho que isso está no curso da Graph Academy, mas também aparece na visualização do sandbox. Talvez você possa mostrar isso mais uma vez rapidinho para as pessoas saberem onde. >> Sim, vou mostrar. Então, se você está aqui e isto está em execução… Primeiro, quando você fez isso, um arquivo de credenciais deveria ter sido baixado. Essas informações também estarão nesse arquivo de credenciais baixado. É mais fácil assim.
44:50 Mas, se não estiver, vá até… Está vendo isto aqui? Você pode acessar os detalhes da conexão. E, por favor, não copie minha senha nem estrague meu banco de dados, mas é aqui que ela fica. Você pode copiar para a área de transferência e inserir dessa forma. >> Ótimo. >> E este pode ser um bom momento para parar e responder a perguntas. Deixe-me dar uma olhada. Sim, há alguns detalhes aqui, caso você queira ver como as coisas são organizadas em namespaces no Databricks, em termos do esquema e de todo o resto. E também dá para… Acho que isso só vai me mostrar algumas informações sobre… Onde está? Vou até… Hum. Sim, só vai mostrar o dialeto que está usando — Databricks SQL e Databricks — e a tabela. Claro, temos a opção de usar o BigQuery aqui, que, se você estiver assistindo a isto depois, provavelmente é o que você vai querer usar.
45:27 tudo. E então você também pode… Acho que isso só vai me mostrar algumas informações sobre… Onde está? Vou para… Hum. Sim, só vai mostrar o dialeto que está usando, Databricks SQL, e o Databricks, e então a tabela. Claro, temos a opção de usar BigQuery aqui, que, se você estiver assistindo a isso depois, provavelmente é o que vocês estão
46:00 Você vai querer usar a versão do BigQuery, que, nesse caso, usará um dialeto diferente. Para avançar no curso, indique aqui seis tabelas e cinco junções. Não diga oito, porque há duas tabelas de documentação — uma de trechos dos documentos e outra de… alguma coisa dos documentos. Há duas tabelas de documentação ali. Elas não devem ser incluídas. Então, são seis e cinco. Isso vai permitir que você passe para a próxima parte. Alex, este é um bom momento para parar, caso haja outras…
46:33 perguntas. Vamos ver. >> Sim. Sim, temos algumas. Uma delas é mais longa, mas acho interessante porque se conecta ao que você disse antes. Este é um conjunto de dados pequeno, do tamanho de uma demonstração, mas Oscar pergunta: “E se você tiver milhões e milhões de registros em uma empresa de grande porte? Precisamos lidar com milhões de nós. Qual é o número de nós a partir do qual as consultas do agent deixam de ser ideais? Precisamos de camadas, como cache de memória ou algo assim?” >> [fungada]
47:04 >> No momento, dentro do Neo4j, os nós e os relacionamentos realmente representam colunas e tabelas. Pelas implantações que vi em empresas, na prática estamos falando de centenas, talvez milhares de tabelas nos casos realmente grandes. É possível chegar a milhões de nós nessa representação? Talvez. O Neo4j consegue fazer buscas textuais para pesquisar partes do grafo.
47:37 Assim, não é necessário recuperar todo o esquema de metadados, o que obviamente estouraria a context window, certo? Ou talvez estourasse. Há maneiras de lidar com isso. O Neo4j e as ferramentas que estamos desenvolvendo nessa área vão funcionar bem em escalas maiores. Milhões de nós seria muita coisa para uma camada semântica, embora talvez seja possível. Posso estar enganado. Já em outras formas de recuperação e memória, por exemplo, obviamente dá para…
48:09 chegar a milhões de nós. Por exemplo, se você armazenar o histórico das sessões em um grafo e fizer extração de entidades a partir dele, pode facilmente chegar a milhões, dezenas de milhões ou bilhões de nós. Nesses casos, na forma como fazemos a recuperação, você pode fazer uma busca vetorial no Neo4j para encontrar nós específicos e, depois, usar a linguagem de travessia Cypher de que falei antes para continuar a partir dali. Você vai ver um pouco disso na próxima parte, sobre árvores e navegação. Por exemplo, pode começar…
48:41 em documentos específicos e, em seguida, avançar três saltos, certo? Isso escala perfeitamente para conjuntos de dados maiores. É nisso que nos especializamos na Neo4j: leituras eficientes em grafos à medida que seu conjunto de dados aumenta, certo? Então, tudo isso é possível. E, claro, com coisas como cache… Sim, eu imaginaria que alguma estratégia de cache para consultas em grafos seria útil. Na implementação do Neo4j, temos nosso próprio…
49:15 cache de páginas. Se você fizer uma implantação autogerenciada no Aura, nós mesmos gerenciamos isso. Mas, numa implantação autogerenciada, você pode ajustar a quantidade de memória dedicada a isso e coisas do tipo. Espero que isso responda à sua pergunta. Não estou vendo isso escrito aqui; talvez esteja nos comentários ou na parte das perguntas e eu não esteja encontrando. Provavelmente só não estou vendo, mas espero que ajude. >> Espero que sim. Mas tenho certeza de que… Legal. Vejo várias outras perguntas. Acho que Martin já respondeu à maioria, então provavelmente podemos…
49:49 continuar. >> Certo, vejo mais uma. Talvez eu reserve um tempo para responder. >> O restante do curso, aliás, Alex, podemos ir cada vez mais rápido à medida que avançamos, mas acho muito importante estabelecer os fundamentos. Então, vou dedicar mais um tempinho a isso. >> Há desvantagens na abordagem de cópia zero em comparação com copiar os dados para o Neo4j? Essa é uma ótima pergunta. Então, aqui, não estamos copiando os dados para o Neo4j.
50:22 E você estava fazendo isso naquela camada semântica? Há desvantagens nisso. Uma das principais será a precisão em consultas com vários saltos e, principalmente, a latência. Às vezes, vejo isso em casos de uso grandes, como os de cadeia de suprimentos ou roteamento. Digamos que você queira encontrar o caminho mais curto entre dois pontos. Essa é uma consulta de comprimento arbitrário. Se você quer saber como transportar um pacote por um país, passando por vários armazéns, isso…
50:55 pode envolver dois armazéns, cinco paradas ou nenhuma. Você não sabe. Esse tipo de consulta simplesmente tem melhor desempenho em um banco de dados de grafos. Então, faz sentido mover seus dados para o banco de dados de grafos. Acho que a principal questão é: o que está impedindo você é o desempenho da consulta e o fato de que os mecanismos da própria consulta dependem de um grafo para ter bom desempenho? Esse é o impedimento? Então, mover seus dados…
51:28 para o Neo4j seria inteligente. Por outro lado, se o problema for mais algo como: em teoria, consigo fazer isso em SQL e funciona bem. É só que meu agent não entende como fazer isso com as ferramentas atuais que temos no nosso data warehouse, no meu SQL ou seja lá o que eu estiver usando. Esse é outro tipo de questão, porque, em muitos desses casos, como nos exemplos que mostrei aqui, certo? A gente estava fazendo, sabe, algo como junções de dois saltos ou coisa assim. Não era algo
52:01 terrível. Sim, tipo, duas junções. Então, dá para fazer em SQL, mas pode ser uma situação em que o seu agent simplesmente não entende, porque a terminologia de negócios e tudo mais, e a forma como as coisas se relacionam, podem ser muito complicadas. Talvez haja terminologia de negócios demais, e é aí que a abordagem zero-copy é muito boa. Então, para responder à pergunta original, a desvantagem é que você não tem o desempenho de consultas em grafo. Essa é mesmo a resposta curta, certo? Você só tem uma compreensão semântica melhor e, potencialmente, uma
52:32 maneira melhor de estruturar sua consulta. Certo. Legal. >> Há uma pergunta do Constantine sobre o Neo4j. Ele tem HIL ou gera um modelo semântico de uma só vez? >> Ele tem HIL? >> Sei o que… Sim, para ser sincero, não sei o que significa HIL. >> Human in the loop. >> Ah, só não sabia se você estava no loop. [risos] >> Sim, pode ser isso.
53:07 >> Quer explicar um pouco mais, Ryan, ou… >> Sim, por enquanto é basicamente uma execução única. O Neo4j lê os metadados, cria uma camada semântica, e você pode fazer uma visualização manual, mas, por enquanto, não há um processo iterativo para carregar os metadados. Com certeza estamos expandindo isso para adicionar um processo com human in the loop. Essa é mais ou menos a próxima etapa. Ainda não chegamos lá. >> Certo. Ótimo. Legal.
53:39 >> Obrigado. >> Vamos avançar para a parte de navegação rapidinho. Agora vamos passar para outra estrutura e falar sobre sumário e navegação. Eu chamo isso de algumas formas diferentes. Às vezes chamo de estrutura, às vezes vocês me ouvem chamar de árvores, outras vezes me ouvem chamar de sumário, e peço desculpas por isso. Os termos ficaram misturados à medida que passei por projetos diferentes.
54:09 Mas é tudo a mesma coisa. A ideia aqui é que, às vezes, vamos sair do mundo dos dados estruturados e começar a falar do lado dos documentos do banco de dados. Esses serão os documentos PDF. E nossa tendência natural agora é fazer busca vetorial e dividir os documentos PDF em trechos. Isso é ótimo, e podemos continuar fazendo isso. Mas muitas perguntas podem envolver mais a navegação por esses documentos. E a ideia aqui é que queremos dar ao nosso
54:42 agent um sumário pelo qual ele possa navegar. Assim como uma pessoa: se você abre um livro e olha o sumário, como pulo de uma seção para outra e como sei o que cada coisa contém? Queremos dar ao nosso agent exatamente a mesma visão, para que, em vez de apenas fazer algo como um Control+F, ele percorra e entenda a estrutura da biblioteca que está consultando — a biblioteca de PDFs — e vá até o lugar certo.
55:14 E esta é a visão, ou a estrutura, que quero dar ao meu agent. Basicamente, aqui está a biblioteca técnica, há boletins, e também haverá recalls, manuais e outras coisas. Depois, você terá documentos. E esses documentos vão conter seções diferentes. E essas seções podem apontar para outras seções. Então, isso basicamente significa: “Esta seção sobre essa condição de falha de ignição do cilindro do Falcon 2.0T aponta para um
55:46 diagnóstico de falha de ignição que está nos nossos manuais do motor Falcon.” E eles têm esses URIs aqui. São meio longos e ajudam a identificar até o documento, mas são hierárquicos, certo? Então, por exemplo, há a biblioteca técnica, os boletins e, depois, um documento seria aquele URI completo: biblioteca técnica, boletim e, em seguida, PDF. Já uma seção, como você pode ver aqui, seria algo como
56:16 estes aqui: você tem um símbolo de cerquilha e, depois, a seção. Então, tenho essa visão ampla de contenção. Isso é útil porque permite que meu agent faça uma busca mais exaustiva, entendendo tudo. É assim que ficaria o modelo de dados do grafo completo, certo? Você tem as relações de contenção e também essas relações do tipo “tem”. Então, começa no nível da pasta, desce até o documento e também temos relações de próxima seção. Assim, há uma
56:48 noção de ordem, que é importante para um sumário, certo? Porque, quando temos várias entradas, não queremos que elas estejam aleatórias. Queremos que sejam quase como páginas. Então, por exemplo, se houvesse uma seção de diagnósticos depois de uma condição ou, neste caso, uma seção de causa depois de uma condição, a ordem seria a do documento. E há também as relações de links, que são muito importantes. E o que vamos fazer com isso é basicamente carregá-lo diretamente no
57:20 Neo4j usando este script. E o ótimo é que — deixa eu executá-lo enquanto falo sobre ele. Na verdade, não vou executá-lo de fato. Tenho quase certeza de que ele é idempotente. Então, se eu executá-lo duas vezes — e idempotente significa que, se eu executá-lo duas vezes, não vou duplicar os dados —, vou pular a execução, só por precaução, caso eu esteja errado e tenha cometido um erro ao criar o script e ele não seja realmente idempotente. Mas esse processo pode ser totalmente idempotente. Ou seja, depois que
57:51 você carregar, pode executar isso por conta própria. Basicamente, quando você executar, ele vai criar todos aqueles nós de documentos a partir dos documentos PDF. Acho que temos uma cópia deles aqui. Onde estariam? Em corpus. Então, carregamos os arquivos no armazenamento em nuvem, acredito. Se não, eles estão sendo obtidos daqui. Mas, sabe, tanto faz se você carrega do armazenamento em nuvem ou de arquivos locais. Estes, na verdade, não são os arquivos PDF,
58:25 estes não são os arquivos em PDF. São os arquivos Markdown, mas também deveríamos ter aqui… Será que estaria em… Será que estaria em docs? Me deem um segundo e, se eu não encontrar, vou olhar os arquivos Markdown. Sources, PDFs. Aqui estão. Isso é o que… Ah, vai me mostrar numa visualização toda embolada. Que divertido. Enfim,
58:58 Será que baixei isso? Não baixei. Bem, são documentos PDF. Se você olhar os arquivos Markdown, sabe, é só um PDF do mesmo Markdown aqui. Então, é assim que eles se parecem. E o que esse script faz é percorrer o conteúdo e dizer: “Certo, tenho as diferentes seções.” Ele simplesmente usa um analisador determinístico que sabe onde estão as seções. Esses links não são estruturados como links URL normais. Você
59:32 pode facilmente alterar o código para estruturá-los como links URL normais, mas aqui eles apontam para outros documentos, e o código os analisa deterministicamente para transformá-los em outros nós. E é assim que fica depois de terminar de carregar: posso descer até aqui, copiar outro trecho do meu Cypher e voltar para a minha janela. E vou dizer: “Vá até o nó raiz da biblioteca, basicamente, que fica no topo da biblioteca; é o nó raiz de tudo isso,”
1:00:05 e descer quatro ou cinco níveis, e vou limitar a 50, porque na verdade há muitos nós aqui e não quero trazer tudo de volta.” E então posso até selecionar: se eu descer aqui e escolher o layout hierárquico, ele vai organizar tudo hierarquicamente. Então, dá para ver que tenho minha pasta. Na verdade, há três pastas aqui, certo? Porque temos os boletins, até onde descemos, mas também há manuais e recalls. E então dá para ver os documentos e todas as seções, com o conteúdo de cada seção abaixo delas.
1:00:40 Você sabe, e então as relações has são destacadas em laranja. Essas são as relações has. E também há estas relações links to, que podemos destacar aqui em rosa, e elas levam a documentos diferentes. E então posso, sabe, abrir esses documentos e expandi-los, criando este grafo interconectado bem legal, onde posso começar a entender como tudo se conecta, o que é ótimo. E uma coisa relacionada a isso: alguns de vocês provavelmente conhecem aquela coisa do Copart C, tipo LLM Wiki, em que você tem documentos em
1:01:14 Markdown e tem sua Wiki, onde o LLM extrai sua pesquisa em entidades e páginas de conceitos. Esse mesmo processo pode ser usado para carregar esse tipo de wiki em um grafo de forma determinística. E gosto de começar assim porque não fazemos extração de entidades aqui, o que é ótimo. Talvez, em algum momento, eu queira dizer: “Olha, na verdade quero extrair peças, problemas e conceitos destes documentos para dentro do meu grafo
1:01:46 também.” E, em vez de ter apenas esses nós de pasta, documento, seção e subseção, eu teria um nó de peça, um nó de pessoa e todo esse tipo de coisa. E isso é legal. Mas o ótimo nisso é que é determinístico. Você pode começar a executar imediatamente. Está tudo em ordem. Funciona muito bem. E então você já pode começar a trabalhar no seu grafo de conhecimento, por isso gosto deste exemplo. Mas enfim, o que fazemos depois que temos isso? Deixe-me apagar esta página aqui.
1:02:19 é usar uma especificação que temos para o formato de outline, a propósito. Ela descreve como tudo funciona. Mas vou explicar isso um pouco melhor na próxima seção, por que mencionei isso e por que é importante. Uma das coisas que faremos neste workshop, nos próximos 40 minutos ou pelo tempo que vocês ficarem comigo, é começar a usar o Neo4j CLI. O Neo4j CLI é
1:02:50 esta ferramenta aqui. Sei que vou mostrar bastante coisa, mas quem tentou usar text to Cypher com Neo4j há dois anos e ficou frustrado com o quanto era uma porcaria — desculpem, com o quanto era ruim — sabe que isso é normal. As coisas estão melhorando bastante agora, com modelos melhores, mas também porque estamos criando ferramentas que permitem ter um CLI onde o agent consegue executar comandos Cypher
1:03:20 com muita facilidade e até iniciar a infraestrutura para você. Mas, o que é muito importante, ele também pode instalar estas Neo4j skills, que mantemos atualizadas. E essas skills ensinam ao seu agent como trabalhar com todos os nossos drivers, com graph data science, com MCP e como escrever Cypher, a linguagem de consulta. Isso significa que, se você usar isso, seu agent poderá escrever Cypher muito bem. Então, em vez de — e a ideia aqui
1:03:51 é que quero criar aquela estrutura de que falei antes. Quero criar a estrutura… onde está uma imagem disso? Bem, quero criar aquela estrutura de outline, aquela estrutura de sumário. E como faço meu agent criar isso sem que eu saiba escrever Cypher, que na verdade não é nada trivial? Então, se copiarmos isto, porque este vai ser o comando que vamos dar ao nosso agent para basicamente criar isso para nós em tempo real.
1:04:25 E está tudo aberto aqui. Vou fechar algumas coisas. Se entrarmos na nossa skill, temos uma skill inteira aqui que vai ajudar o agent a fazer basicamente tudo por nós mais adiante no workshop. Mas aqui está nosso script de outline, e vocês veem que temos esta parte em que, e isso vai acontecer bastante com vocês, vocês meio que sabem
1:04:57 o que querem escrever, sabem, basicamente têm uma especificação de como criar a consulta, mas não sabem como fazer partes específicas da consulta. Então, o que temos aqui é uma especificação que diz ao agent mais ou menos como acho que quero montar isso. E então posso fazer ao meu agent essa pergunta.
1:05:29 Estou dizendo: “Use a skill de Cypher do Neo4j.” Tenho outra especificação em docs outline format e esta especificação de construção aqui. Então, a especificação no formato de outline de documento está aqui. Ela explica o formato que quero que ele produza. Isso. Talvez eu não tenha iniciado isso com aquela coisa automática. Este documento explica como quero que o agent monte tudo. Está vendo? Está bem organizado. E eu só queria incluir este padrão
1:06:00 no workshop para que vocês possam ver. Ah, já terminou? Não, ainda deveria estar funcionando. Olha só. O que acabou de acontecer aqui? Certo. E, caso isso também não funcione, ele já preencheu a consulta. Então, se eu for para outlines…
1:06:32 Vocês veem aqui que ele aparentemente já inseriu a consulta. Mas quero confirmar uma coisa antes de avançar demais. Não. Ah, não faça isso. Sim, ele modificou. Isso. Então, dá para ver aqui
1:07:05 que ele prosseguiu e inseriu basicamente o restante da consulta de que eu precisava. Enfim, esse padrão é útil porque vai ajudar vocês nas suas aventuras de escrita quando não souberem usar Cypher. Aqui dentro também há uma pasta solutions, que eu disse para ele não consultar. Então, se ele errar, vocês podem simplesmente copiar da pasta solutions se ficarem um pouco perdidos ou não quiserem esperar o modelo terminar tudo. E então, basicamente, quando isso estiver pronto, vou me livrar desta coisa boa…
1:07:37 Posso abrir uma nova janela. Agora posso começar a executar meu script de outline. Vou copiá-lo. Volto aqui. Isso vai retornar o outline inteiro, então vai demorar um pouco. Vai ficar enorme. Olha, retorna tudo, o que não é muito útil. Mas o que você pode fazer com isso é
1:08:11 dizer: “Desça até o nível um ou o nível dois, ou o que for.” E, quando fizer isso, o agent pode usar essa informação, e então posso dizer algo como: “Desça até o nível mais profundo.” Em vez de mostrar só os itens de nível mais alto, ele vai mostrar todas as páginas dentro de cada um. E outra coisa legal que posso fazer é pegar um destes. Digamos, aquele. E então posso dizer: “Faça para…”
1:08:41 Então acho que só coloco isso no final. É. E aí ele vai me mostrar, só para aquele documento, quais são as… Vejam, só para essa coisa do Ridgeline, seja lá o que for: quais são as diferentes seções e as coisas às quais ela está vinculada? E aí eu penso: “Ah, está vinculado a isto. Vou conferir essa página.” Certo? Então posso dizer: “Ah, posso ir aqui.” E aí posso conferir aquilo. Dá para ver como isso pode ser útil para um agent, em vez de apenas fazer busca vetorial, porque você pode percorrer esses documentos de uma forma intuitiva. E
1:09:13 é um pouco difícil de ver, mas, se eu diminuir, vocês vão conseguir. E aí posso fazer o agent percorrer e obter todas essas conexões diferentes. Isso é muito legal porque o agent que realmente consome isso não precisa entender Cypher. Ele só precisa entender a aparência de um índice, algo que muitos agents já sabem fazer, porque é uma tarefa bem fácil para uma pessoa. Certo, vamos ver o que vem a seguir aqui. Hum…
1:09:43 Também há uma consulta de busca. Não tenho busca vetorial aqui, mas tenho busca de texto completo. Então, vamos usar com a busca de texto completo o mesmo padrão que usamos antes, que eu mostrei para o outline. Isso vai permitir que ele pesquise os títulos e o conteúdo de cada documento PDF e seção. Posso voltar à sessão na nuvem que eu tinha e dizer: “Ei, use a skill de Neo4j Cypher.”
1:10:16 E então tenho um contrato de especificação dentro de search. Neste caso, não tenho um documento inteiro sobre isso, como tinha para outline, porque é um pouco mais simples. Posso pedir para ele fazer isso. Os documentos de especificação… Vejam, ele fez a pequena alteração ali. Dentro de skills, posso abrir search. E eu tinha isto construído a partir da especificação. E sim, você pode fazer a alteração.
1:10:48 E, depois que ele fizer essa alteração, espero que ela apareça aqui rapidinho. Isso. Certo, ele fez aquilo e não sei por que não está atualizando aqui, mas, se eu abrir de novo, talvez… Mas, basicamente, o que ele… Por que você não… Esperem aí. Talvez eu só não saiba usar…
1:11:22 Talvez seja só porque é uma referência a um elemento irmão. Ele atualizou, sim, o documento de search. Mesmo padrão. Dei a especificação para ele e ele a atualizou. Ele atualizou no Cypher aqui. Eu é que sou um idiota e não sei ler. Dá para ver que ele atualizou aqui: basicamente, está usando busca de texto completo aqui e também está fazendo essa outra coisa legal que vou mostrar daqui a pouco. Basicamente, você pode fazer uma busca de texto completo
1:11:52 e então posso pedir os principais K documentos. Se eu voltar à minha janela aqui — e alguém pode me chamar a atenção nos comentários se estiver difícil demais de ver. Prometo que vou tentar ler. Posso pedir, e ele me mostrará meus principais documentos encontrados com esse URI. Na verdade, são seções. E posso aumentar o K de resultados para
1:12:24 um número maior, como 10, e então ele me dará 10 resultados. Da outra vez, eram quatro. Outra coisa que posso fazer aqui é dizer: “Faça uma busca, mas limite-a a algum lugar dentro desta biblioteca.” A biblioteca inteira é hierárquica, porque tudo são essas relações de contenção, certo? Uma coisa que pode ser útil é restringir a busca para que fique abaixo de recalls.
1:12:55 Então digo “abaixo de recalls” e ele só me mostra documentos que estão abaixo da subseção de recalls da biblioteca. E você pode fazer isso com qualquer URI. E, de novo, não uso busca vetorial principalmente não porque não goste dela, mas porque cada vetor é diferente e os provedores de embedding não são compatíveis entre si. Então, para facilitar o uso, simplesmente não implementei busca vetorial. É fácil colocá-la aqui, e funcionaria sem problema. É só que, do ponto de vista da interoperabilidade, não quero
1:13:28 ter que lidar com isso: algumas pessoas querem usar modelos open source, outras querem usar Gemini, outras querem usar OpenAI, outras querem usar Anthropic, e aí você acaba precisando criar uma opção para cada chave diferente. Então, esta opção é fácil porque é só busca de texto. E, para a verificação de compreensão, a primeira resposta é 183 e a segunda, 985 documentos. Para responder a esta pergunta — que, basicamente, se você estivesse fazendo isso sozinho, seria uma pergunta de aprendizagem para ajudar você a avançar para a próxima
1:14:01 etapa —, volte para… Deixe-me mover isto para cá para eu não me confundir. Volte aqui e diga: “Ei, conte o número de documentos e seções que tenho.” Só para confirmar: 183 e 985. E esses são os mesmos números que temos aqui. Então, é só uma verificação rápida de consistência. E acho que, neste caso, as próximas partes podem ser ignoradas, na verdade, porque
1:14:34 muita coisa aqui é só uma explicação passo a passo de como o Cypher funciona internamente. E depois há alguns exercícios opcionais com a biblioteca. Então, estas duas seções aqui — navegando pela estrutura e exercícios opcionais com a biblioteca — podem ser ignoradas por enquanto. Talvez eu pare aqui e veja se fazemos uma pequena pausa, porque sinto que falei sobre muitas coisas diferentes. Vamos ver se temos outras perguntas e fazer uma rápida checagem de como está todo mundo
1:15:05 na sala. >> Ótimo. Parece bom. Vamos ouvir vocês no chat. Avisem se estão com dificuldade em alguma coisa, se estão acompanhando o que estamos fazendo ou se precisam repetir algum dos exercícios. Quanto tempo dura a pausa? Bom, talvez alguns minutos. Vamos tentar responder a algumas perguntas. >> Às perguntas, isso.
1:15:37 >> Sim, podem falar. E avisem se vocês não estão acompanhando o que o Zach explicou. Tem uma pergunta que vi e que provavelmente poderíamos discutir, enviada um pouco antes. A pergunta era: precisamos documentar apenas os nós estruturais, e não os nós de conceitos do domínio?
1:16:10 Então. >> Sim, eu falei um pouco sobre isso no começo. Para começar, não estou usando nós de conceitos do domínio. Foi uma decisão explícita minha por dois motivos. Um deles é que é fácil fazer o que estou fazendo agora. Então, para quem está começando a trabalhar com a camada de conhecimento, esta etapa é simples e permite começar muito rapidamente.
1:16:43 O segundo ponto é que, para o tipo de exemplo que estamos vendo, um agent de IA já tem, em grande medida, a capacidade de inferir entidades e conceitos presentes na sua documentação. Então, se você tiver uma forma de o agent navegar por essa documentação e pesquisá-la com eficiência, em teoria ele consegue fazer boa parte do trabalho sem entidades explícitas. Claro que isso começa a deixar de funcionar quando, bom, agora eu… agora tenho uma quantidade enorme de
1:17:16 dados e uma das coisas interessantes neste grafo é que, na verdade, temos dois grafos desconectados. Então, temos um grafo da camada semântica e um grafo de documentos. Se eu fosse olhar de fato como isso está, qual seria uma boa consulta para isso? Vamos fazer uma correspondência em que P é… Vou trazer todos os dados. Que tal? Então, depois que eu acertar meu Cypher, vou retornar tudo
1:17:46 e corrigir a minha ortografia. Isso não vai… Isso não vai travar. Retorne o grafo inteiro e use um layout de força. Então, vejam… Vejam como está esse grafo agora. Temos, hum, e ele ainda limita a quantidade de documentos retornados, acho. Aqui está meu grafo de documentos. E aqui embaixo está minha ontologia da camada semântica
1:18:17 do grafo. Não há relações entre os dois. Estou deixando meu agent inferir as relações entre eles. Extrair conceitos de domínio ajudaria bastante se eu quisesse fazer a ligação entre esses dois grafos, o que provavelmente seria inteligente em algum momento. Conforme obtenho cada vez mais dados e, sabe, você pensa nisso: se eu estivesse trabalhando com algo bem técnico, como especificações de carros e conhecimentos de engenharia, talvez eu não quisesse depender da compreensão geral e do
1:18:49 pré-treinamento do meu agent para fazer isso. Vou querer relações aqui. Então, esses conceitos de domínio serão úteis conforme você obtiver mais dados e o conhecimento do domínio ficar mais especializado, para conectar e conciliar tudo isso. Na escala em que estou trabalhando, consigo me virar com isso e deixar meu agent inferir as conexões entre eles. >> Legal. >> Então, sim, foi uma resposta longa, mas espero que ajude. Vamos… >> Devemos… Sim. Você, você diz.
1:19:19 >> Bem, podemos responder a mais uma ou duas perguntas e depois acho que devemos seguir em frente. >> Certo. Acho que a maioria delas segue caminhos um pouco diferentes, então vou ver se há alguma mais próxima do que temos aqui. Há uma pergunta: existe uma maneira de documentar e visualizar o modelo de dados ou a camada de conhecimento? Acho que o que você acabou de mostrar responde. >> Sim, quer dizer, temos a visualização e o navegador aqui. Você pode chamar schema.visualize
1:19:52 aqui. Por que está dizendo que estou errado? Visualização, é por isso. Escrevi errado. E você pode ver como é o seu modelo de dados. Então, dá para ver de novo: aqui está o modelo de dados do Neo4j. Aqui está meu modelo de dados de documentos no banco de dados. Também, dentro da Neo4j CLI, vou adiantar e mostrar rapidinho. Hum,
1:20:24 você pode fazer coisas assim, em que eu posso chamar o esquema. >> Uhum. >> Então, vou voltar à minha tela aqui. Digamos: “Ei, você pode me mostrar o esquema?” E ele vai me dizer: “Estas são minhas restrições.” Por exemplo, IDs únicos. Estou diminuindo o zoom só para que apareça direito no meu terminal. Mas também dá para gravar isso em JSON. E depois tenho meus índices.
1:20:56 Tenho meus caminhos de relacionamento. Todas essas coisas. E meus nós. Então, há diferentes maneiras de obter esses esquemas e visualizá-los, se era isso que você queria saber. >> Certo. Legal. >> [ofega] >> Vamos deixar as outras perguntas para depois, para pelo menos termos tempo de con-cluir o que queremos mostrar neste workshop. >> Certo. Ótimo. Vou passar agora para a próxima forma. Esta será a forma de tema, que talvez seja uma das minhas formas favoritas. Não que eu tenha uma favorita, mas gosto dela porque
1:21:28 usa graph data science. Eu costumava ser… Eu era a primeira pessoa de marketing técnico de graph data science da nossa equipe, então gosto quando posso mexer com graph data science. Vou trazer outra visualização do grafo aqui. Vou dizer: “Traga todos os links de relacionamentos.” Isso acontece quando um documento tem um link para outro documento. E o interessante é que, quando você olha para esse grafo depois que ele carregar — porque estou trazendo mil itens, talvez demore um pouco —
1:21:58 você vai começar a ver diferentes clusters se formando no grafo. Por exemplo, tem essa coisa aqui, certo? Parece estar centrada nesse negócio de ABS. E sensores, certo? E depois tem outras coisas aqui. Módulo de controle. O que é esse aqui? Módulo de controle de comunicação, de novo, neste nó. Então, você começa a entender que, conforme agrega cada vez mais
1:22:30 dados, os links entre os documentos começam a indicar padrões subjacentes mais profundos. Acho que isso é bem simples. Acho que entendemos isso de certa forma, do ponto de vista dos grafos. Então, o que queremos fazer é descobrir como entender o significado desses clusters e, algo importante, imagine que você seja, sei lá, vice-presidente de uma oficina automotiva ou algo assim, ou esteja preparando um relatório para a alta liderança e queira saber: quais são os principais assuntos que estamos documentando? Como eles se relacionam
1:23:03 com o que está acontecendo na prática e com o que está sendo consertado na linha? Há algum ponto em que esteja faltando documentação? Como fazemos isso? Ou até mesmo se for uma questão de segmentação de clientes; dá para imaginar todo tipo de uso para esse tipo de clustering. Queremos encontrar uma maneira de fazer isso. E queremos encontrar uma forma simples de dar ao nosso… Isso vai ser difícil de visualizar por causa da maneira como esta janela está sendo renderizada, mas, basicamente, quero criar esses temas, que posso nomear dentro do
1:23:38 grafo. Então, o que estou fazendo aqui é pensar: se tenho todos esses documentos, como posso agrupá-los? E, em vez de fazer algo — e, de novo, podemos usar um modelo de IA para criar um nome específico do domínio, inferido de cada grupo —, o que vamos fazer aqui é simplesmente identificar os principais documentos-alvo compartilhados e os documentos mais vinculados dentro de cada um desses
1:24:08 clusters que identificamos. Isso, de certa forma, vai nos dar um nome inferido, porque vamos ter, sabe, coisas relacionadas à comunicação neste grupo, outro sobre freios e mais um sobre sensores de pressão. São esses os documentos mencionados. Então, mesmo sem um processo muito sofisticado que faça essa nomeação por sentimento, só usando os próprios documentos, conseguimos inferir bastante coisa, criando
1:24:43 essa forma de novo para nosso agent analisar. E vamos fazer isso com um algoritmo de grafo chamado Leiden. Nesse algoritmo de grafo, temos uma maneira de definir o quanto essas diferentes comunidades ou temas serão interligados. E isso é… condutância. Eu sempre digo condutância, mas acho que é… onde está? Vou pronunciar aqui em algum lugar. Hum,
1:25:14 sim, condutância. Basicamente, é uma medida de quantos links há entre os clusters em comparação com quantos há dentro de um cluster ou tema. E podemos usar isso para medir, de certa forma, o desempenho do algoritmo ou o quanto os clusters se formam naturalmente no grafo, só para começar. Então, temos um documento Markdown de formato de temas. No mesmo espírito de programação agêntica, vou aumentar o tamanho aqui de novo.
1:25:51 Temos nosso documento de formato de temas. E nele descrevemos o formato que queremos, os tipos de coisas que queremos nos cabeçalhos, o número de documentos, o número de grupos e temas, referências cruzadas compartilhadas, como queremos definir a coesão — por exemplo, interligados de forma estreita, moderada ou frouxa —, os principais alvos compartilhados e os itens mais vinculados.
1:26:23 O próprio algoritmo vai gerar IDs de tema para cada nó. É assim que funciona o algoritmo de detecção de comunidades. E vou mostrar como a consulta fica quando nosso modelo de IA efetivamente nos ajuda a escrevê-la. Então, aqui está. E, no arquivo de scripts, da mesma forma, temos nossa espécie de especificação, certo? Construir a partir da especificação. Vamos ver comandos aqui, como GDS graph project e algumas dessas coisas.
1:26:54 As chamadas do Leiden. Acho que o que estamos fazendo com base na especificação… Acho que a dica aqui é: como criamos a projeção do grafo, basicamente? E vamos dar um pouco mais de orientação sobre como chamamos o algoritmo Leiden. E a métrica de condutância… condutância, nossa, a métrica de condutância.
1:27:24 Eu disse certo da primeira vez. E, basicamente, o que vamos fazer aqui é executar esse algoritmo Leiden, que vai dizer: “Como posso agrupar os nós com base nesses links?” E depois vamos gravar isso no grafo. É disso que se trata boa parte disso. E algumas dessas consultas são apenas a lógica de como extraímos isso de volta do grafo para criar a visualização. E agora me lembrei por que temos a especificação aqui, depois de falar sobre isso.
1:27:55 O que queremos fazer aqui é que os links ficam entre seções. Então, quando mostrei este grafo — não este, mas o que mostrei antes —, se eu olhar os tipos de nós aqui, há seções. Acho que queremos agregar isso no nível do documento. Desse jeito, o grafo fica mais limpo. E queremos que seja um grafo bipartido ou um grafo não direcionado. Ou não, queremos que seja não direcionado?
1:28:29 Agora estou falando demais. Os links para o destino juntam as duas extremidades no documento ao qual pertencem. Então, agregamos tudo no nível do documento. Assim, não ficamos com documentos que têm várias seções ligadas a alguma coisa, porque fica muito mais limpo se agregarmos o grafo no nível dos documentos e olharmos apenas para os links entre documentos. E então fazemos… Sim, tipo não direcionado. Então, fazemos a projeção não direcionada, o que
1:29:00 basicamente significa que, quando um documento tem um link para outro, é como se fosse um link bidirecional. Isso ajuda o algoritmo Leiden a funcionar com mais eficiência, do jeito que deveria, em vez de ter uma relação direcionada. Basicamente, estamos dizendo que, se o documento A tem um link para o documento B, o documento B é tão relacionado ao documento A quanto o documento A é relacionado ao documento B. Não é que o documento A seja relacionado ao documento B, mas o documento B não seja relacionado ao A.
1:29:31 Vou parar por aqui. Provavelmente falei demais sobre isso, porque não quero transformar isto num curso sobre projeções de grafos e grafos não direcionados versus grafos direcionados. Talvez eu esteja aprofundando demais. Mas, se houver alguma pergunta sobre isso, posso explicar um pouco mais. Então, se eu continuar, o que vou fazer é ligar isso aqui. Então,
1:30:02 vou voltar ao meu agent e pedir para ele criar isso de novo. Se você reparar, estou dizendo: “Ei, use a skill Cypher, mas também use a skill Graph Data Science ou GDS.” Ela é responsável por executar o algoritmo Leiden e fazer essas projeções. E você vê que ele acabou de fazer a projeção aqui. Ele conseguiu fazer a agregação dos documentos. Ele apenas associa as seções aos documentos. E depois fez essa coisa de dividir URI.
1:30:36 Isso. Vou deixá-lo executar por um instante e vou copiar basicamente o que agora será necessário para executar esta consulta de temas. Parece que ele fez isso direito. E, se funcionar, podemos ir ao nosso script bash aqui — ou, melhor, ao nosso terminal bash.
1:31:09 E podemos executar themes. Então ele vai trazer o resultado de volta. E teremos nossa visualização aqui. Agora vemos os temas, basicamente: 13 temas em nossos documentos. Temos estas coisas de BCM e comunicação. As coisas dos freios são T2. Tema três, ou T3: coisas de sensor de pressão. Aqui estão os documentos envolvidos. E é só continuar descendo: bobinas de ignição, conversor catalítico, sensores de oxigênio.
1:31:43 Então, se você entende um pouco de carros, deve fazer sentido por que essas coisas estão agrupadas dentro dos mesmos grupos. Assim, entendemos os temas presentes em nossos documentos. E o que podemos fazer com isso… Ah, também podemos alterar o… Não vou executar isso — quer dizer, posso. Há um parâmetro gamma que controla a granularidade, e você pode aumentar a
1:32:16 granularidade. Isso não vai fazer uma diferença enorme neste conjunto de dados. Mas, basicamente, se eu aumentar gamma para dois — acho que o padrão é um —, vou obter mais comunidades. Isso pode ser útil; às vezes, você quer ajustar esses algoritmos. Sim, então ele me deu 14 temas em vez de 13. Não é uma diferença enorme aqui, mas há maneiras de ajustar esses algoritmos.
1:32:48 Acho que preciso voltar ao pessoal da Graph Academy e corrigir isto. Acredito que cada documento deveria ter um ID de tema único. Se não for o caso, talvez eu tenha que voltar e corrigir. Mas, para responder a esta pergunta e continuar, basta dizer que a maioria dos documentos tem um ID de tema e está agrupada em dois ou mais temas. Acho que a regra deveria ser, na verdade, que cada tema tem um ID único — cada documento tem um ID de tema único.
1:33:21 Mas também pode não ter um ID de tema. Então, há… Ah, não, espera. Agora entendi a pergunta. Estou confundindo as relações de um para muitos e de muitos para um. Esqueça tudo o que estou dizendo. Os IDs de tema serão IDs de comunidade. Então, há 13 IDs de comunidade. Cada documento terá um único ID de tema. Ou poderá ter um ID de tema nulo se não tiver sido possível colocá-lo em um grupo. Essa é a resposta correta para esta pergunta. A é o que você diria para
1:33:52 continuar para a próxima parte. E o que acontece depois? Há algumas perguntas legais que você pode experimentar a partir daqui. Por exemplo, onde os problemas se concentram? Posso acessar a visualização do meu agent e fazer esta pergunta: “Ei, onde os problemas se concentram?” Às vezes, com alguns desses modelos menores, preciso lembrá-lo de usar a escala de correção automática. Caso contrário, ele vai tentar interpretar que você está falando de
1:34:27 issues do GitHub ou algo assim. E vai saber que deve usar os temas aqui para resolver isso. Ele vai, basicamente, analisar os diferentes temas, reunir todas as informações e depois ver como eles se conectam, entre outras coisas, dentro do warehouse. Então, vai iniciar a parte do warehouse. Vai apenas analisar as ordens de serviço, que é o que está fazendo agora. Isso é bem legal de
1:34:58 ver. Vamos fazer mais perguntas desse tipo à medida que avançarmos no curso. E ele consegue encontrar, por exemplo, que, para a pergunta original — onde os problemas se concentram? —, eles se concentram em reparos de bobinas de ignição e falhas de ignição. Isso vale para os retornos, e o volume não se concentra em nenhum lugar específico, porque cada um dos 15 códigos de diagnóstico que consultei tem cerca de 300 ordens de serviço. Então, ele chegou a esse resultado analisando os temas e depois voltando ao warehouse para executar uma consulta SQL
1:35:29 uma consulta para recuperar os diferentes códigos e coisas do tipo que se encaixam nesses temas. Então, é meio legal a forma como ela consegue conectar esses dois conjuntos de dados. E, a partir daí, vou parar por aqui rapidinho, porque acho que, de novo, nesses próximos tópicos vamos entrar bastante em Cypher, e não quero fazer isso de verdade, dado o tempo que temos neste curso. É uma prática meio opcional. Então, vou parar por aqui bem rápido. Vamos reservar alguns minutos para perguntas e depois seguir para nossas próximas duas
1:36:02 aulas. Uma delas vai ser bem curta, tipo 5 minutos, e depois vamos passar a maior parte do tempo na última aula. >> Parece ótimo. Obrigado, Zach. Tem uma pergunta que surgiu algumas vezes, ou melhor, um tema que apareceu algumas vezes: quais seriam os desafios para adotar o workflow que implementamos ou mostramos aqui hoje em outro contexto, como telecomunicações, cadeia de suprimentos ou qualquer outro caso de uso? Quais seriam?
1:36:35 Sabe, como isso funcionaria se vocês tivessem diferentes… >> Bom, sim. Eu diria que tudo o que estamos fazendo aqui, se vocês olharem para nosso schema, não é um schema específico de um caso de uso, certo? Basta ver como esses nós estão rotulados. Temos documentos, bibliotecas e seções. E depois temos os elementos do schema. Então, se vocês olhassem apenas para esse schema, ele poderia ser usado em telecomunicações, cadeia de suprimentos, serviços financeiros ou qualquer outra coisa,
1:37:08 certo? Então, ele pode servir como ponto de partida para praticamente qualquer caso de uso. Dito isso, seus dados precisam estar em uma certa condição para que isso funcione logo de cara. Vocês precisam de documentos relativamente bem estruturados para que essa hierarquia de documentos e links funcione corretamente. Da mesma forma, precisam de algo como um data warehouse ou algum tipo de banco de dados relacional para isso funcionar.
1:37:40 Colocar os dados nesse formato pode ou não ser um desafio, dependendo de onde vocês estão começando. Mas o ótimo disso é que a maioria dos projetos começa com algum tipo de dados estruturados e/ou não estruturados. E, se vocês puderem começar com algo parecido com isso e ampliá-lo para telecomunicações ou cadeia de suprimentos — e talvez seja necessário incluir outros elementos —, por exemplo, na cadeia de suprimentos talvez seja preciso importar alguns dados estruturados. O mesmo vale para telecomunicações: talvez, em algum momento, vocês queiram incluir um gêmeo digital da rede elétrica
1:38:11 lá. Mas pensem nisso como uma espécie de base, um conjunto inicial de ingredientes sobre o qual vocês podem construir e que podem ampliar. Talvez vocês usem metade do schema, ou 70% dele, e tentem encaixar algumas das outras partes de vocês. Espero que faça sentido. >> Sim. Legal. Talvez mais uma pergunta. >> Sim. >> Sim. Outra pergunta é se a camada semântica se destina a gerenciar documentos ou a gerenciar dados
1:38:44 em uma malha de dados. Por exemplo, sobre endpoints de produtos de dados; e, nesse caso, como os agents devem consumir os dados: por meio desses endpoints de API ou por uma conexão direta com o grafo? >> Essa é uma boa pergunta. Se entendi corretamente, a pergunta é: “Não quero acessar os dados por SQL; quero acessá-los por meio de algum outro microsserviço ou endpoint”. >> Isso. >> Porque os dados são expostos de outra forma, por meio de uma API. Ryan, você sabe se já temos algo no Neo4j que
1:39:18 faça um mapeamento para uma malha de dados ou para endpoints de API? Sei que temos um grafo virtual para alguns produtos da Microsoft, mas… >> Não sei. Não que eu saiba. Temos um servidor MCP que os agents podem usar, e esse é o padrão que costumo ver. Mas não temos algo como uma malha de dados, o que seria uma ótima adição. >> Sim. Sim, acho que ainda não temos isso, mas seria uma ideia interessante. E, se vocês… sim, eu adoraria ver algo assim. Pensamos bastante nessas coisas,
1:39:50 com bastante frequência. Mas, sim, seria uma ótima adição. Acho que ainda não temos isso aqui. >> Parece ótimo. Certo. >> Obrigado. >> Legal. Certo, só temos 20 minutos. Vamos ver se consigo garantir que vamos dar conta de tudo. Não vou passar muito tempo na próxima seção, porque já conversamos um pouco sobre ela: o client do Neo4j que estamos usando. Já mostrei o shell desse client. É muito fácil de instalar. E ele não funciona apenas com um client. Também dá para usá-lo com Codex e com vários tipos de agent harness. Vocês começam com o script Bash, e ele detecta automaticamente o harness que vocês estão usando. Acho que em algum lugar aqui ele mostra todos os clients compatíveis. Talvez no início rápido. Essa documentação mostra em algum lugar todos os agent harnesses compatíveis. Mas são vários,
1:40:25 são muitos. Basicamente, todos. Isso permite executar Cypher diretamente no shell. Por exemplo, quando eu estava na minha tela, podia escrever minhas consultas Cypher no shell e receber os resultados. Então, faço uma consulta rápida em Cypher e ele me retorna os resultados. Eu
1:40:58 também posso formatar isso como JSON ou de outra forma. E ele também permite obter informações do schema, como mostramos antes. O ótimo disso é que agora o agent pode acessar esse CLI. Além de acessar esse CLI e entender como usar a skill, ele também pode fazer coisas como iniciar uma infraestrutura para vocês. Por exemplo, vocês podem gerenciar o Aura pelo CLI. Podem adicionar
1:41:28 bancos de dados, obter informações sobre eles e desligá-los ou iniciá-los. Outra coisa muito importante é aquilo de que falei antes: obter essas skills. O desenvolvimento orientado por especificações que mostrei antes foi feito por meio daquele Neo4j CLI e do pacote de skills que ele instalou. Se eu voltar lá, certo? São todas essas skills. Por exemplo, se vocês olharem a skill do GDS, vão encontrar esses arquivos SKILL.md, que dizem ao agent como usar a skill,
1:42:00 o que verificar. Eles incluem referências ao que há de mais recente. Assim, em vez de o agent usar Cypher de três anos atrás, vindo de algum tópico do Stack Overflow que ele encontrou, sei lá, de 2021 ou algo assim, ele vai usar todo o nosso Cypher novo e tudo o que vocês precisam para trabalhar com muita eficiência. Então, recomendo muito que, se vocês estiverem fazendo qualquer tipo de programação agêntica, deem uma olhada no Neo4j CLI, porque
1:42:32 estamos usando aqui, e ele ajuda vocês a usar o Neo4j com muita rapidez. Era tudo o que eu queria dizer sobre o Neo4j CLI, dado o tempo que temos. Então, a última coisa que vamos fazer é juntar tudo isso para responder a perguntas mais complexas. Se vocês avançarem no curso até esta última aula, algumas das perguntas que estamos fazendo — e vimos um pouco disso no que mostrei antes — são, por exemplo: se perguntarmos o que conserta um determinado problema em um carro, o sistema vai consultar a documentação. Depois, vai precisar consultar as peças candidatas. Essas duas coisas estão em partes diferentes dos nossos dados: uma fica nos nossos documentos, e a outra fica no data warehouse, na parte dos dados estruturados. E depois ele precisa retornar a resposta à pergunta com evidências. O que estamos tentando fazer é
1:43:03 usando aqui, e isso ajuda você a usar o Neo4j muito, muito rapidamente. É tudo o que quero dizer sobre o Neo4j CLI, dado o tempo que temos. Então, a última coisa que vamos fazer é começar a juntar tudo isso para responder a perguntas mais complexas. Então, se você avançar pelo curso até esta última lição, algumas dessas perguntas que estamos fazendo — e vimos um pouco disso em
1:43:33 algo que mostrei antes — são do tipo: se perguntarmos, por exemplo, que conserto resolve determinado problema em um carro, o sistema vai consultar a documentação. Depois, vai precisar consultar as peças candidatas. Essas duas coisas estão em partes diferentes dos nossos dados. Uma está nos nossos documentos, e a outra está no data warehouse, na parte dos dados estruturados. Então, ele precisa retornar a resposta a essa pergunta com evidências. E o que estamos tentando fazer é
1:44:05 aqui é basicamente manter esse processo honesto. E desenvolvemos uma skill inteira dentro deste workshop. Se eu acessar a skill para fazer isso, você pode ver que há certas coisas que estou dizendo para não consultar, só por causa do curso, como não olhar nossas soluções para responder às perguntas, certo? Ela descreve o grafo,
1:44:35 descreve o esboço, a ferramenta de busca e a ferramenta de temas. Explica, basicamente, como usar diferentes aspectos do banco de dados. Essa mentalidade de priorizar as formas que estamos usando. Alguns exemplos ou modelos do que ela precisa considerar em certos tipos de perguntas e de como respondê-las. E algumas coisas de bom senso, como fundamentar suas respostas, usar evidências, tudo isso
1:45:08 e coisas desse tipo. E ela traz essas orientações para a busca e os temas mencionados antes. Então podemos prosseguir. Vamos continuar. Podemos começar a fazer essas perguntas e pedir que ela percorra os dois lados. A primeira é sobre um VIN. Vou inseri-lo e deixar que ela responda, porque às vezes leva um minuto. Enquanto ela processa, vamos falar sobre a pergunta. Aqui eu digo: “Ei, para este número VIN com um determinado código, qual foi o conserto em veículos semelhantes?
1:45:42 “ Para obter essa informação, ela consulta algo no banco de dados. Depois, vai precisar procurar consertos para veículos semelhantes. E terá que explicar as etapas e as formas que usou. Estou dizendo para ela não usar o cliente Neo4j, principalmente porque, às vezes, ela tenta contornar nossos procedimentos, como os procedimentos de busca, temas e esboço, e simplesmente usar o cliente Neo4j por conta própria. Ela já retornou uma resposta.
1:46:12 E o que eu gosto de fazer é olhar as etapas que ela usou. Neste caso, ela pesquisou o problema em nossos documentos. Usou a forma warehouse para consultar as informações do veículo. Filtrou por um código específico e, em seguida, fez uma segunda busca neste boletim para confirmar a supressão e o procedimento de reparo. Há uma peça que, basicamente, substituiu outra. Aparentemente, achavam que ela estava com defeito ou que tinha sido retirada de uso, algo assim. A IC 2042B vem depois da IC 2042A.
1:46:49 O Sonnet está muito rápido hoje, o que é ótimo. Normalmente, estou acostumado a esperar um pouco mais quando uso o Opus. Enfim, ela pesquisou os dois lados do grafo usando nossa camada de conhecimento. Também podemos fazer perguntas mais complicadas. Por exemplo, aqui temos uma afirmação que tenta provar uma negativa. Neste caso, estamos fazendo uma pergunta de nível mais alto, que alguém preparando um relatório faria, não necessariamente alguém que trabalha na
1:47:21 linha de produção, como um mecânico poderia perguntar. A pergunta é: há divergências entre nossos procedimentos documentados e os problemas reais em campo? Que documentação está faltando e que documentação não está sendo usada? Essa é uma pergunta interessante se você estiver pensando nisso do ponto de vista da gestão: temos toda a documentação de que precisamos? Estamos conduzindo nossos negócios com eficiência, basicamente?
1:47:51 E talvez esta leve um pouco mais para ser processada. Enquanto isso, vou fazer outra coisa, porque só temos 10 minutos e não quero prolongar demais o workshop. Aqui está outro tipo de pergunta que pode ser interessante, semelhante à que vimos antes: quais são os padrões comuns em nossos boletins e recalls, e quantos de nossos carros são afetados por esses padrões? E boletins e recalls, certo, são como
1:48:22 problemas com carros, com veículos. Então, é uma pergunta do tipo: quais são os problemas e quantas das ordens de reparo que recebemos realmente apresentam esses problemas? E agrupe-os em temas comuns, para não tratar cada problema individualmente. Então, talvez eu abra este próximo terminal fast sec path bash e ative o modo automático
1:48:53 com um hífen extra ali, e faça esta pergunta. Também estamos no… Deixe-me só confirmar que estamos no Sonic. E vou iniciar o processamento da pergunta. Algumas dessas perguntas são mais complicadas e simplesmente vão levar mais tempo. Tudo bem. Quer dizer, esperávamos isso. Eu já esperava desde o início. Então, se levar alguns minutos para essas respostas aparecerem, tudo bem.
1:49:25 Mas o que está acontecendo aqui é que ela está fazendo buscas mais exaustivas e percorrendo os dois lados do nosso grafo para conseguir encontrar essas respostas. Vou… Bem, talvez leve um minuto para processar. Então, vamos ver se há outra coisa de que possamos falar enquanto isso. Estamos praticamente no fim do workshop. A solução correta para isso, na verdade, apareceu na primeira resposta.
1:50:00 Estávamos vendo isso na resposta. Há uma bobina de ignição revisada que ela deve usar para corrigir esse problema. Essa é a resposta à nossa primeira pergunta, aliás. Então, para esta, é a B. Sobre provar uma negativa, acredito que estamos esperando essas respostas aparecerem. Na verdade, uma delas chegou. Esta era a pergunta sobre divergências entre nossos documentos e procedimentos e os problemas reais em campo, e sobre a documentação que está faltando. Aqui, o que ela fez foi
1:50:34 ir ao warehouse e executar algum SQL para enumerar todos os códigos. Depois, optou por fazer uma busca com search.py. E há algumas limitações nisso, que são interessantes. Eu queria muito que ela usasse outline.py. Como você pode ver aqui, ela não conseguiu enumerar os códigos que aparecem nos documentos, mas não no warehouse. A busca não consegue listar isso; outline.py mostra os títulos dos documentos, não os códigos que aparecem dentro deles. Então, este é um exemplo interessante de
1:51:08 como eu queria muito que ela usasse outline.py para conectar os documentos ao que estava em nossas ordens de serviço. Mas ela não fez isso aqui porque os códigos dos documentos não faziam parte dos títulos. Para quem perguntou: “Bem, quando devo extrair nodes dos meus documentos?”, este seria um ótimo caso para fazer isso, certo? Porque aí você teria a capacidade de navegar pelas conexões entre, neste caso, suas peças específicas, em vez de simplesmente usar a busca, que era realmente o que eu pretendia. Mas dá para ver aqui
1:51:42 como a formatação dos dados é muito importante. E ela ainda consegue fazer isso consultando o warehouse de dados e depois realizando a busca. outline teria sido melhor porque, em vez de fazer uma busca exaustiva, ela poderia basicamente navegar entre todos os documentos e links. Isso teria feito a resposta chegar muito mais rápido. Mas dá para ver a resposta que ela deu aqui. Há divergências nos dois sentidos. O caso mais claro são os dois códigos de diagnóstico de alto volume que
1:52:13 a biblioteca não menciona de jeito nenhum: 335 e 340. E, na verdade, se voltarmos à nossa pergunta, ela enumerou os códigos de campo dos agentes da biblioteca de documentos: qual par de códigos de falha está causando problemas em campo, mas não tem nenhuma documentação na biblioteca? É este aqui. E sim, isso concluiria a lição, se… Mas, para a última pergunta, já que ainda temos alguns minutos, vou passar às perguntas de vocês depois disso.
1:52:44 Temos: quais são os padrões comuns entre nossos boletins e recalls, e quantos dos nossos carros são afetados por isso? Ele terminou de retornar a resposta. E meio que já respondemos a essa pergunta antes, acho, mais ou menos quando estávamos naquela seção sobre temas. Mas, basicamente, aqui vemos que ele retornou 13 famílias de reparo em nível de sistema. Então, esses são os temas diretamente. Os boletins e recalls repetem um padrão. Um único componente nominal falha. Os documentos mostram qual peça falhou e
1:53:16 muitos dizem para revisar a peça e substituí-la. Pelo menos 821 veículos da frota, ou 48%, têm um reparo que usa uma das quatro peças substituídas abaixo. E então ele lista essas peças aqui. Parte disso tem a ver com a forma como sintetizamos, porque eu sintetizei para destacar bastante essa substituição por uma peça mais nova aqui. Mas dá para ver que ele identifica, tipo: “Ei, temos um monte de problemas com essas bobinas de ignição e correias de distribuição.” E eles aparecem meio que
1:53:51 dentro daquele tema que os reúne. Então, para comparar, as peças revisadas têm poucas recorrências. As outras famílias seguem o mesmo padrão, com uma taxa de recorrência menor e menos veículos. Então, isso está dizendo que a família — essas são as famílias — e, abaixo delas, todas as peças e os reparos em veículos. O formato dos temas abrange toda a biblioteca, em todas as perguntas sobre os diferentes recalls e
1:54:21 boletins. Então, basicamente, o que ele faz aqui, em resumo, é identificar esses temas e depois os reparos que se encaixam neles. Gostaria que ele visualizasse isso um pouco melhor, porque está meio que dizendo… não está dizendo a que tema eles pertencem. E pode ser por eu estar usando Sonnet em vez de Opus. Mas ele consegue identificar, por exemplo, que as bobinas de ignição são uma área importante, um tema importante dentro dessa oficina ou dessa série de oficinas. Enfim, essa foi a oficina.
1:54:56 Há outra seção aqui que aborda, basicamente, o fato de que é possível portar esse padrão não só para o Databricks, mas para praticamente qualquer data warehouse. Não vou passar por ela aqui, porque boa parte é mais conceitual. Então, só para reforçar o ponto: isso que vimos aqui é o padrão. E esse padrão funciona com qualquer warehouse e, em teoria, com qualquer conjunto de documentos no armazenamento em nuvem. Vocês
1:55:28 teriam que fazer algumas alterações nos scripts, mas ele não depende do schema, então foi feito para ser aplicado em qualquer lugar. Com isso, fico feliz em responder a perguntas até o tempo acabar, e posso me estender um pouco, Alex, se você quiser. >> Ótimo. Incrível. Muito obrigado, Zach e Ryan, pela oficina. Muito obrigado ao Martin por responder às perguntas no chat. Obrigado a todos por assistirem. Acho que respondemos a todas as perguntas. Acho que não… Ah, bom, tem
1:56:02 uma. Certo. Vamos responder a algumas, talvez, antes que as pessoas precisem sair. Obrigado por assistirem hoje. Obrigado pela pergunta. Obrigado por participarem. Road to NODES continua na próxima quinta-feira; então, se ainda não se inscreveram na próxima oficina, que será sobre grafos virtuais, compartilhei o link no chat. Deem uma olhada, inscrevam-se e participem na próxima quinta-feira. Espero que vocês tenham se inscrito no NODES. Se gostaram do evento e do que viram aqui, compartilhem também nas redes sociais. Seria bom ter mais gente participando das nossas oficinas e do próprio NODES. E, com isso,
1:56:35 sim, acho que ainda temos um tempinho para responder a algumas perguntas. Fora isso, fiquem à vontade para sair, claro. Há uma pergunta: “Quão difícil ou fácil é atualizar o grafo de documentos se houver mudanças nos documentos?” O ótimo da forma como carregamos os dados aqui é que tudo é programático. Então, dá para… Se houver uma alteração em um documento e o corpus de documentos for pequeno o bastante, vocês podem removê-lo e
1:57:07 carregar tudo de novo. Tenho outro projeto chamado knowledge index, ou key. Se pesquisarem por Kaparthi Wiki com Neo4j e meu nome, Zach, vão encontrar uma publicação no blog sobre ele. Esse projeto, na verdade, tem uma forma de fazer uma alteração em parte da árvore de documentos. Imaginem que vocês estivessem carregando dezenas de milhares de documentos ou mais; não iriam querer apagar o banco de dados inteiro e carregar tudo de novo. Então, há uma forma de se concentrar em parte dessa árvore e simplesmente
1:57:37 carregá-la de novo. Publiquei o código como open source. Então, sim, com essa coisa simples, em que usamos a estrutura dos documentos, é bem fácil fazer isso. Há algumas complicações, mas é definitivamente possível atualizá-lo, e não é muito difícil. >> Incrível. Acabei de conferir e acho que encontrei o link para o seu blog. Acabei de compartilhá-lo no chat. Sim, exatamente. É este aqui. O KG também encontrou. Perfeito.
1:58:08 E outra pergunta: como lidar com documentos com versões? Acho que é a mesma pergunta, certo? Quase a mesma. >> Sim, é parecido, né? Muitas vezes, depende: em alguns workflows, as pessoas armazenam seus documentos de origem em algum lugar com controle de versão. Pode ser no armazenamento em nuvem, onde é possível usar controle de versão, ou no Git, onde também é possível controlar as versões. E então vocês usam o grafo como meio de pesquisa, como uma espécie de camada posterior, não o sistema de arquivos, mas o lugar em que vocês realmente
1:58:41 disponibilizam o conteúdo para pesquisa. Essa é uma forma de lidar com isso, caso não precisem ler revisões. Se precisarem ler revisões, podem estruturar o schema para ter um ID de revisão ou um documento que aponte para suas revisões. E, sempre que fizerem uma consulta, podem usar a revisão mais recente como parte das propriedades. É um pouco mais complicado, mas vocês basicamente criariam seu próprio modelo de dados personalizado se fosse importante ler as revisões. Se não for importante ler as revisões, vocês
1:59:14 só querem a versão mais recente: meu primeiro impulso seria usar algum outro sistema de controle de versão com o armazenamento em nuvem, o sistema de arquivos ou algo do tipo. >> Legal. Certo. Acho que é isso, chegamos ao fim da oficina. Muito obrigado mais uma vez, Zach e Ryan, por nos guiarem, ajudarem com as perguntas e, claro, desenvolverem a oficina. Acho que foi muito interessante, e o chat deu um feedback muito bom. Como disse no começo, a oficina em si ficará disponível para vocês para sempre na Graph Academy. Como também dissemos no
1:59:47 começo, infelizmente não será possível manter as API keys da Anthropic nem o acesso à Anthropic. Mas, como dissemos, vocês podem usar o BigQuery ou suas próprias API keys para executá-la. O custo deve ser relativamente baixo, então deve ser possível replicar isso por conta própria. E o vídeo foi gravado; provavelmente vocês o receberão na caixa de entrada amanhã, a esta hora. Ele será processado e ficará
2:00:20 pronto para vocês, então, claro, poderão assisti-lo quando quiserem. E sim, obrigado por assistirem, por participarem, pelas perguntas, pela participação e pela atenção. Espero ver vocês na próxima semana no Road to NODES, com grafos virtuais, ou em algum outro evento ou conferência. Até lá, fiquem bem. Até breve e tchau. >> Certo. E mais uma coisa antes de irmos: temos um programa para startups. Me disseram, Alex, que deveríamos mencioná-lo, e
2:00:54 Vou fazer o seguinte: vou acessar, acho que é neo4j.com/startup. >> /startup, isso. >> Então, se você é uma startup e quer alguns créditos gratuitos do Aura, pode se inscrever. E oferecemos ajuda e uso gratuito do Aura. O processo de inscrição é bem simples. E queríamos deixar essa informação antes de vocês irem embora.
2:01:25 Tudo certo. Ok, obrigado. Terminei agora. Tudo bem. Obrigado a todos.
Transcrição original
[00:00] Here we go. We can build knowledge layers, but sharing our screen is still difficult for us sometimes. So, there’s there’s basically two links that are going to be important for you all, and hopefully they’ll get posted in the chat here really quick. And if they don’t, um Alex or Ryan, just help me out and uh put them in there. So, there’s the actual workshop course, which if you open it, it’s a Graph Academy workshop. You’ll go and sign in if you’re not already a part of Graph Academy, enroll in the
[00:32] workshop, and there’s directions there. You can even do it without us talking. You can do it yourself. Um the one thing you will need as well is there’s a credentials file. Um and if you go to that link, there’s going to be an Anthropic key and a uh a Databricks key, which we’ll be using for our warehouse. Now, I want to just say we are giving an Anthropic key for everyone to use. I We’re all adults. We can all use keys responsibly. It I’ll be watching it. So, if if someone just just, you know, use your common
[01:05] sense. Don’t take it and and go off and run with it and do other things outside of the workshop. We’ll turn it off after the workshop is over. If it turns out that someone is abusing the key, unfortunately, I’ll have to shut it off, and then, uh you know, it’ll be deactivated for everyone. Um if you have your own key that you want to use, if you have if you want to use Cloud Code with your own Anthropic key or just your own subscription, you’re perfectly fine to do that as well. It won’t make a difference for the workshop. It’s just we want to make sure everyone has access to Anthropic and Claude if you don’t
[01:37] already because we’re going to be depending on Claude Code. Um so, I’m going to go through some slides very, very quickly before we start just to level set on the idea of what we’re doing here. So, um we talk about knowledge layers a lot uh and and Neo4j. And I really wanted to create something that uh just sort of from a concrete level, how do you actually build something like this? A simple version, not like the big complicated six to eight layer version that you might end up with in a big
[02:10] enterprise, but like what’s your like 101 knowledge layer look like? Um so we got a great team here to put together a workshop for you. Uh it includes Ryan who’s on the call, uh who’s a senior partner architect, um who’s helped particularly with the connectors to Databricks and some of the back-end stuff. Um Ben Squire, who’s our developer, one of our developer advocates, who’s helped test the course and walk through it and sort of how do you make it uh sort of a better learning experience.
[02:40] Um and then myself, and I’m an AI researcher here at Neo4j. Um so what we’re going to do is we’re going to take a business use case around Think of it like an auto repair chain. Um so we have these in in the United States where you there is these big groups that run like oil changes, and they’ll do like other diagnostic checks and stuff, and you can bring your car into them. And imagine that they have a ton of documents like bulletins about
[03:11] cars and recalls and stuff, plus they might also have transactions that they keep inside of an operational store and then eventually put inside of a data warehouse. So like all past repairs, um you know, and like different transactions they’ve had with customers uh and so forth. And there’s multiple different types of personas that might be interested in different problems around that business. So for example, a technician might have a problem around finding a particular fix. You might have more senior
[03:41] individuals inside of the organization wondering about like how do I um actually get AI implemented um so everyone can use it, and how can I ask more analytical questions for reporting? Like, you know, what are we missing? What are our blind spots? All this sort of stuff. Um and then you have AI engineers, which might be a lot of us on the call that actually has to have to build a co-pilot for all of this stuff, right? Um and in this case, the data that will be working with, this is all simulated, um but it comes in two parts,
[04:13] a structured part and an unstructured part. So, as I was saying before, we have a lake house, um and inside of the structured part is going to be tables around your work orders. So, your vehicles, different codes for those vehicles, procedures, the work orders, and then different parts that are being used. And they have primary and foreign key relationships uh that are implied, I think, inside of uh Databricks and some of these other data warehouses uh like BigQuery, for example. Um and then you’re going to
[04:46] have your documents, which in this case we’re just modeling with PDFs. These are going to be manuals, uh service bulletins, and recall notices. So, basically like safety or issues uh that a manufacturer has with a certain vehicle um that’s important for someone who’s going to be, you know, building or or fixing um fixing vehicles. Um and so, I we’ve made it to a point where retrieval from those data sources is not a problem, right? You can retrieve documents and warehouse data fairly easily. Uh there’s text to SQL
[05:18] tools often by these vendors that have data warehouses like Snowflake and Databricks, and there’s vector search to retrieve from documents. So, like getting the data is not the problem. The The problem is, how do you combine that data um and how do you basically navigate through it in a reasonable way uh where the AI model has all the context it needs. And there’s certain very specific instances where this becomes a really big problem. For example, if you want to really navigate your documents like say, “Hey, I have a
[05:51] work order and then that connects to a series of manuals and safety bulletins.” Just doing like vector search on these documents, you’re searching, but that search may have holes in it or it may like over index on just like one piece of documentation and give you a lot of duplicate results. So, you have this like precision recall problem where you’re not like recalling all the information you need and sometimes if you have a really low like K return, you suffer with your precision. Um so, you know, you you need to go a little bit
[06:25] beyond just semantic search and maybe navigate the links inside your documents, the structure of it. Um and similarly, if you have to look at sort of ask questions about negatives, like what doesn’t exist in my data or where is something missing, that’s very hard with vector search. Um and of course, trying to find connections between different things. So, like how do I sort of connect up my unstructured data and find the connections to my structured text to SQL data and make sure that, you know, even within side of
[06:57] my uh tables that I’m connecting between the tables efficiently according to sort of the business language or this is sort of the business semantics uh that people who actually work at the business use. Um and so, we’re going to look at three specific shapes uh to help us with this. Um so, those are going to be creating tables of contents or trees um out of our documents. Uh we’re going to be looking at connections, which is like how do you form paths, particularly between your structured uh lakehouse data or or data warehouse data, and
[07:32] themes, which is going to be how do you extract communities and surface patterns that uh no one really named beforehand. So, like so, tell me about my like basically if I don’t know what I’m looking for, but I want to sort of uncover, you know, contradictions or errors where I’m missing or or common patterns inside of my data, reoccurring themes, how do I how do I find that? Um and I’m sure a lot of you if you’re here, you might already know a lot about graphs, but I’m just going to explain Neo4j and
[08:06] how we think about graphs very very quickly, so everyone’s um sort of up to the same level because we’re going to be using graphs to express these shapes and get over these problems that I was talking about before. So, when we refer to a graph here at Neo4j, we’re often referring to a property graph data model. There’s other types of graph data models. At the end of the day, they all model effectively the same thing. Um this one is just very very simple and easy to understand. So, there’s three
[08:37] elements inside of a property graph data model that are important to know about. There’s nodes, which represent people, places, and things, right? So, entities. There’s relationships, which are the verbs or associations between those people, places, and things. So, you can see here, you can have a person own a car, or you can have a person drive a car, or you can have relationships between people like a person is the brother or a sister of another person.
[09:09] And then the other really key part is are the properties, which are could be strings, they could be dates, they could be vectors, for example for vector search, uh they could be lists of things, they could be dates, they could be uh numbers, all these different things that can go on both attributes of nodes and relationships. That helps with search and filtering and all sorts of stuff that we’d use. Um and the idea, right, is that it’s almost like pre-joined tables because instead of having primary and foreign keys, I can
[09:40] go between nodes multi-hops very easily. Everything’s just uh already you know already pre-joined together so you can just zip through everything. Um and when we talk about the knowledge layer which is the which is our title for this um it might be helpful just to explain what this is, right? So like a knowledge layer you can think of it as existing between your agents or your end users and your source data. And this
[10:11] knowledge layer where Neo4j fits inside of the stack can hold lots of useful information, graphs of various types. Knowledge graphs which tell you about your semantic knowledge, how things are related together uh ontologies that tell you about your semantics and your schemas and how they relate to the real world and define meaning in your data memory can go in here, business rules, procedural knowledge so like how do you actually do tasks? And all these things
[10:44] help your AI models become more accurate. They give you a form of governance and explainability um and you can distill and connect a lot of your agent knowledge and human experience inside of this knowledge layer and make it portable so you can plug any agent into it and you can share this knowledge between agents. Now there’s lots of components to a knowledge layer and what we’re focusing on today is really more going to be this knowledge graph side and this ontology or semantic layer side with a little bit of business rules
[11:16] mixed in. And in other talks we you know there’s lots of information that we provide on memory, how do you make cool these cool memory graphs or virtual graphs and context graphs and procedural knowledge and I cover those in other talks as do a lot of my colleagues and you can easily extend what we’re doing here, but here I want to give you sort of that basic foundation for a 101 knowledge layer, which is why I’m focusing mostly on these two and a half areas. Uh and this is what it’s going to look like uh when we jump into the workshop. So, basically what we’re going to build
[11:50] today is you’re going to have your agent here uh and your lakehouse. In this case, we’re going to use Databricks. You’ll have your structured tables and documents I was going over. Um we are going to make a semantic layer graph with something called Neo4j. That’s going to be like an ontology in a way. Um and someone’s asking if we can have access to the slides. I can share them after. If you go to the workshop, um
[12:20] the workshop has these images in there, too. So, it doesn’t have every image that I showed you, but it like this diagram is inside of the workshop. So, you’ll you’ll have access to these. Um but, yes, I can um I can look at just sharing them here uh after after the talk. Um the semantic layer, again, is going to be a reflection of what’s in the warehouse, and it will tell the agent how to write really good text to SQL. And then, our documents we’re actually going to parse and ingest into the graph, and I’m going to do this in a way
[12:52] that’s item potent. Um so, I’ll get into that when when we get to that piece, but often times people struggle with entity resolution because or not entity resolution, but entity extraction. Um some of those workflows can be a little bit tricky if you approach them for the first time. I’m going to do something here that focuses more on the structure of documents. So, it’s very very simple deterministic code that you can then enrich later with entity extraction if you want. So, again, with that sort of 101, here’s just the starting knowledge layer type of theme. Um so, with that in mind, we’re going to
[13:24] jump into the course. Um and let me switch my tab over. So, uh can someone tell me, Martin or Alex, uh did we post in the chat the links to these two things here? Let me check. >> Yes. >> Okay. So, so so everyone has this. Okay. >> Yeah, these are posted and also pinned to the top of the um of the workshop chat. So, if you don’t see them right
[13:55] now, then please scroll look at the pinned messages. There is the workshop content and there is also the the credentials content that you shared in this Google Docs file with the API keys. >> Okay. Awesome. Perfect. So, here’s here’s the start of the workshop. Now, I already did most of this overview. Um so, you know, you you’ve got that already. The next thing I want you to do is go to the your environment piece. Um and you’re going to open so, I’ll
[14:27] walk through these steps. Uh you’re going to open in GitHub CodeSpaces an environment to do this if you want to follow along. Now, if you want, you can run this locally, too. Like the all the code for this is open source, so you can go to the repo that has all the code, and you can start running this locally. You can hook this up to Orin, whatever you want to do. Um if not, you can go ahead and, you know, create a new one in in CodeSpace. I have already got a CodeSpace here that I’m working on, so I’m not going to
[14:59] press any buttons here, but that’s what you would do. Um once you’re in here, uh basically what you need to do is it’s going to take a while to spin up, so this will this will take like 3 to 5 minutes to spin up. Um there’s an environments file, and you’re going to need to fill these things in, and that’s where the credentials file that we have from before is going to come in. So, basically what you’re going to do if I scroll down here is there’s an Anthropic AI key and there’s these data warehouse keys.
[15:32] Here’s the workshop credentials. It feels very naughty of me to be showing workshop credentials on screen sharing them. But, we’re going to tear all this down afterwards. So, and you know, people please use this responsibly. So, I am and then basically I’m going to I’m going to go into my environment and I’m going to paste all that in. And then, oh, actually I pasted over the wrong thing. So, there’s the Anthropic key and then the warehouse stuff
[16:02] you’re going to want to put down by where we have all the warehouse stuff down here. So, I’m going to put that in down here. And then basically you have that in and then you’re going to need to start a sandbox for Neo4j. Now and it will give you directions here on how to do that. You have to go to open sandbox. And then, once you’re here, I already have a graph data science sandbox selected cuz I was, you know, running
[16:36] this beforehand in preparation. But, for you, you would go to a new project and then I don’t have it for me because I already have one, but it should be under your own data. Not the ordinary blank sandbox, but blank sandbox with graph data science and it should show you in a picture here what that looks like when you’re setting up. So, it’s blank sandbox graph data science. There is a way to hook this up with Aura, too. So, while you guys are going through and doing this, I’ll say that
[17:08] I at some point we’re going to update this course to use Aura. The only thing blocking that is a technicality around how to do some of the GDS stuff when you make projections cuz it uses a different mechanism there for I don’t want to get into it for this for this workshop. It’s a it’s a it’s a technical detail. Um and we actually say Ryan had put in down here kind of what you would need to fix in the workshop to make it work with Aura, which is our cloud offering. Um but for today we’ll use sandbox.
[17:43] After today, I’d actually recommend looking at if you go back to that credentials and you look at these directions, I’d recommend uh going in here and and following that and using Aura instead of a GDS sandbox. Um the experience is just going to be uh likely a lot better. Okay. Um so anyway, once once you get this created, you’ll open up your sandbox. For you, it should be blank. Um basically uh
[18:16] if I if I open my sandbox, um it it will come up with credentials and uh you basically just have to go through and plug in your connection details. Um the username for this is just going to be Neo4j and then your password. And then when I connect to mine, it’ll show me that I have um sure we’ll save. It’ll show me that I have stuff inside of my graph cuz I was running before. For you, it’ll be nothing cuz it’s just
[18:47] a fresh uh blank sandbox. Um once once that is up, you basically take your credentials. Um you’ll when you go through and do this, you’ll download credentials. Um it’ll give you a file to download and you take those and you put them into your environments file. So for me, um they came in I have mine here, so I just go copy. And then I would go to my
[19:23] my code space, and I just stick them in right here inside of my environments file. Uh Once all of that’s done, and many of you might still be waiting for all this to spin up. Uh you’re going to start Claude, and it will bring you through a series of steps. Uh so if I go here and and another thing too is this bash script, this was uh the bash terminal rather was initiated often,
[19:57] it’s a race condition, before the environment uh file was created before you put your credentials in. So you can either source from your bash here. Uh there’s some directions for doing that here, but what I do that’s a little bit easier is I just create a new bash terminal. And then I can say Claude. And if you want it to be a little bit easier, I say enable auto mode. So it asks me less questions. Um and then you’ll go through and
[20:29] select, you know, whatever you you want here. When it asks you for your API key, say yes. Um enter it to continue, use recommended use recommendation settings. Trust the folder. It’ll ask you about an MCP server, which we have here. This is going to be to talk to Data Bricks, and you are going to say yes. I just say use all here. Um and then you should get your uh Claude terminal. Now, if any of those
[21:01] directions, if you selected like the wrong option uh inside of here, it will tell you how to fix that. Um, so if you need to restart, you can remove from settings. If you pick the wrong MCP thing, you can you can reset project choices here. And then when you’re done, you can you can ask this question. You should get zero for this question. Um, and for me, it uh, it won’t be zero because I uh,
[21:35] What are we doing here? For me, it won’t be zero because I already started loading stuff um, inside of the inside from the workshop. Uh, the the other thing here, too, is we’ve tested this workshop mostly with Opus, but on older versions of Opus. I might be a little bit of a daredevil here. I will actually Well, I don’t need to open a new a new script for this. Well, but I’m I am going to try this with Sonnet. I I was testing with Haiku
[22:09] earlier this morning, and it was working. Um, but I’m going to try it with Sonnet. And uh, if it doesn’t work, which I think it will, then I will go ahead and switch back to Opus. You know what? I’ll stop here and maybe leave some room for questions. We’re about 25 minutes in. Um, let’s see if we have any questions in the chat that we need to answer. Um, I actually think everything here is answered.
[22:40] >> I think Yeah, Martin uh, had graciously answered most of the questions. I think the one that came up a couple of times was how long will the API keys be available for people if they want to watch you today and do the workshop at their own time later? >> Um, we can’t keep them around for that long. So, I know for the Anthropic key, I’ve got to shut that off pretty much right when the course ends. I’ll I’ll let it linger for maybe a little bit after that. Um hopefully you can get um you know a Cloud subscription. It
[23:13] shouldn’t be too expensive for you to just run through the whole course. You’re just answering having Cloud answer a few different prompts. Um and it’s not doing any entity extraction or anything. Ryan, for the Databricks one, uh what do you think? Can we keep that alive for a day or do we want to shut that off immediately? >> We’re going to have to shut that off immediately as well. >> Yeah. Yeah. But uh there is if you if you look at the course, there’s there’s an option to use BigQuery as well as your backing data warehouse. Uh and that
[23:44] one I leave up all the time cuz it’s it’s super cheap. So and it shouldn’t change the way the workshop functions at all. Uh so you can go ahead and and use the use the BigQuery option. I might need to add the BigQuery key back to the workshop credentials, but I am more than happy to do that. Uh in fact though, I think it’s in the uh it’s in the environment already. Um yeah, it is. So uh never mind. I don’t need to do that. It’s already it’s already automatically done for you.
[24:18] >> Yeah, Nile, you you’ll get an email with this recording from today um and with the materials as well. So you can um you can continue this uh anytime and you can obviously decide how you want to run it. Watch Zach and Ryan do it and then do it afterwards with the caveats that obviously the keys [snorts] aren’t going to be disabled or you just continue doing it today and >> [gasps] >> the workshop in itself is obviously forever yours and you can do it at any time uh as you like it. >> Yeah, and then um and there’s another question here. You can definitely run
[24:51] this locally. Uh it’s fine. We Yeah. We we provide we provide this so that it’s you know everyone has the same playing field and they can all do it but I I if it were me I’d be running this locally too. Super Okie Dokie. So thank you. Thanks and then how are we I don’t know if there’s a way to get feedback from chat. Is is everyone like uh I don’t know is there like a way to thumbs up if everyone is like if everyone is good on the environment set
[25:24] up or we need more time? Yeah let us know in chat if you if you’re there yeah I see thumbs up flying in a couple of people lies just say more time please a little bit more time okay. Let’s let’s give it give it a bit more time. Yeah we’ll give it we’ll give it a couple more minutes there’s nothing wrong during the waiting period if you want to move through just press continue. And it will bring you to to the next
[25:57] piece so I’ll give it a couple minutes for everyone to catch up but you’re welcome to go through and check things out and start running things yourself as well if you’re if you’re already there. Sounds good. Cool I’ll just let me see if there’s anything in chat that we can maybe talk about while people are are getting ready yeah previous workshops I shut that. Yeah no I think um people are either ready or getting getting ready.
[26:29] Okay. Hi sorry there was there there was a question from Max which is any comments in relation to running eval’s over this knowledge graph. Using one model versus other options if you had any had any thoughts on that. So running eval’s comparing different models was that the question? >> Yeah, exactly. Yeah, and yeah. >> Yeah, so for this workshop, I don’t have
[26:59] like any eval harness set up, um, but but you can easily do so, uh, and you know, it’s funny because when I first made this workshop, uh, earlier this year, I remember that I was biasing myself towards Opus and more advanced models, but as the models have gotten better, at least within inside of the Anthropic universe, I’ve been able It seems like I’m able to use smaller models there. Uh, so it would be it would be an interesting test because
[27:30] you know, where when we provide a knowledge layer, in theory, what we’re doing is we’re almost like distilling human knowledge for a model, and we’re giving it a graph to follow rather than having to do a lot of reasoning and routing on its own. So, in theory, the bigger lift should be for the smaller models. And it but that doesn’t always happen if the use case is very complicated, and it sometimes like and again, I I think I’m seeing it more the case now that smaller models are
[28:01] doing better. I’m mostly using Anthropic, so I’ll I’ll preface with that. Um, whereas in the past, it’s been complicated enough that you would you would kind of want a bigger model for some of the more like for some of the examples that required six or seven hops. Um, but I don’t I don’t think that’s the case anymore. Uh, so I would be interested in adding like a harness to this a benchmarking harness and actually really seeing like how well uh, the different models compare. And then obviously like comparing it to, you know, just using
[28:32] BigQuery or Databricks by itself is is always very interesting. Um, and what I find is with I mean the whole reason we set this workshop up, right, is because it’s it’s actually very hard to do this sort of stuff without some sort of semantic layer on ontology relating between the unstructured and the structured data. >> No. No. >> All righty. >> Super. I think um we should we should probably go ahead. I think you know, if you had could maybe catch up with this this one sentence on what you mean with
[29:05] shapes and dimensions. >> So, we talked about um context comes in shapes is you know, the so the verb which is used with this workshop. And what I mean by that is as AI engineers I and talk about this as if AI engineering is this discipline that’s existed for decades. You know, I think as we’re I think let me rephrase that. As as all of us are struggling to kind of keep up and learn what’s happening with AI, we get very focused on the
[29:37] tools. And this happens with retrieval a lot. Like, oh, I need to do text to SQL or oh, I need to do rag or oh, I need to write a cipher query, a graph query to pull something from the data. Uh but often times if you take a step back and you think about more like, okay, as you know, not to personify an an LLM, but like from the perspective of the LLM, what does it need what context does it need to see to be able to appropriately answer a user’s question or perform some
[30:09] sort of autonomous action. And when you phrase it that way, it’s more like what shape of data do I need to give it? Like, what does the view need to look like? If you if you think about like a materialized view, like like what does that need to look like? And then work backwards from there as far as what tools and queries you’re going to need to put together. So, instead of thinking about it as like I need to make a cipher query to access the data, think about it more like I need to give my AI model a table of contents that it can navigate. Now, how
[30:43] do I build that? Is it a Cypher query? Is it a SQL query? Is it something else? Like, how how do I do that, right? So, that’s that’s the idea behind that. >> Perfect. That makes sense. Thank you very much. Let’s Let’s continue. >> All [snorts] righty, let’s keep going. So, we’re going to move on to our first shape, which is this connections shape. Uh and so, the idea behind this is how do we be explain to the model or to our agent how to navigate our warehouse data. And for this, we’re going to be focused
[31:15] specifically on the structured data side. Uh and there’s some metrics that we talk about here in terms of like how well text to SQL works and all this sort of stuff. And the field’s constantly changing, models are evolving. Um you know, the different vendors put out stuff for for what is effectively text to SQL all the time. But, what we’re trying to get the AI model to understand is what does the shape of this data look like? Um what connects to what and why does it connect to what? And to do this, we’re going to build a semantic layer
[31:48] or an ontology in a sense. And I have a little table here that kind of tries to explain so the different levels of thinking when it comes to ontology versus a semantic layer versus a virtual graph. Uh and it’s a lot of words, but basically, an ontology is about interpretation and sort of reasoning through the data. A semantic layer is more about, well, how do I actually query the query the data to just match the business terminology? So, it’s a little bit more like uh functional in a sense. And then we have these concepts of virtual graph, which we’re not going
[32:20] over today. And that actually um you know, that that would put a graph physically on top like a virtual graph on top of a warehouse where you can actually talk to your warehouse with SQL. So, it brings it to the it brings Cypher to the query layer, basically. And then it pushes down into SQL. So it’s like you can query your your Databricks warehouse as if it’s a graph. We’re not going to go over that today. Um we’re going to go over a semantic layer today. And we’re going to use this tool called Neocarta. Um Neocarta is a labs project. Uh and
[32:55] it’s something that we’re continuously thinking about how to integrate into the rest of our product offerings. A labs project is something that we work on often. These are going to be open source. And uh think of them as a reference architecture uh tools that you can use and that you can incorporate into your solutions, but they’re not really part of our official product offering um and supported by engineering. And basically what Neocarta does is it sets a you can connect it to your warehouse.
[33:27] Uh in this case we’re using Databricks, but there’s BigQuery. I think it works with Postgres and you know a whole bunch of others. Um and you can form this uh well, this is not the semantic layer. Where’s the semantic layer graph? Or maybe this was it here. Um this is more I should showing you how how the querying works, but what I want to show you is something like this, right? So it’s uh your database and how it’s schema, all the tables and the references and
[33:59] everything that uh basically like a mapping of your logical or physical data schema that lives inside of a graph. Um and these reference keys, which are hard to see, but I’ll show you after it loads, that tell you how things join together. And these can be inferred by a query log, for example. So a lot of times in data warehouses, you don’t have explicitly defined primary and foreign keys. They might come from comments on the tables or they might come from a query log, for example, uh or some other form of data.
[34:29] And Neocarta helps you map that over. And then there there’s other things that this can do specifically around adding I wonder if it’s in here. Um Yeah, like adding a business glossary which we’re not going to do here cuz we’re we’re just doing like a one-on-one example. Um like business terminology and stuff that you can overlay on top of the schema. Uh so that that can be very very useful basically to get your AI model to understand like how all of this works.
[35:00] And again here we’re not actually going to import any data from Databricks into Neo4j. This is all going to be zero copy. What we’re going to put in Neo4j is this mapping. And then your agent is going to use that to then write better text SQL once it understands the shape of the data, right? Um and we will continue on. So we’re going to call this Python script here.
[35:33] So I’m going to just copy it. And I’m going to go back into my uh project here. I’ll open up a new terminal. And I will type in the command. And I’m being a little bit risky here cuz I already have the uh all the lakehouse data in my workshop. So I’m going to be writing it twice. That might screw me up later. Um but what this will do
[36:06] is it it looks great. It was item potent. So so it only loaded. It didn’t it didn’t uh it didn’t duplicate the data in there. So that’s good to know. Um it’s going to write tables and references into there. And if you if you looked at the way that script works, let’s see where is it? It’s in the load. Um build connections. Basically what it’s going to do, the important part here is where it calls and get from Neo4j. Um and then where’s the actual Here’s where it it instantiates the the
[36:41] Databricks schema connector. Um opens up a driver. Runs this. Um but I think um this is just a count. So, here is where we do it. So, in this library basically make that a little bit bigger. You’re you’re just saying, “Hey, ingest uh basically uh from Databricks and then the schema here um is uh basically reading in um the Databricks schema. So, these these are
[37:14] the environment variables that we filled in from before. Uh so, that’s what that’s what ran. And then uh what you can do to see what it creates inside of Neo4j, I can go back to my workshop. And one thing here, too, by the way, it says six tables and five references inside of the catalog. I um screwed things up um for Ryan. And I almost blamed it on Ryan, actually, which was very unfair cuz I forgot that I screwed things up. I was I was playing around with AI search inside of
[37:45] Databricks. And so, there’s two tables related to documents that I loaded in, which don’t belong in there. Um but they don’t affect the course. So, you’ll see eight tables and five references. But anytime you enter a question for the workshop, pretend that there’s only six in there. And we will have to go through and remove them at some point. Um This Here’s Here’s the query that’s sort of going to show you what this looks like. So, I’m going to I’m going to press copy here for this for this bit of Cypher. And I think a lot of you by now know uh
[38:17] what Cypher is. Cypher, though, just so just for those that are unfamiliar, is our graph query language. It looks like SQL, but it does this like pattern matching. What I’m saying here is I’m saying, “Hey, get me a path where you’re going to start at a day at a node labeled Databricks, and then go out on uh basically any type of relationship for like as many hops as it takes, and get me all the paths.” I’m basically here saying, “Return everything that’s connected to this database node.”
[38:53] I wouldn’t do this with a large database, by the way, because you can imagine if you have hundreds of thousands of nodes in here, it’ll it’ll try to pull all them back. Um I don’t have like a return P like limit two, right? In which case it’ll return back just a little tiny piece of it. Um I’m saying, “Return everything.” And it will bring me back the entire connected component. Uh and what we’re going to look at here is we have our database, Databricks. We have our schema, which is our AutoFix
[39:23] schema, that’s the use case that we’re working with. And then you can see here we have our tables. So, here’s like our parts table, our work orders, our procedures, um our vehicles, all this cool stuff. And uh what these do is these tables then connect to our columns. Uh so, these are basically the names of our columns inside of our tables inside of uh inside of Databricks. Uh and then we can have sample values in
[39:53] here as well. And then I have highlighted here these reference joins. Maybe I’ll make them a pretty color. What about blue? Make them big, okay? And these are our joins uh from primary to foreign key. And there’s multiple ways that this can be inferred uh by Neo4j. Obviously, if you have an explicitly named primary foreign key like in uh in a relational database, it can achieve that. Um it can
[40:24] also do if there’s comments uh a metadata like different data warehouses have different ways of doing this. I think Snowflake’s is comments. I forget what it’s called inside of Databricks, but you were you would basically say like oh like this is a you know foreign key to you know so-and-so table. Um and then it can also do it via a query log. And so that’s really in practice, right? Cuz a lot of these data warehouses as I was saying before don’t have uh they they have like these implied uh join keys. Uh which can be a hassle if you have hundreds of tables. So this example is very very simple, um
[40:58] but I think it’s nice for just illustrative purposes to kind of understand how this works. Um and keep going to the wrong thing. Um there’s different things that uh different operations. It can get full metadata schema. It can list schemas. It can context by the table type. Uh you have it. There’s an MCP server uh that Neo4j that’s how it’s consumed by the agent. There might also be a cloud, I think in there, but we’re you we’re using the MCP server for this. Uh and um the we give the agent the ability to run this uh this script here
[41:36] this uh run SQL script. Uh so I can go ahead and just copy this and make sure my agent works. Um let me actually just start a new cloud here. And then I want to make sure the model is I’m using Sonnet. Cool. All right. And I will go ahead and ask which vehicles received a certain part, use the MCP to get the warehouse schema, and write the SQL and run it with with the thing here.
[42:07] And it should go away and do that for me. And what it will do is uh basically use that MCP server to read the schema from Neo4j. And then it will use that to run the SQL. And while it’s working on that Oh, brought back.
[42:40] So, it went ahead and answered our question. Um went on 521 vehicles. And then let me just say what MCP points did you use for this? And it should tell me what it used. Get context by column and get full metadata schema. So, it basically went to you know that uh our Neo4j Neo4j, it
[43:15] got that and then I can say like what uh query did you run in SQL? And then once it got that it ran this other query in SQL. And you can see it looked like it ran two. Um and it it had a couple joins in there. So, anyway, uh that’s the that’s the basic pattern here. Obviously, this is very simple, right? Because what we’re doing here is you know, we we have our um
[43:47] our schema is only like six tables. Uh so, it’s not that hard. Um you know, I I wanted something that’s visually easy to see. Uh but you can imagine people will use this our customers will use this when they have hundreds of tables. Um and it helps substantially. And then you can also imagine, which is another area where this is used, if you have data inside a Databricks, then you also have some data maybe inside a BigQuery or something else. It looks like was someone saying something was that you, Alex?
[44:17] >> Yeah, I was No, because, you know, I would didn’t want to interrupt, but yeah. Um there there is a couple of repeat questions on where to find the Neo4j URI URI and and password from the sandbox, and I think it’s in the it’s in the Graph Academy course, but it’s also in the sandbox view. Maybe you could quickly show that one more time so people know where >> So yes, I will. So So um if you’re here and this thing is running Now, first of all, when you did this, it should have downloaded a credentials file, and it will be in that downloaded credentials file as well. That’s easier.
[44:50] Uh but if not, you go to See how there’s this thing here? You can go to connection details, and then don’t copy my password, please, and screw up my database, but this is this is where it lives. Um and you can you can copy to clipboard and then put them in that way. >> Super. >> And this might be a good place to stop for questions. Let me just see here. Uh Yeah, there’s there’s some details in here if you wanted to see around um kind of how things are namespaced inside of Databricks uh in terms of the schema and
[45:27] everything. Uh and then you can also um I think this this will just show me some info about uh Where’s my I go to Hm. Yeah, it’ll just it’ll just show me the dialect that it’s using Databricks SQL and Databricks and then the and then the table. Um of course, we have the option to use BigQuery here, which if you’re viewing this after, that’s probably what you’re
[46:00] you’re to want to be doing. You’re going to be wanting to do the the big query version. Um which will use it a different dialect in that case. Um for here say six tables and five joints to continue in the course. Don’t say eight cuz there’s two that the docs chunks and the docs something there’s like two docs tables in there. They don’t belong in there. So it’s six and five. Um and that that will allow you to to move on to uh the next part. So this is a good place to stop Alex if there’s other
[46:33] questions that we have. So let’s see. >> Yep. Yep. Yeah, we have a couple. Um one is uh a longer one, but I think it’s interesting because you know what it it it connects with what you said earlier. This is a small data set. This is small demo size, but Oscar asks, “What what if you have millions and millions of registries in in in an in an enterprise grade? We have to see millions of nodes. Which is the key number of nodes between being optimal for agent querying and not being optimal? Do we have to have layers like memory cache or something like that?” >> [snorts]
[47:04] >> So right now with inside a Neo4j, the the nodes and the the relationships are really referring to columns and tables. Uh so, you know, the from the deployments that I’ve seen realistically in enterprises, you’re talking hundreds, maybe thousands of tables in really big cases. Is it possible to get to millions of nodes in that representation? I mean, maybe. Um the way Neo4j works is it it can do text searches to search in like
[47:37] to search parts of the graph. So it doesn’t have to pull back the full metadata schema, which would obviously blow the context window, right? Or or it could. Um so there’s ways So, you know, Neo4j and the tools that we’re developing along those lines um will scale well for larger sizes. In terms of millions of nodes, that would be very large for a semantic layer, although it might be possible. Maybe I’m wrong about that. Uh for other forms of retrieval and memory, for example, you can obviously
[48:09] get to millions of nodes. Like if you’re storing session history inside of a graph and you’re doing entity extraction from that, you can easily get up to, you know, millions to tens of millions to billions of nodes. Uh and in those cases, the way we do retrieval, uh you can do vector search inside of Neo4j to pick up uh particular nodes and then just use that Cypher traversal language that I was talking about before uh to go from there. Um you’ll see a little bit of this inside of our next thing about trees and navigation. Like you can start
[48:41] on particular documents and then do like three hops out, right? And that scales perfectly for larger data. That’s That’s what we specialize in at Neo4j is like good graph reads as your data set get gets larger, right? Um so that’s all possible. And then obviously with things like caching, um yeah, like I I mean um you know, I I would I would imagine that some caching strategy for graph queries would be helpful. Uh there is like we within side of the Neo4j implementation, we we have our own
[49:15] page cache that there’s if you do like the self-managed deployment in Aura, we we manage that ourselves, but in the self-managed deployment, you can like play around with the amount of memory on that and stuff. So hopefully that answers your question. Uh I don’t see it written down um here and I’m just missing it in the comments and the in the questions piece. Probably just don’t see it, but hopefully that helps. >> Hopefully, yeah. But I’m sure. Um cool. Uh Well, I see a bunch of other I think Martin answered most of these already, so I think we are
[49:49] probably good to continue. >> Okay, I see a more. Maybe I’ll I’ll take some time uh to answer. >> The The rest of the course, by the way, Alex, it’s um I we can we can as we go through this, we can go faster and faster, but like getting the foundation I think is is really important. So, I’ll take a little bit more time here. >> Um are there disadvantages on zero copy approach versus copying the data into Neo4j? Uh and that’s a really good question. Um so, right here right we’re not Yeah, we’re not copying the data into Neo4j
[50:22] and were you doing that uh semantic layer? Uh and there are disadvantages to that. Um one of the big disadvantages is going to be on your multi-hop uh accuracy and importantly your latency. So, we I see this sometimes with big like supply chain or routing use cases. Like let’s say you want to find the shortest path between two points. That’s an arbitrary length query. If you’re like, how do I get like a package between, you know, across a country, across multiple warehouses. Like it
[50:55] could be two warehouses, it could be like five stops, it could be no stops. Like you don’t know. And those types of queries just perform better inside of a graph database. And so, it makes sense to move your data into the graph database. Uh I think the the biggest question there is like is the blocker for you that the query performance and that the the actual mechanisms of the query depend on a graph for performance? Is that the blocker? Then moving your data
[51:28] into Neo4j would be smart. If on the other hand, the issue is really more well, like in theory I can do this in SQL and it’s fine. It is just that my agent doesn’t understand how to do it with the current tools that we have inside of my data warehouse or or my SQL or whatever I’m using. That’s a different type of question because for a lot of these like the examples that I was showing you here, right? It was you know, we were doing um like uh what? Like two hop joins or something. It wasn’t it wasn’t that
[52:01] atrocious. Yeah, like two two joins. So, it’s doable in sequel, but it might be a situation where your agent just doesn’t understand it cuz like the business terminology and everything and like how things link together might be really complicated cuz there’s maybe too many or too much business terminology and that’s when the zero copy approach is really good. So, to answer the original question, the disadvantage is really going to be you don’t have the graph query performance. It’s really the short answer, right? You just have a better semantic understanding and potentially a
[52:32] better way to structure your query together. All righty. Um Cool. >> There’s a question on from Constantine on Neo4j. Does it have HIL or does it generate a semantic model with one shot? >> Does it have HIL? >> know what Yeah, I don’t know what HIL means to be honest with you. >> Human in the loop. >> Okay, I just didn’t know if you were in the loop. [laughter] >> Yes, that could be it.
[53:07] >> Um do you want to expand on that a little bit Ryan or >> Yeah, it’s it’s basically just a a one shot right now. So, Neo4j basically reads reads the metadata, builds a semantic layer, and you can do a manual view, but there’s not like an iterative process for that loading of the metadata right now. We are definitely expanding on that to add, you know, a you know, a human in the loop process. That’s kind of the future. We’re not right now. >> Right. Awesome. Okay, great.
[53:39] >> Thank you. >> Um let’s go ahead and move on to our navigation piece here really quick. So, now we’re moving on to a different shape and we’re going to be talking about a table of contents and navigation. So, I call this a couple different things. Sometimes I call it outline, sometimes you’ll hear me call it trees, other times you’ll hear me call it a table of contents, and I apologize for that. The The words have been jumbled as I’ve moved across different projects.
[54:09] It’s all the same thing, though. The idea here is that sometimes when in we’re going to be moving out of the structured data world and we’re going to start to talk about our the document side of the database. These are going to be the PDF documents. And our natural inclination right now is to do vector search and chunking on PDF documents. And that’s great and we can keep doing that. But, a lot of questions might involve more navigating those documents. And the idea here is that we want to give our
[54:42] agent a table of contents where it can navigate. So, just like a human, if you open a book and you look at a table of contents, how do I jump from, you know, one section to another section and how do I know what contains what? We want to give our agent that exact same view so that instead of just doing like a control F, it actually goes through and understands the structure of the library that it’s looking at in terms of the library of PDFs and going to the right thing.
[55:14] Uh, and this is This is the view or the shape that I want to give my my agent. Basically, here’s the technical library, there’s bulletins, and there’s going to be recalls and manuals and stuff also. And then you’re going to have documents. And those documents are going to contain different sections. And those might link to other sections. So, this this So, this basically means, “Hey, this section on this condition of this Falcon 2.0T cylinder misfire thing links to a
[55:46] misfire diagnosis that’s inside of our manuals on the Falcon engine.” And they have these URIs here. They’re kind of long that help identify down to the document, but they’re hierarchical, right? So, the So, like like I have the technical library, my bulletins, and then a document would be like that whole URI technical library bulletin, and then PDF, and then a section you can see here would be like
[56:16] these, you know, you have a hash symbol and then the the section. Um so, I can I have this big containment view. Uh and that’s helpful because it it allows my agent to do more of an exhaustive search where it understands everything. This is what the graph data model would look like together, right? So, you have your containment relationships and sort of these has relationships. So, you start out at the folder level, then you go down to the document, and then you we do have next section relationships as well. So, there’s a
[56:48] sense of ordering, which is going to be important for a table of contents, right? Because when we have multiple entries, we don’t want them to be random. We want them to almost be like page. So, you would like if there was, you know, a diagnostics section after a condition or in this case a cause section after a condition, it’s it’s ordered uh in the way the document has it. Um and then the links to relationships, which are super important. Um and what we’re going to do with this uh is basically we’re going to load it directly into
[57:20] Neo4j using this script. And the great thing is, let me run it while I talk to you about it. And actually, I’m not going to physically run it. Um I’m pretty sure it’s idempotent. So, if you run it and idempotent means if I run it twice, uh, I’m not going to duplicate it in my data. Um, I’m going to skip running it though, just in case, um, I’m wrong and I made an error making the script and it actually isn’t idempotent. But, this process has the capability to be completely idempotent. Meaning, once
[57:51] you load it. So, go ahead and run run this yourself. Um, and, uh, basically when you run it, it’ll create all of those document nodes from from the PDF docs. We actually have a copy of them here, I think. Um, where would they be? They’d be under corpus. So, we loaded them into, uh, cloud storage, I believe. Um, if not, then they’re just pulling from here. But, it’s, you know, whether or not you load from cloud storage you load from locals pretty trivial. Uh, these are actually the, not the PDF,
[58:25] these are not the PDF’d ones. Um, these are the markdown ones, but we also should have in here the Would it be under Would it be under docs? Give me 1 second here and if I can’t find it, I’ll just look at the markdown ones. Um, sources, PDFs. Here they are. This is what, uh, Oh, it’s going to show me it in a in a gobbled up view. That’s no fun. Um,
[58:58] Do I have it pulled? I don’t. Um, well, they’re PDF documents. If you look at the markdowns, you know, the it’s just a PDF of the same markdown here. So, that’s that’s what they look like. And so, what that script does is it goes through and it says, “Okay, like, I have the different sections.” And it just has a deterministic parser that knows where the sections are. These links are, um, uh, you know, they’re not they’re not structured like normal URL links. Uh you
[59:32] can you can easily make the code so you structure it like normal URL links, but they they refer to other documents here and it will deterministically parse those into other nodes. Uh and what that what that looks like uh once it’s done loading, I can go down here and I’m going to copy another piece of my Cypher and go back to my window here. And I’m going to say, “Hey, like go to the uh library uh root node, basically, which is at the library’s like the top of it’s a root node of this whole thing,
[1:00:05] and go down uh four zero to four hops down, and I’m going to limit it to 50 cuz there’s actually a lot of nodes here and I don’t want to pull everything back.” Uh and then I can even select If I go down here and I go to hierarchical layout, it will lay it out hierarchically. So, you can see I have my folder. There’s actually three folders here, right? Because we have the um the bulletins, which it which it went down, but then there’s also manuals and we calls. And then you can see the documents and then all of the sections and the contents of that section underneath that. Um
[1:00:40] you know, and then the the has relationships and highlight them in orange. So, those are the has relationships. And then there’s also these links to relationships that we have, which you can highlight here in pink, and those go to different documents. And then like I can, you know, go to these documents and expand out and create this cool like, you know, interconnected graph thing where I can start to understand how everything uh connects, uh which is all really nice. And so, one thing this is kind of related to to Some of you are probably familiar with that whole Copart C like LLM Wiki thing where you have like documents in
[1:01:14] markdown and you have your your Wiki where you have the LLM like extract your research into entities and uh concept pages. This same process can be used to deterministically load that type of wiki into into a graph. Uh and I like this to start because we don’t do there’s no entity extraction here, which is great. Like I might at a certain point want to say, “Hey, like I actually want to extract parts and problems and concepts from these documents inside of my graph
[1:01:46] further.” And instead of just having you know these like folder document sections, subsections, like you know, nodes, I’d have, you know, part node and and person node and all this stuff. And that’s cool. Um but the great thing about this is it’s deterministic. You can get started running it immediately. It’s it’s all copacetic. It works great. And then you’re you’re sort of off to the races with your with your knowledge graph, which is why I like this example. Um But anyway, what what we do once we have that, let me erase this page here. Um
[1:02:19] is there’s um a spec that we have around the outline format, by the way. Um that just that just describes kind of how how everything works. But I’ll get into that a little bit here in the next section. Why why I mentioned that and why it’s important. Um one of the things that we do in this workshop or we’ll do for the next 40 minutes, however long I have you here, is we’re going to start to use uh the Neo4j CLI. Uh the Neo4j CLI is
[1:02:50] this thing here. So, I know I’m I’m going to be sort of showing a lot to you, but anyone that’s done text to Cypher 2 years ago with Neo4j and was like frustrated by how shitty Oh, sorry. How bad it was, uh which is normal. Um things are getting a lot better now uh with better models, but also because we’re creating tooling that gives you the ability to uh have a a CLI where the agent can actually run Cypher commands
[1:03:20] very easily, even spin up infrastructure for you. But really importantly, it can also install these Neo4j skills, which we keep updated. And uh these skills tell your agent how to do like work with all of our drivers, work with graph data science, work with um MCP, and write Cypher, the query language. Um which means that if you’re using this, your your agent can write really good Cypher. Uh so instead of and and the idea here
[1:03:51] is like I want to build that shape that I was talking about earlier. So I want to build the um where is a picture of it? Well, I want to build that outline shape, that table of content shape. And how do I get my agent to do that without me knowing how to write what is actually not going to be trivial Cypher? So if we if we I’ll copy this cuz this is going to be our um our command that we’re going to give our agent to do to basically build that for us in real time.
[1:04:25] Um and I have all this open. Close some of this off. So if we go into our skill, we have a whole skill here that’s going to help the agent basically do everything for us uh a little bit down the road in the workshop. But there’s our actual outline uh script, and you see here we have this wire where and this is going to happen to you a lot where you’re going to kind of know like
[1:04:57] um like what you want to write, like you’re going to have basically like a spec for how to build the query, but you’re not going to know how to do like specific parts of the query. So what we have in here is a spec that’s like telling the agent like this is kind of how I think I want to put it together. And what we can then go and do is I can ask my agent that question.
[1:05:29] Uh I’m saying, “Hey, use the Neo4j Cypher skill.” I have another spec in docs outline format and this built spec here. So, the spec in doc outlines format is here. This explains the format that I want it to produce. Yes. Maybe I didn’t start this with the auto thingy. Um so, this this this document explains how I want to put everything together for the agent. See? It’s nice and pretty. Um And so, this this pattern I just wanted
[1:06:00] to have it in the workshop so you can see uh Oh, did it finish already? No, it should still be working. See. What just happened here? Okay. And in case this doesn’t work, too, so it it already it already filled in the um the query. So, if I go to outlines um
[1:06:32] You see here it it already uh apparently put the query in. Um although I’m I just want to make sure of one thing here before I move on too far. Nope. Oh, don’t do this. Yeah, it did modify it. Yep. So, you can see here
[1:07:05] it uh went ahead and it it put in basically the rest of the query that I needed. Um so anyway, this pattern’s useful because it’ll it’ll help you um in your adventures with writing things when you don’t know how to use Cypher. Uh there is inside of here, too, a solutions folder, which I told it not to look at. So if it’s getting it wrong, you can just copy from the solutions um if you if you get a little bit lost there if you don’t want to wait for your model to uh to get through it all. And then but then basically once once that’s done, get rid
[1:07:37] of this good thing. I can um I’m going to open a new window. I can go ahead now and start running my my outline script. So I’m going to go ahead and copy that. Go back in here. And this is going to return the whole outline, so it’s going to take a while. It’s going to be huge. Um see, so like return the whole thing and not really very useful. Uh but what you can do with this is you
[1:08:11] can say, “Hey, go down to depth one or depth two or whatever.” Uh and then when you do that, it’ll uh the agent can use that and then I can do like, “Hey, go down to deep.” And then it will instead of just doing the high-level ones, it’ll give you under each one like all the all the pages. And then the other cool thing that I can do is I can be like I can take one of these. So say that one. And then I can go, “Oh, do do it for
[1:08:41] then I think I just put it at the end. Yeah. So and then it’ll give me just for just for that one document, what are the See, just for this Ridgeline whatever thing, uh what are the different sections and the things that it links to? And then I’m like, “Oh, it links to this. Let me go check out that page.” Right? So then I can be like, “Oh, I can go here.” And then I can check out that. So, you can see how this might be useful for an agent over just vector search cuz you can sort of like traverse through these documents in an intuitive way. And um
[1:09:13] it’s a little bit hard to see, but if I make it smaller, you’ll be able to see. And then I can I can have the agent kind of loop through and get all these different connections. Uh so, that’s that’s really nifty in the sense that um the agent that’s actually consuming this doesn’t need to understand Cypher. It just needs to understand what a table of contents looks like, which, you know, a lot of agents already know how to do cuz it’s it’s a pretty easy human task. All right, let me let me see what’s next in this guy here. Um
[1:09:43] there’s also a search query. So, I don’t have vector search in here, um but I do have full-text search. And so, the same pattern that we did before with uh what I was showing you for outline, we’re going to do with full-text search. And that’s going to allow it to search the titles and the contents of each PDF document and section. So, I can go back to the cloud session that I had. And I can say, hey, use the Neo4j Cypher skill.
[1:10:16] And then I have a spec contract inside of search. In this case, I don’t have a whole like document around it like I did for outline cuz it’s a little bit simpler. I can have it go and do that. The um the spec documents See, it made its little change there. Um inside of skills, I can go and look at search. And then uh I did have this built from spec. And yes, you can make the change.
[1:10:48] Uh and then once it makes that change, this will hopefully pop up with the change here really quick. Um Yep. All right, so it went and did that and then I don’t know why it’s not updating here, but if I were to open it again, maybe. Um But it basically what it it Why are you not Hold on here. Maybe I just don’t know how to use uh
[1:11:22] It might just be because it’s a sibling reference. It did It did update in the search document. Same pattern. I gave it a spec. It went ahead and uh updated it. It did update it in the cipher here. I’m just an idiot and I don’t know how to read. Uh so, you can see it updated here uh where it it basically is using um a full-text search uh here and then it’s also doing this other cool thing which I’ll show you in a second. Uh basically you can do a full-text search
[1:11:52] and then um I can I can ask for like top K documents. So, if I go back uh to my window here and someone yell at me in the comments or something if this is too hard to see. I promise I’ll try to read it. Uh so, I can go and it will give me a my top documents that are searched with that URI. These are actually sections. Um and you know, I can expand top K to
[1:12:24] be bigger like 10 and then it will give me 10. Uh that time the time before it was four. And then the other thing that I can do here is I can say, “Well, do it do a search, but do the search under somewhere inside of this library.” So, the whole library is hierarchical cuz it’s all these containment relationships, right? Uh so, one thing that might be useful is I just want to restrict my search to being underneath uh recalls.
[1:12:55] So, I say under recalls and then it will only give me documents that are under the the recall uh under the recall subsection of the library. And you can do that with any URI. Uh and again, I don’t use vector search mainly not because I don’t like vector search, but just because vector each vector is different and each embedding provider like they’re they’re not compatible. Um so, to make this easy to use, I just didn’t do vector search. You can easily put it in here and it would it would work fine. Just from an interoperability perspective, so I don’t
[1:13:28] have to deal with, you know, some people want to use open source models, some people want to use Gemini, some people want to use OpenAI, some people want to use Anthropic and then you end up like needing to like make up, you know, an option for for each different key. So, this is easy cuz, you know, it’s just it’s just text search. Um And then for check your understanding, it’s the first or I guess it’s 183 and 985 documents. So, to do this question, which is it’s basically if you were doing this by yourself, it’s a learning question to help you move on to the next
[1:14:01] step. Um you go back to your Let me move this over here so I stop getting confused with that. You go back to here and uh you say, “Hey, count the number of documents and sections I have.” Just to double-check, 183 985 um and that is the same number uh that we have here. So, just this quick sanity check. Uh and I think for this one um these next parts I think are fine to skip actually because
[1:14:34] a lot of this is um just sort of walking through kind of how the cipher works internally. Um and then there’s some optional library practice. So, these two sections here, navigating the shape and optional library practice, um are fine to skip for now. Maybe what I’ll do here is I’ll stop, and I’ll see if we’ll take a little bit of a break, cuz I feel like I’ve been talking about a lot of different things. We’ll see if we have any other questions, um and kind of do a pulse check of where everyone’s at
[1:15:05] in the room. >> Super. Sounds uh good. Let’s um Let’s hear in chat. Let us know if you’re struggling with something, if if you are uh up to date with where we are, or if if you need a little uh repetition of some some of the exercises. How long is the break? Uh well, a a a few minutes maybe. Uh We’ll try to get through a couple of um of questions. >> The questions, yeah.
[1:15:37] >> Yeah, go go for it. Um and uh yeah, let us know uh if you are in uh in and not not not kept up with what uh what Zach went through. There is one question um that I see we could we could probably talk about uh that came in a little earlier. Um and that was do we only need to document structure nodes, uh and no domain concept nodes?
[1:16:10] So. >> So, here, yeah, so I I was talking about this a little bit initially. There’s um To start, I’m not doing domain concept nodes. That was an explicit decision by me for two reasons. One of them is it’s easy to do what I’m doing right now. So, for people getting started with the knowledge layer, this step is is simple, and it gets you off and running very quickly.
[1:16:43] The second piece is that for the type of example we’re looking at, an an AI agent to a great degree already has the ability to infer entities and concepts that exist inside of your documentation. And so if you have a way for the agent to navigate that documentation and search it effectively, then in theory it can do a fair amount of the work without explicit entities. Of course, where that starts to break down is, hey, I’m now you know, I now have a huge amount of
[1:17:16] data and one of the interesting things in this graph is we actually have two disconnected graphs. So we have like a semantic layer graph and a document graph. If I was to go and actually look at what this looked like, what’s a good query for this? Let’s just match P equals I’m going to I’m going to bring back all the data. How about that? So, once I can get my Cypher right, and then return everything
[1:17:46] and fix my spelling. This won’t This won’t crash. Return my whole graph and do it in a force layout. So, see See what this graph looks like right now? We have um and it it’s still limited the amount of documents that it returned. I think. Here’s my document graph. And then here is my on the bottom here, here is my semantic layer ontology
[1:18:17] graph. There’s no relationships between the two. I’m letting my agent infer the relationships between them. Where extracting domain concepts would help a lot is if I wanted to link between these two graphs, which at a certain point is probably smart to do. As I get more and more data and I get like, you know, you think about it like if if I was getting really technical inside of like different you know, like car specs and engineering knowledge, I might not want to rely on my agent’s general understanding and
[1:18:49] pre-training to do that. I’m going to I’m going to want relationships here. So, those domain concepts will be helpful as you get more data and as the domain knowledge gets more specialized to connect and resolve these together. At the scale that I’m working with, this I can I can get away with and I can have my agent kind of infer the connections between. >> Cool. >> So, yeah, long answer, but hopefully it’s helpful. Let’s um >> Should we Yeah. You you say.
[1:19:19] >> Well, we can do one or two more questions and then I think we should move on. >> Okay. Uh I think most of these go a little bit down different paths, so let me see if there’s something that is more closer to what we um I have here. There’s one question on is there a way to document and view the data model or the knowledge layer? I think what you just showed probably. >> Um Yeah, I mean, so we have the view and browser here. Um you can call the schema.visualize
[1:19:52] here. Um why is this telling me that I’m wrong? Visualization, that’s why. Spelled it wrong. And you can you can look at what your data model looks like. So, you can see again we have the Here is the um the Neo4j data model. Here is my document data model in the database. Um also with inside of the Neo4j CLI, I’ll just jump ahead and I’ll I’ll show it to you really quick. Um
[1:20:24] you can do stuff like this where I can I can actually call for the schema. >> Mhm. >> So, go back to my thing here. Say, “Hey, can you bring me back the schema?” Um and it’ll tell me, “Here’s my constraints.” So, like unique IDs. I’m zooming out just so it it renders well inside of the inside of my terminal. But, you can write this out to JSON, too. Um and then I have my indexes.
[1:20:56] I have my relationship paths. All this sort of stuff. Um and my nodes. So, there’s different ways to to pull these schemas and visualize them, if that’s the question. >> Okay. Cool. >> [gasps] >> Uh let’s save the others for later so that we at least have time to com- plete what we want to show in this workshop. >> All right. Awesome. So, uh I’m going to move on to the next shape now. And this is going to be the theme shape, which um might be one of my favorite shapes. Not that I have a favorite, but I kind of like it because
[1:21:28] it uses graph data science. And I used to be I was the our first graph data science technical marketing person, so I just I like it when I get to when I get to touch graph data science. I’m going to pull back um another view of the graph here, which I’m going to say, “Get me all of the links to relationships.” This is when a document links to another document. And the interesting thing is when you look at this graph once it comes up cuz I’m pulling back a thousand things, it might take it a little while here. Um
[1:21:58] you’ll start to see different clusters will form in the graph. So, like you’ve got like this thing over here, right? Which seems to be centered around this ABS stuff. Um and sensors, right? And then you’ll have like other stuff over here. Uh control module. What’s this guy? Um communication control module again on this node. So, you start to understand that as you as you aggregate more and
[1:22:30] more data, the links between your documents are going to start hinting at deeper underlying patterns. I think that’s pretty simple. I think we understand that kind of from a graph perspective. So, what we what we want to do is find a way to understand what these clusters mean and like importantly for, you know, you can imagine in this this is more goes towards like imagine you’re like a VP of auto fix or something or you’re making a report for senior leadership and you’re like, what are like the big things that we’re documenting? How do those things relate
[1:23:03] to what’s actually going on in the field and what’s being fixed on the line? And like, is there a place where we’re missing documentation? How do we sort of do or even if it’s like a customer segmentation question, you can imagine there’s all uses for this type of clustering. We we want to find a way to do that. And what we want to be able to do is find an easy way to give our um this is going to be hard to view because of how this window is is rendering this, but basically, I want to create these themes where I can name themes inside of
[1:23:38] the graph. So, here what I’m doing is I’m I’m going to say, well, if I have all these documents, how can I group them into these groups? And the names instead of doing something and again, we can do this this thing where we like use an AI model to create this domain-specific name that it infers from every group. What we’re going to do here is instead just say, what are the top shared target documents and most linked documents inside of each of these
[1:24:08] clusters that we identify. And that in a sense will kind of give us an inferred name cuz like we’ll get, you know, these like um communication stuff of in this one, we’ll get another one about brake stuff. And then we’ll get another one that’s like all about like pressure sensors. Like those are the documents being referred to. And so even without like having a very fancy process that like does this sentiment naming thing, um, just using the documents themselves, we can kind of infer a lot, um, by
[1:24:43] creating this shape again for our agent to look at. And uh, we’re going to do this with, um, with a with a graph algorithm called Leiden. And we have a way inside of that graph algorithm to say like how tightly interlinked these different, uh, communities or themes are going to be. Um, and it’s a it’s con- it’s conduct- conductance. I always say conductance, but I think it’s, um, where is it? I’m I’ll pronounce it here somewhere. Um,
[1:25:14] yeah, conductance. Um, which is basically, um, it’s it’s a measure of like how It’s like how many are how many links are in between the clusters versus inside a cluster or a theme. And we can use that to measure kind of, you know, how well the the algorithm did or how naturally the graph clusters, um, just to start with. So we have a themes format markdown document. So in the same agentic coding spirit, uh, inside of here, I’ll make this bigger again.
[1:25:51] We have our themes format document. And where we describe the shape that we want, we describe the types of things that we want on our headers, the number of documents, the number of groups and themes, shared cross-references, um, how we want to define cohesion, uh, Like by tightly moderate loosely interlinked, top shared targets, most linked stuffs. Um
[1:26:23] the algorithm itself will produce theme IDs for every node. That’s how the community detection detection algorithm works. And I’ll show you what the query actually looks like once our AI model effectively helps us write it. So there it is and then the scripts file uh in the same sense we have our sort of spec right? Build from spec. Um we’ll see commands in here like GDS graph project and some of some of this
[1:26:54] stuff. Um The Leiden calls uh we make I think what are we doing from spec? Um I think the the the hint here is like how do we uh create the the graph projection basically? Um and we’re actually going to provide a little bit more guidance around the here’s how we call the Leiden algorithm. Uh and the conduct the conductance metric con- conductance gosh the conductance metric.
[1:27:24] I said it right the first time. Uh and then basically what we’re doing here is we’re going to be doing this Leiden algorithm that will say hey how can I cluster the nodes based on these links? Uh and then we’re going to write that to the graph. That’s what a lot of this is and then some of these queries are is just logic on how do we pull that back out of the graph again to create the view? And I recall why we have the spec here now that I was just talking about it.
[1:27:55] What we actually want to do here is cuz links are between sections. So when I had this graph up not this one when I had this up before uh if I look at the types of nodes here there’s sections. We actually want to aggregate this, I think, to the document level. In that way, it’s it just creates a cleaner graph. And then we want it to be a bipartite graph or an undirected graph. Or no, do we want it to be undirected?
[1:28:29] Now I’m talking too much. Links to target collapse both ends to their owning document. So we collapse it up to the document level. So that we’re not cuz otherwise we would have documents with multiple sections that link to something and it it’s it becomes a lot cleaner if we basically aggregate the graph up to documents and look at just links between documents. And then we do Yes, undirected type. So we do do the we do do the projection undirected, which
[1:29:00] just basically means that when two when one document links to another it’s it’s sort of like a bidirectional link. It it helps the lighting algorithm run more effectively the way that it’s supposed to instead of having a directed relationship. We’re basically saying if document A links to document B, then document B is like just as related to document A as document A is related to document B. It’s not like document A is related to document B and document B isn’t related to A.
[1:29:31] So I will leave it there. I probably said too much about that cuz I don’t want to make this a course in like graph projections and undirected graphs versus directed graphs. It’s probably going a little bit too deep. But if there’s a question on it, we I can elaborate on it a little bit more. So if I continue on here, what I’m going to do is do the wire here. So
[1:30:02] go back into my agent and I’m going to it to create this again. Now, if you notice here what I’m doing is I’m saying, “Hey, use the Cypher skill, but also use the graph data science or GDS skill.” That’s in charge of running that Leiden algorithm and doing those projections. And you see it just did the projection here. Um and it was able to do that document aggregation. Um it just matches sections to the documents. And then did this like URI
[1:30:36] split thing. Yes. I’ll let it run here for a second, and I’ll go through and copy basically what it now will look like to run this themes query. Um so, it looks like it did that well. And if that works, then we can go to our bash script here or our bash terminal, rather.
[1:31:09] And we can run themes. And then it will bring it back. Um and we’ll get our view here. So, now we see these are the basically themes, 13 themes throughout our documents. We have our so, this BCM and communication stuff. Brake stuff is T2. Theme three or T3, pressure sensor, pressure sensor stuff. Here’s the documents that are involved. And you just keep going down, ignition coils, um catalytic converter,
[1:31:43] um oxygen sensors. Um so, if you know a little bit about cars, uh this stuff should be making sense why it’s grouped together. Um in inside of the same uh inside of the same groups. So, we get to understand the themes inside of our documents. And then what we can do with that um oh, we can also turn the So, I’m not going to run this I mean, I can. There’s a gamma parameter that controls granularity, and you could turn up the
[1:32:16] granularity. It’s not going to make a huge difference inside of this uh data set. But, basically if I turn gamma up to two, I think one is the default. It’ll give me more communities if I do that. And that might be useful like, you know, sometimes, you know, you want to tune these algorithms. Yeah, it So, it gave me 14 themes instead of 13. So, it’s not a huge difference here. Um but there’s there’s ways to basically tune these algorithms.
[1:32:48] Um this question uh I actually think I need to go back uh to our graphic academy people and fix this. Every document should have a unique theme ID, um I believe. If that’s not the case, then I might have to go back and fix it. But, the way that you answer this question to move on, you just say most documents carry a theme ID grouped into two or more themes. Um I think the rule is actually supposed to be that each theme has a unique each document has a unique theme ID.
[1:33:21] Um but it may also not have a theme ID. So, there there’s um And oh, no, wait. Now I understand the question. Okay, I’m I’m getting my one to many and many to one uh things confused. Forget everything I’m saying. Theme IDs are going to be community IDs. So, there’s 13 community IDs. Each document will have a single theme ID. Um and or they might have a null theme ID if they weren’t able to be put into a group. That is the correct answer to this question. A is what you would say to
[1:33:52] move on um to the next piece here. And uh what happens next? There’s some cool questions you can try from here. So, like, where issues concentrated, for example, um, I can go into my, uh, agent view here. And, I can ask it this question about like, “Hey, where are issues concentrated?” Sometimes with some of these smaller models, I have to give it a reminder to use the auto fix scale. Um, or else it’ll go in and it will like try to it’ll think you’re talking about
[1:34:27] like GitHub issues or something. Um, and it it will know to use the themes here to to work that out. And it will look at like it’ll basically do this process of like, “Oh, let me, you know, go and look at the different themes and then, you know, get everything, you know, concentrated and then look at, you know, how they connect, everything else.” Um, inside of the warehouse. So, then it will fire up like the warehouse piece. Just look at the work orders, which it’s doing now. Uh, so that’s that’s kind of cool to
[1:34:58] see. We’ll ask more questions along these lines as we get, uh, deeper into the course. Um, and so it it’s able to find like, uh, you know, the original question is where issues concentrated. Concentrated in ignition coil and misfire repairs. Um, that’s for the come backs and the volume doesn’t concentrate anywhere in particular cuz the 15 troubleshooting codes I pull each have about 300 workers work orders. Um, so it ran this by looking at the themes and then going back to the warehouse and doing a SQL
[1:35:29] query to pull back like the different codes and stuff that fit into those themes. So, kind of cool, uh, the way it’s the way it’s able to connect those two pieces of data together. Um, and then from there, I’ll stop here really quickly cuz I think again, um, for these for these next ones, uh, it’s going to be going into Cypher a lot and I don’t want to really do that given the amount of time we have in this course, sort of optional practice. So, I’ll stop here very quickly. We’ll take a couple minutes for questions and then we’ll move on to our next two
[1:36:02] lessons. The one lesson is going to be really short, like 5 minutes, and then we’ll spend the majority of our time on that last lesson. >> Sounds good. Thank you, Zach. Um there is one question uh that came up with a theme rather that came up a couple of times is um what would be the challenges for adopting the workflow that we we implemented here or shown here today in a different context such as, you know, telco or supply chain or in any other other use case? What would that be?
[1:36:35] You know, how would that work if you have different >> Well, yeah, I’d say that everything that we’re doing here, if you actually look at our schema, it’s um it’s a it’s not a use case specific schema, right? Like look at how these nodes are labeled. We have documents and libraries and sections. And then we have uh the like schema stuff. So, this could if you just looked at this schema, this could be for telco or supply chain or fin serve or anything,
[1:37:08] right? Um so, it this can be a starter for just about any use case. Now, that being said, you know, your data kind of needs to be in a certain spot for this to make sense right out of the box. Like you need documents that are somewhat well-structured for, you know, this hierarchy of documents and links to to be able to fire correctly. And likewise, you kind of need like a data warehouse or something or some sort of relational database for this to work. Um
[1:37:40] you know, putting your data into that format may or may not be challenging depending on where you’re coming from. But the great thing about this is that most projects will start out with some form of structured and/or unstructured data. Uh and if you can start with something close to here and augment it like for Telco or supply chain and by me necessary to like have other elements that said like in the supply chain you might have to do some structured data import, same with like Telco like you might want a digital twin of your power
[1:38:11] grid in there at some point. Uh but this is sort of like your think of this is almost like your your foundation starter type of ingredients that you can then build on and augment and maybe you take half of the schema and use it or 70% of it and then you you try to you know fit in some of your other pieces. So, hopefully that makes sense. >> Yeah. Cool. And maybe one more. >> yeah. >> Yeah. As another [clears throat] um is whether the semantic layer is meant for managing documents or for managing data
[1:38:44] in a data mesh. For example, on top of data data product endpoints and then you know how how should the agents basically consume the data through through these API endpoints or through a direct graph uh connection? >> So, that’s a good question. So, if I understand it correctly, the the question is not like well, I don’t really want to access the data through SQL, I want to access it through some other microservice or like endpoints. Um >> Yeah. >> Because the data is exposed differently through an API. So, Ryan, I don’t know, do we have anything in Neo4j yet that
[1:39:18] does like a mapping to a data mesh or API endpoints or like I know we have virtual graph for some like Microsoft products, but >> Yeah, I don’t I don’t know not that I know of. We we have an MCP server which agents can use and that’s the typical pattern I’ve seen but yeah, but not like a data mesh which would actually be a great addition. >> Yeah. Yeah, so I don’t think we have that yet, but it would be an interesting idea and if you, you know, yeah, I would love to see something like that and I and you know, it’s we think about these things
[1:39:50] quite frequently. Um but that yeah, that would be a great addition. I don’t think we have it here yet though. >> Sounds good. All right. >> Thank you. >> Cool. All right, we only have 20 minutes left. So let’s see if I keep us honest about being able to get through everything. The next section I’m not going to spend a lot of time on because we already talked a little bit about it and it’s about our Neo4j client that we’re using. So this client I already went over the shell here. It’s very easy to install. Uh it won’t
[1:40:25] just work with um with client either. You can use it for code X um and for a ton of different types of agent harnesses. Uh you start with the bash script and it will auto sense the the harness that you use. I think at some point here it’ll say uh all the different uh clients it works with. Maybe in quick start. Well, it’s in somewhere in this documentation it will say um all the different agent harnesses it works with. Um but it’s quite a diff
[1:40:58] it’s quite a few. It’s pretty much all of them. Uh and that allows you to run Cypher directly inside of the shell. So for example, uh when I was back on my thing here, I can write my Cypher queries in the shell and get results back. So quick Cypher query and then it will give me results back. I
[1:41:28] can format that to JSON or or however um as well. And then uh it will also allow me to get schema information, like we showed before. And uh what’s great about this is that it the agent can now access this CLI. And in addition to accessing this CLI and understanding how to use the skill, uh it can also do things like uh you know, spin up infrastructure for you. So, if you’re you can manage Aura, for example, from the CLI. You can add
[1:42:00] databases, uh get information about them, spin them down and up. Then the other thing that’s really important was what I was talking about earlier, which is getting these skills. So, that spec-driven development that I was showing you before was through that Neo4j CLI and that skill bundle that it installed. If I go there again, right? It’s all of these skills. Uh so, if you look at um for example, the GDS skill, you get these, you know, skill MD files that tell the agent how to use it,
[1:42:32] what to check for. It’ll have references to all the latest and greatest. So, instead of your agent using like 3-year-old Cypher from some, you know, I don’t know, from some, you know, Stack Overflow, you know, thread that it scraped from like 2021 or something, it’ll use all of our new Cypher um and and everything you need to to run really effectively. So, I highly recommend if you’re doing any form of agentic coding, uh to check out the Neo4j CLI because
[1:43:03] we’re using it here and it helps you uh use Neo4j very, very quickly. That is all I want to say given the amount of time that we have on the Neo4j CLI. And so, the last thing that we’ll do is start putting this together into some more complicated questions. So, um if you sort of move through the course to this last lesson, uh if we some of these questions that we’re asking, and we saw it a little bit in
[1:43:33] what I had put earlier is like if we ask about you know, like, you know, what fixes um a certain issue on a car, it’s going to look at documentations. And then it’s going to need to look at candidate parts. And these two things live in different sides of our data. One of them lives in our documents and then the other one lives on the warehouse in the structure data side. Um and then it needs to return that at, you know, the answer to that question with with evidence. Um and so what we’re attempting to do
[1:44:05] here is basically keep this process honest. And we’ve developed a whole skill inside of the workshop here. Uh if I go to the skill to do that. So, you can see uh there’s certain things that I that I’m saying don’t go to cuz just for the sake of the course, like don’t look at our solutions, right, to answer questions. Um describes the graph,
[1:44:35] describes the outline, the search tool, and the themes tool. Um you know, how to basically use uh read different aspects of the database. Um this sort of shapes first mentality that we’re using. Some examples or exemplars of things that it needs to uh that it needs to think about like at certain types of questions and how to answer them. Uh and then basically some common sense stuff like grounding your answers, um using evidence, all this all this
[1:45:08] kind of stuff. And it has those outlined in the search and the themes uh from before. And so we can go ahead and if we go to continue, let’s continue. We can start asking these questions and having it traverse both sides of it. So, the first one is for a VIN and let me just plug it in and have it cuz it sometimes it takes it a minute here to to answer. So, while it’s spinning, we’ll talk about the question that’s being asked. So, here I say, “Hey, for this VIN number with a certain code, what was the
[1:45:42] fix on similar vehicle?” So, to get this information, it’s referring to something in the database. And then, it’s going to have to look at fixes for similar vehicles. And then, you’re going to have to explain the steps and the shapes that you use and I’m telling it not to use the Neo4j client, mainly because um sometimes it will try to sidestep our procedures like our search and themes and outline procedure and just use the Neo4j client by itself. It already returned a response.
[1:46:12] And what I like to do is just look at sort of the steps that it used. So, in this case, it searched for the issue inside of our documents. It used the warehouse shape to look up the vehicle stuff. It filtered to a specific code and then it did a second search under this bulletin to confirm the suppression and repair procedure um for there’s there’s one part that basically like superseded another part. They think it was like faulty or or retired it or something. It’s like the IC 2042B comes after IC 2042A.
[1:46:49] Um Sonnet is going really fast today, which is nice. Normally, I’m used to this taking a little bit longer when I use uh Opus. So, anyway, it went through and it basically searched both sides of the graph with that, our knowledge layer. Um we can ask more complicated questions, too. Like, for example, here, this sort of a state that’s proving a negative. And in this case, what we’re asking is more of like a higher-level question that someone making a report, not necessarily someone working on the um
[1:47:21] on the floor of, you know, like a a mechanic might ask. But this is are there mismatches between our documented procedures and the actual problems in the field, what documentation is missing, and what documentation isn’t being used. So that’s that’s an interesting question that if you’re like, you know, thinking about this from a management perspective, um do we have all the documentation we need? Are we running our, you know, business effectively basically?
[1:47:51] And this one might take a little bit longer to run. Um but while it does that, what I’ll do is I’ll go over and cuz we only have 10 minutes left and I don’t want to like take forever with the with the workshop, is here’s here’s another type of question that might be interesting, um which is similar to what we were looking at before, which is what are the common patterns across our bulletins and recalls, and how many of our cars are affected by these patterns? And bulletins and recalls, right, are like
[1:48:22] issues with cars, with vehicles. So this is a this is a question of saying like, well, what are the issues and how many of the repair orders that we get in are actually having these issues? And break it out into common themes, so it’s not like every single issue by itself. So what I’ll do here is maybe I’ll just go into this next fast sec path bash uh terminal here, and I’ll enable auto mode
[1:48:53] with an extra dash there, and I will go ahead and ask this question. Um we’re we’re also on Let me just check that we’re on Sonic. And we’ll go ahead and get that question spinning. Some of these questions, because they’re more complicated, they’re just going to take longer. And that’s fine. I mean, I I we expected this. I expected this to begin with. So, if it takes a few minutes for these to return, um that’s totally fine.
[1:49:25] Um but, what’s going on here is it’s doing more exhaustive searching, and it’s going between the two sides of our graph to be able to to be able to find these responses. Um I’ll take Well, that it might take a minute here to run. So, let me see if there’s something else we can talk about in the meantime. Um cuz we’re right about at the end of the at the end of the workshop. The right fix for this, it actually came back on our first one. Um
[1:50:00] we were looking at it in the response. There’s this revised coil ignition coil that it’s supposed to use to to fix this issue. That’s the answer to our first question, by the way. So, it’s B here for this one. Um proving a negative, um I believe these are we’re waiting on these to come back here. Uh Actually, one of them came back. So, this was the question about are there mismatches between our documents and procedures and actual problems in the field and what documentation is missing? So, here what it did was
[1:50:34] uh it went to the warehouse, um and it ran some SQL basically to enumerate all the codes. Um and then in here, it chose to do a search with search.py. Um and it has some limitations here, which are interesting. Um because I really wanted it to actually use the outline.py. If you look here, it couldn’t enumerate codes that appear in documents, but not in the warehouse. The search can’t list an outline.py show document titles, not codes inside. So, here’s an interesting example of
[1:51:08] where like I really wanted it to use outline.py to connect documents together to what was in our work orders. And it didn’t here because the document codes weren’t part of the title of the documents. So, to those people asking like, well, when should I extract nodes from my uh documents? This would be a really great place to do it, right? Because then you would have the ability to navigate the connections between uh in this case your specific parts instead of just using search, which is really what I intended. Um but you can see here
[1:51:42] how some of the formatting of the data is really important. And it’s still able to do this by looking at the data warehouse and then performing the search. Um outline would have been better cuz instead of doing an exhaustive search, it would have been able to have basically jump between all the documents and links. Um and it would have made this return much faster. Um but you can see basically the answer that it gave here. Um there are mismatches in both directions. Uh the clearest one is the two high-volume troubleshoot codes that
[1:52:13] the library doesn’t mention at all, which is 335 and 340. And in fact, if we go back uh to our question here, it enumerated field codes agents of the document library, which pair of fault codes is failing in the field but has zero documentation anywhere in the library. And that would be this one here. Um and yeah, so that would that would that would complete the lesson if if we um but then but then for the last question, um cuz we have a few more minutes left. And then I’ll go to your questions after this.
[1:52:44] Uh we have what are the common patterns across our bulletins and recalls and how many of our cars does this affect? Uh it finished returning that. And we sort of answered this question before, I think, kind of when we were on that theme section. Um but here basically uh we see it returned 13 system-level repair family. So, those are the themes directly. Um the bulletins and recalls repeat one pattern. A single name component fails. The documents show which part failed and
[1:53:16] many say revise part replace it. The fleet is at least 821 of them or 48% have a repair using one of the four superseded parts below. Um and so it it lists those parts here. Uh so, some of this goes back to how we synthesize because I synthesized it to be a lot of this sort of superseding replacement part here. But you can see it’s like identifying like, “Hey, we have, you know, a ton of, you know, these ignition coil and timing belt issues.” Um and those show up sort
[1:53:51] of under that um that one theme that contains them. Uh so, for comparison, the revised parts have few come backs. The other families follow the same shape with a lower comeback rate and vehicle counts. So, this is saying like the family, these are like the the families and then all the um parts in vehicle fixes underneath them. Uh so, the theme shape cover the whole library across all questions um about the different recalls and and
[1:54:21] bulletins. So, basically what it’s doing here in summary is it’s identifying these themes and then the fixes that fall under these themes. I wish it visualized it a little bit better here cuz it’s just sort of saying the it’s not saying the theme these fall under. Um and it could be my my use of Sonnet instead of Opus. Uh but it can identify like the ignition coils, um you know, are are a big area for example, a big theme inside of this repair shop or or series of shops. So, anyway, that’s that’s the workshop.
[1:54:56] Um there’s another section inside of here that covers basically like the fact that you can port this pattern to not just to data bricks but really any data warehouse. I’m not going to go through that here cuz a lot of it’s more conceptual. Uh so, you know, just just to sort of bring the point home, this here is is what we went over, this pattern. And this pattern works with any warehouse and in theory any sort of set of documents in cloud storage. You would
[1:55:28] have to make some changes to the scripts, but it’s schema agnostic, so it’s meant for you to apply anywhere. So, with that, I’m happy to answer questions uh until we reach the end of time and I can go a little bit over Alex if you if you’d like. >> Super. Uh amazing. Uh thank you very much Zach and Ryan for for the workshop. Thank you very much to Martin uh for answering questions in the in the back. Thank you everybody for for watching. Um I think we covered uh all of the questions. I don’t think Oh, well, there
[1:56:02] is one. All right. Let’s Let’s do a couple of it maybe before and if people have to drop off, thank you for for watching today. Thank you for your question. Thank you for participating. Root notes continues next Thursday, so if you are not registered for the next workshop, that’s going to be covering virtual graphs. I have shared the link in chat. Um check it out, uh register, and join us next Thursday. Hopefully, you registered for notes if you like the event and if you like what you see here, then please share it also on your social media. Um would be nice to get a little bit more folks to to join our workshops and and notes itself. And uh with that, um
[1:56:35] yeah, I think we have a little bit of time uh to cover um a couple of questions. Other than that, uh feel free to to drop off, obviously. There’s one um that asks, “How difficult or easy is it to update document graph if there are changes in the documents?” So, the great thing about the way we’re loading data here is that it’s all uh programmatic. So, you can re So, if there’s a change in a document, you can if the document’s sort of corpus is small enough, you can remove it and
[1:57:07] re-upload the whole thing. There’s another project that I have called knowledge index or key. If you search for Kaparthi Wiki with Neo4j and my name Zach, you’ll find a blog on it. And that project actually has a way to do a change in part of the document tree. So, like imagine you had, you know, you were loading like tens of thousands of documents or more, you wouldn’t want to like blow the whole database away and reload the whole thing. And so, there’s a way to like focus on part of that tree and like just
[1:57:37] reload that. So, I’ve open-sourced code for that. Um and so, yeah, that’s, you know, with with this simple thing where we’re going off of document structure, that’s pretty easy to do. There’s some complications around it, but the but it’s it’s definitely possible to update it and it’s not too hard. >> Amazing. I just checked I think I found the link uh to your blog. I just shared it in chat. Yeah, exactly. It’s this one. Uh KG also found it. Perfect. Um
[1:58:08] And then, another question, how do I handle document with versions? I think that’s the same question, right? Close to the same. >> Yeah, I mean, it’s it’s similar, right? So, like uh a lot of times it and it depends like for for some workflows, people or store their documents somewhere where there’s version control, the source documents, whether that be in cloud storage, you can have version control, or if it’s in Git, you can version control it. And then, you use the graph as a means of searching, like a downstream sort of not the data the file system, but where you actually
[1:58:41] expose it for search. Uh so, that’s one way to handle it if you don’t need to read revisions. If you do need to read revisions, you can have you just make your schema so that you have like a revision ID or you have a document that points to its revisions. And then whenever you do a query, you can like use latest revision as part of the properties. It’s a little bit more complicated. Um but you would basically make your own custom data model if read of revisions was important. If reading of the revisions isn’t important, you
[1:59:14] just want the latest, use some other version control system with cloud storage or the file system or whatever would be my first instinct. >> Cool. All right. I think that’s that’s it uh at the end of the workshop. Thank you very much again uh Zach Ryan for for running us through, for helping uh with questions, and obviously for developing the workshop in the first place. I think it was very very interesting, very very uh good feedback in chat. As I said in the beginning, the workshop in itself on Graph Academy will be available for you forever. Um as we said also in the
[1:59:47] beginning, the API keys for Entropic and the uh uh the Entropic um access will unfortunately not be able to keep uh up, but you can like we said, you can use uh BigQuery or you can use your own um API keys to to run it. It should be relatively low um low on the cost side, so it should be possible for you to to replicate that on uh your own um and um the video is this was recorded, so the video um will be in your inbox probably um tomorrow at this time. Uh it’s going to be processed and will it
[2:00:20] will be ready for you, so you can obviously watch this at any time. And yeah, thank you for watching, thank you for attending, thank you for questions, thank you for participating, and paying attention. Um and I hope to see you next uh week on uh Road to Nodes with virtual graphs or somewhere else uh at any event or conference. Until then, have a good one. See you soon, and bye-bye. >> All right. And one more thing maybe before we go, we have a startup program. Um um so I’ve I’ve been told Alex we should mention this and
[2:00:54] I’ll do what I’ll do is just go to I think what is it? neo4j.com/startup. >> /startup, yeah. >> Um so if you are a startup and you want some free Aura credits, uh go ahead and apply. Um and you know, we offer help and we offer free Aura usage. Um so it’s a pretty simple application process. Uh and yeah, we just wanted to we just wanted to throw that one out there before before you left.
[2:01:25] All righty. Okay, thank you. I am done now. All right. Thank you, everyone.