Monday, 20 January 2025

Hour 12+ Local LLM using OLLAMA

 Quick Sho{r}t   Exercises

Ex1. Building a Local LLM and extract information

ollama run llama3.1 

from langchain_community.llms import Ollama
#ollama run llama3.1
llm = Ollama(model="llama3.1")
response = llm("Tell me about Mahatma Gandhi")
print(response)

Response


A great figure in history! Mahatma Gandhi (1869-1948) was a Indian
independence activist, leader of the non-violent resistance movement
against British rule in India, and a key figure in the country's struggle
for freedom. He is widely regarded as one of the most influential
leaders of the 20th century.

**Early Life**

Gandhi was born on October 2, 1869, in Porbandar, a coastal town in the
state of Gujarat, India. His father, Karamchand Gandhi, was a local
leader and businessman, while his mother, Putlibai, was a devout Hindu
from a family of farmers. Gandhi's early life was marked by a strong
emphasis on spirituality and self-discipline.

**Education and Career**

Gandhi studied law at the University College London and later
practiced as a lawyer in India. However, he soon became disillusioned
with the British colonial system and its treatment of Indians.
In 1893, he traveled to South Africa to work as a lawyer for an Indian
firm, but his experience there exposed him to the harsh realities of
racial segregation and discrimination.      

**Non-Violent Resistance**

Gandhi's experiences in South Africa influenced his approach to politics
and led him to develop the philosophy of non-violent resistance.
He believed that peaceful protests, civil disobedience, and boycotts
could be effective tools for achieving social change without resorting
to violence.

**Indian Independence Movement**

In 1915, Gandhi returned to India and joined the Indian National
Congress (INC), a party fighting for Indian independence from British
rule. He became one of its key leaders and used his non-violent
resistance methods to challenge the British government's authority.

Some notable examples include:

1. **Salt March** (1930): A 24-day march from Ahmedabad to Dandi,
where Gandhi and thousands of followers protested against the
British Salt Act by making salt themselves.
2. **Non-Cooperation Movement** (1920-1922): Gandhi called for
Indians to boycott British goods, schools, and courts, which led
to widespread protests and arrests.
3. **Quit India Movement** (1942): A campaign that urged the British
to leave India immediately, but was met with brutal suppression.

**Philosophy and Legacy**

Gandhi's philosophy of non-violent resistance, known as "Satyagraha"
(holding onto truth), emphasized:

1. **Non-violence**: The rejection of violence in all forms, including
physical and verbal aggression.
2. **Simple living**: Emphasis on simplicity, self-sufficiency,
and a commitment to reducing one's material needs.
3. **Love and compassion**: A focus on promoting empathy, understanding,
and reconciliation.  

Gandhi's influence extends far beyond India:

1. **Civil Rights Movement** (USA): Gandhi's philosophy inspired leaders
like Martin Luther King Jr., who adopted similar non-violent resistance
methods in the American civil rights movement.
2. **International diplomacy**: Gandhi's approach has influenced global
efforts towards peaceful conflict resolution and disarmament.

**Assassination**

Tragically, Gandhi was assassinated on January 30, 1948, by a Hindu
nationalist named Nathuram Godse. The news of his death sent shockwaves
around the world, but it also cemented his legacy as a champion of peace
and non-violence.

Today, Gandhi's birthday, October 2, is celebrated as International
Day of Non-Violence, and he remains an iconic figure in history,
inspiring countless people worldwide with his message of love, compassion,
and peaceful resistance. """




OpenWebUI - Beginner's Tutorial

  OpenWebUI Tutorial: Setting Up and Using Local Llama 3.2 with Ollama Introduction This tutorial provides a step-by-step guide to setting...