GenAI Courses


LLM courses on Neo4j Graph Academy

https://graphacademy.neo4j.com/courses/llm-fundamentals/

https://graphacademy.neo4j.com/courses/llm-chatbot-python/

https://graphacademy.neo4j.com/courses/llm-chatbot-python/

https://www.youtube.com/@neo4j/playlists

Semantic Kernel

https://www.linkedin.com/learning/introducing-semantic-kernel-building-ai-based-apps/what-is-semantic-kernel

https://github.com/microsoft/semantic-kernel/tree/main/python/notebooks

https://github.com/microsoft/globalopenaihack/tree/main/SemanticKernel

Intel

https://learn.activeloop.ai/courses/llms

https://www.intel.com/content/www/us/en/developer/topic-technology/artificial-intelligence/training/overview.html

Databricks

https://www.databricks.com/resources/learn/training/generative-ai-fundamentals

Nvidia

https://www.nvidia.com/en-in/training/online/ Select tab "Generative AI / LLM"

https://www.nvidia.com/en-us/events/llm-developer-day/

Other relevant websites

https://www.classcentral.com/

https://www.careers360.com/

https://www.mooc-list.com/

Semantic Kernel


Semantic Kernel is an Application Framework (SDK) by Microsoft. It is used to develop many co-pilot software e.g. github co-pilot. Other such frameworks are:

- Semantic Kernel (Microsoft)

- LangChain (Open Source) 

- FIXIE (Enterprise Grade)

- Vertex AI (Google cloud)

- griptape

- HumanLoop

- Beam

=========================================================

Semantic Kernel has (1) skill (2) prompts (3) AI Services (4) Connector (5) Kernel (6) Planner (6) Plugins

Skill is a set of functions. 

The functions are divided in two types

1. Semantic Functions : User defined functions

2. Native Functions: It has core_skills like TextMemory, ConversationSummary, 

FileIO, HTTP, Math, Text, Time, Wait (calendar etc.)

Kerenel class has RunAsync method. It has 1+ SKFunction objects

Prompt has (1) skprompt.txt (2) config.json

AI Services 

  • ChatCompletion
  • Embeddings
  • Embeddings.VectorOperations
  • ImageGenerations
  • TextGenerations

Connector has (1) AI Service Endpoint and (2) Memory

AI Service Endpoint
  • HuggingFace Interface API
  • HuggingFace Local
  • Oobabooga
  • OpenAI
  • OpenAI.Azure
Memory
  • AzureCognitiveSearch
  • Chroma
  • DuckDB
  • Kusto
  • Pinecone
  • Postgress
  • Qdrant
  • Redis
  • Sqlite
  • Weaviate
Kerenel, Planner and Plugins are part of Kernel Orchestration 

Kernel

Kernel decides model, memory (database) and planner. 

We can configure kernel using Configruing Kerel. It has following Runtime Properties
  • AI Service
  • Template Engine
  • Logger
  • Plugins
  • Kernel Config Class
Planner is about 'Plan Object Model' It has following types
  • BasicPlanner: A simplified version of SequentialPlanner that strings together a set of functions.
  • ActionPlanner: Creates a plan with a single step.
  • SequentialPlanner: Creates a plan with a series of steps that are interconnected with custom generated input and output variables.
  • StepwisePlanner: Incrementally performs steps and observes any results before performing the next step.
Plugins are for following usecases
  • MSGraph (C#)
  • Document and Data Loading (only word in C#)
  • OpenAPI (C#)
  • Web Search Engine
  • Text Chunkers
=========================================================

Issues: 

  • The memory is constructed every time during setup. 

https://medium.com/@kcwayne1219/exploring-microsoft-semantic-kernel-a-newbie-developers-journey-902f58091504

  • Loading hugging face model

https://stackoverflow.com/questions/77110608/loading-a-huggingface-model-with-microsofts-semantic-kernel-in-c-sharp-vb-net

https://github.com/microsoft/semantic-kernel/blob/3451a4ebbc9db0d049f48804c12791c681a326cb/samples/apps/hugging-face-http-server/inference_app.py

https://github.com/microsoft/semantic-kernel/blob/3451a4ebbc9db0d049f48804c12791c681a326cb/samples/apps/hugging-face-http-server/utils/create_responses.py

  • Add Support for running local models using Ollama
https://github.com/microsoft/semantic-kernel/actions/runs/6527865286/workflow

Github

https://github.com/microsoft/semantic-kernel/tree/c4ef6ab227fc967ab12291cc862852e66d6d75ae

Documentation

https://github.com/MicrosoftDocs/semantic-kernel-docs/tree/main

Reference 

https://devblogs.microsoft.com/semantic-kernel/page/5/

https://build.microsoft.com/en-US/sessions/31e11443-70d3-4020-8c8c-0a654bccd233

Vector DB and GenAI Stack


Vector DB is an important part of genAI stack. It is useful for word embedding. 

In simple terms, "Word embedding" : encode each word from training set as vector. It is a representation of a word. It encodes the meaning of the word in such a way that words that are closer in the vector space are expected to be similar in meaning. It is useful for syntactic parsing and sentiment analysis. The whole vocabulary is vector DB. It is useful for sequence prediction.

How Word Embedding works? The OpenAI word embedding model lets you take any string of text (up to a ~8,000 word length limit) and turn that into a vector with 1536 dimension. So word has 1,536 floating point numbers as attributes. These floating point numbers are derived from a sophisticated language model. They take a vast amount of knowledge of human language and flatten that down to a list of floating point numbers. 4 bytes per floating point number that’s 4*1,536 = 6,144 bytes per word embedding—6KiB.

Here is the curl command to invoke API

curl https://api.openai.com/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{"input": "Your text string goes here",
       "model":"text-embedding-ada-002"}'
https://platform.openai.com/docs/api-reference/embeddings/object

The word embedding is stored in vector index

Use Cases

  • Search (where results are ranked by relevance to a query string)
  • Clustering (where text strings are grouped by similarity)
  • Recommendations (where items with related text strings are recommended)
  • Anomaly detection (where outliers with little relatedness are identified)
  • Diversity measurement (where similarity distributions are analyzed)
  • Classification (where text strings are classified by their most similar label)

Similarity 

1. cosine similarity

It only gives direction

cosine = dot product / magnitude

= (x1*y1 + x2*y2 +.... x1536*y1536) / (square root of (x1*x1 + x2*x2 +... x1536*x1536) * square root of (y1*y1 + y2*y2 +... y1536*y1536) )

Facebook AI research has optimized version https://github.com/facebookresearch/faiss

https://en.wikipedia.org/wiki/Cosine_similarity

2. Euclidian similarity  


Vector DB Example:  

  • Chroma, an open-source embeddings store
  • Elasticsearch, a popular search/analytics engine and vector database
  • Milvus, a vector database built for scalable similarity search
  • Pinecone, a fully managed vector database
  • Qdrant, a vector search engine
  • Redis as a vector database
  • Typesense, fast open source vector search
  • Weaviate, an open-source vector search engine
  • Zilliz, data infrastructure, powered by Milvus
  • drant, activeloop, pgvector, momento, Neo4j, Casandara (CaasIO library)
  • Postgres https://innerjoin.bit.io/vector-similarity-search-in-postgres-with-bit-io-and-pgvector-c58ac34f408b
Here is link that contains links to many relevant videos and text
https://simonwillison.net/2023/Oct/23/embeddings/

History

1990+ was about RDBMS. It is for transaction processing and reporting
2005+ was about NoSQL. Simple model for large scale store and retrieve
2013+ is about Graph DB

RDBMS v/s Graph DB
1. rows are nodes
2. joins are relationships 
3. name of tables are labels
4. columns are properties

(c:node1)-[r:relationship1]->(p:node2)


Neo4j


Cypher is a query language for graph DB
LangChain has "Cypher Search Chain" module to interact with Neo4J DB

https://github.com/tomasonjo/blogs/blob/master/llm/langchain_neo4j.ipynb
https://python.langchain.com/docs/use_cases/graph/graph_cypher_qa
https://towardsdatascience.com/integrating-neo4j-into-the-langchain-ecosystem-df0e988344d2

Neo4J has "Northwind Graph" DB

At GenAI stack, Vector DB (or Graph DB) is used for RAG

* First application connects to DB and obtains schema
* Then application sends question and schema to LLM. LLM returns cypher statement
* Then application execute the cypher statement on DB and gets the result
* Then application pass that result to LLM with instructions
* This how, LLM response to user. 


Another diagram, depicts the specific data and user question is converted to word embeddings. 



Here is an example of creating Vector Search Index

CALL db.index.vector.createNodeIndex(
    'moviePlots', // name of index
    'Movie', // node label
    'embedding', // property 
    1536, //dimension of embedding
    'cosine' // similarity function
)

Reference: https://medium.com/neo4j/knowledge-graphs-llms-fine-tuning-vs-retrieval-augmented-generation-30e875d63a35

https://github.com/neo4j/NaLLM/tree/1af09cd117ba0777d81075c597a5081583568f9f

https://atoonk.medium.com/diving-into-ai-an-exploration-of-embeddings-and-vector-databases-a7611c4ec063

There are many visualization tools for Neo4j database
https://neo4j.com/developer/tools-graph-visualization/
https://medium.com/neo4j/tagged/data-visualization
https://neo4j.com/developer-blog/15-tools-for-visualizing-your-neo4j-graph-database/
https://neo4j.com/graph-visualization-neo4j/

New GenAI stack

https://collabnix.com/getting-started-with-genai-stack-powered-with-docker-langchain-neo4j-and-ollama/

https://github.com/docker/genai-stack

https://www.docker.com/press-release/neo4j-langchain-ollama-launches-new-genai-stack-for-developers/

https://neo4j.com/developer-blog/genai-app-how-to-build/

https://www.youtube.com/watch?v=fWUzSMzSAU0

Contianers

1. langchain bot.py (streamlit for UI) FastAPI, sevlte

It has application logic and data flows

2. ollama sentence_transformer

3. neo4j

4. ollama llama2

Ollama manage local LLMs

it seems llm is another tool similar to ollama

https://datasette.io/tools/llm

Another GenAI stack, where (1) GPT4 is used instead of ollama+llama2 and (2) ChromaDB is used instead of Neo4J https://medium.com/@rubentak/unleashing-the-power-of-intelligent-chatbots-with-gpt-4-and-vector-databases-a-step-by-step-8027e2ce9e78 and https://github.com/rubentak/Langchain/blob/main/notebooks/Langchain_doc_chroma.ipynb

Nadiad


I was aware about only college road, during my initial few years at Nadiad. Later on, I researched various reading materials and explored Nadiad. I came across many less known facts about Nadiad. I presented my speech about Nadiad as part of oral communication subject in MBA. 

Nadiad Means...

N - Novel

A - Aspired

D - Divine

I - Impressive

A - Admired By All

D - Dignified

Nadiad is Known for: 

  • Its old name was નટીપ્રદ Natiadra / Natiprada and later on નટપુર  Natpur. 
  • Once upon a time, Nadiad was known as city of scholars SAAKSHAR-BHOOMI. સાક્ષર ભૂમિ  As Nadiad was the center of literary and cultural activities in Gujarat in the late 19th century.
  • Center place of Charotar (Charotar literally means 'More Beautiful')

Key Facts

* First ST bus stop (known as old ST bus stop during 1990s). 

* Vegetarian Puf was invented at Shreyas Bakery, Nadiad

* Mogul Azam movies's popular song "Mohe Nadhat Pe Nandlal" was written by  Nadiad's Rasakavi Radhunath Brahmbhat 

* 9 BHAAGOL : Entry/exit towards 9 different cities / villages. All BHAAGOL had gates

1. AMADAAVAADI અમદાવાદી ભાગોળ

2. MARIDAA મરીડા ભાગોળ

3. SALOON સલૂણ ભાગોળ

4. CHAKALAASHI ચકલાશી ભાગોળ

5. DOOMRAL ડુમરાલ ભાગોળ

6. PIJA પીજ ભાગોળ

7. DABHAAN ડભાણ  ભાગોળ

8. KODI-VAADAA કોળી-વાડા ની ભાગોળ 

9. BILODARAA બિલોદરા ભાગોળ  

* 9 Lakes : 

1. Kund કુંડ 

2. SERA સેર 

3. RATANA રતન 

4. KHETAA ખેતા 

5. MULESHWARA મૂળેશ્વર 

6. OONDEVAAL ઊંડેવાળ 

7. MALAAV મલાવ 

8. NAANAA KAAMANAATH's SMASHAAN VAALU TALAAV નાના કામનાથ નું સ્મશાન વાળું તળાવ 

9. KALAKAA MAATAA NI TALAAVADI કાળકા માતાની તળાવડી 

* Birthplace of scholars in literature (SAAKSHAR સાક્ષર )

1. Govardhanram Tripathi ગોવર્ધનરામ ત્રિપાઠી. Author of Saraswati Chandra Novel. There is a Bollywood movie also based on this novel, with same name. Remember the song? FOOL TUMHE BHEJAA HAI KHAT ME...? 

2. Manilal Dvivedi મણિલાલ દ્વિવેદી

3. Balashankar Kanthariya બાલાશંકર કંથારીયા,

4. Manshukhram Tripathi  મનસુખરામ ત્રિપાઠી


6. Chhaanlal Pandya છગનલાલ પંડ્યા

7. Zaverilal Yagnik ઝવેરીલાલ યાજ્ઞિક

etc. 

* Birthplace of

1. Sardar Vallabhbhai Patel

2. Indulal Yagnik ઇન્દુલાલ યાજ્ઞિક

3. Ambalal Jani અંબાલાલ જાની

4. Chandrashankar Pandya ચંદ્રશંકર પંડ્યા

5. Bakul Tripathi બકુલ ત્રિપાઠી Gujarat's legendary comedian

6. Ex-CM of Gujarat Babubhai Jashbhai Patel

Places worth to visit

* A. Sau. Daahi Lakshmi Library (SAMADI CHAKALA) in memory of wife of Mana:Sukhram Tripathi. It has more than 46000 books and 1600 manuscripts since 12th century in Sanskrit, Magadhi, Hindi, Gujarati

* Santram Temple: Santram Maharj is incarnation of Lord Dattatray. The temple runs many social services. In 1990s, It was also providing change for Indian currency notes. Now, this is era of UPI and QR Code. Santram Maharaj is like DSP of Nadiad, as He imparts ethics and values in Nadiadi people. Here GuruPurnima , MAHAA month full moon day and many other festivals are celebrated. It has 11 large halls. 

* Santram DERI/dERI. So many people visit it on every Thursday. 

* Mai Temple. A big statue of Lord Shiva. Near the railway line. (Another branch of this temple is on college road.) YANTRA PUJAA is performed at only two places in entire India. This temple is one of them. 

* Viththal Girls School: Training for becoming self dependent

* Hindu Anaathaashram. I visited this place, after returning from industrial visit to GE Lighting (SEEMA bulbs and Tubes). 

* Baalakanji-Baari (BAALAKAANJI BAADI in Sindhi means VAADI of children)

* Hari Om Ashram by saint Pujya MOTAA. ( I did one week silence SAADHANAA here). 

* MUKTI DHAAM crematorium 

* Townhall. I visited it to attend (1) poets meet and (2) a program of MAAN માણ (musical instrument) playing

* Deaf and Dumb school

* Vedaant Bhavan (at Kansaraa Waad)

* Laakhi mosque ( at Vahora Waad)

* Shri Paisa VaaLaa Vaid NU DAVAAKHAANU

* Saradar Patel SMRUTI BHAVAN. It has 200 years old records

* Sports Complex

* Nadiad is famous for many hospitals, Industries, Colleges, Temples. I have not included all of them here. I am not sure, about present situation of above places also. 

* Newly added attraction BAPS Swaminarayan Temple , at "Yogi Farm", PIPALAGA Road. 

Reference: 

* Abhiyaan Weekly Magazine. Issue 18th December 1995

* Charotar SarvaSangra. KHAND PAHELO, VIBHAAG BIJO. 

Importance of Satsang


 

सत्सङ्गत्वे निस्सङ्गत्वं
निस्सङ्गत्वे निर्मोहत्वम् ।
निर्मोहत्वे निश्चलितत्त्वं
निश्चलितत्त्वे जीवन्मुक्तिः ॥

भज गोविन्दं भज गोविन्दं
भज गोविन्दं मूढमते ।
भज गोविन्दं 9

satsaṅgatve nissaṅgatvaṃ
nissaṅgatve nirmohatvam ।
nirmohatve niścalitattvaṃ
niścalitattve jīvanmuktiḥ ॥
bhaja govindaṃ bhaja govindaṃ
bhaja govindaṃ mūḍhamate ।
Bhaja Govindam 9

Through the company of the good and wise people arises non attachment. Through non attachment arises the freedom from delusion, when there is freedom from delusion, there is unchangeable reality. On experiencing this unchangeable reality, there comes liberation or freedom. Seek Govinda.

I saw this sloka at Sharadaa Pith, Dwarkadhish temple. It is from Bhaj Govindam by Aadi Shankaracharya.