Python

A high-level, interpreted programming language known for its readability and versatility. It is a general-purpose language, meaning it can be applied to a wide range of tasks and isn’t limited to a specific domain. 

https://www.python.org

History

The Story of Python, by Its Creator, Guido van Rossum
Guido van Rossum explains Python programming
Python: The Documentary | An origin story

Learning Python

Python for Beginners – Python.org Getting Started

Learning Anaconda

Parsing PDF

Python Libraries handy for LLM

  • ollama: Python client for the Ollama LLM server, enabling local inference of Llama or other models.
  • langchain: Main library to implement the chain of tasks (document loading, splitting, vector store management, etc.).
  • langchain-community: Community-contributed extensions for LangChain (e.g., additional vector stores).
  • langchain_huggingface: Integration that allows you to use HuggingFace endpoints within LangChain.
  • chromadb: A vector database for storing and retrieving text embeddings.
  • pypdf: PDF parsing library that helps extract text from PDF documents.
  • sentence-transformers: Provides state-of-the-art sentence embedding models.

Marker

Docling

Docling parses PDF, DOCX, PPTX, HTML, and other formats into a rich unified representation including document layout, tables etc., making them ready for generative AI workflows like RAG.

https://www.redhat.com/en/blog/docling-missing-document-processing-companion-generative-ai

Markdown

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

Learning Git

Python Code Examples

Hello World:

# Print "Hello, World!" to the console
print("Hello, World!")

Hello, World!

Variables and Input:

# Get user input and store it in a variable
name = input("What is your name? ")

What is your name? Joe

# Print a personalized greeting
print("Hello, " + name + "!")

Hello Joe!

Conditional Statements (if/else):

# Check if a number is even or odd
number = 10
if number % 2 == 0:
    print(str(number) + " is an even number.")
else:
    print(str(number) + " is an odd number.")

10 is an even number.

Loops (for loop):

# Iterate through a list of numbers and print each one
numbers = [1, 2, 3, 4, 5]
for num in numbers:
    print(num)

1
2
3
4
5

Functions:

# Define a function to add two numbers
def add_numbers(a, b):
    return a + b

# Call the function and print the result
result = add_numbers(5, 3)
print("The sum is: " + str(result))

The sum is: 8

String Manipulation:

# Reverse a string
my_string = "Python"
reversed_string = my_string[::-1]
print("Reversed string: " + reversed_string)

Reversed string: nohtyP

Lists:

# Append an element to a list
my_list = ["apple", "banana"]
my_list.append("cherry")
print(my_list)

['apple', 'banana', 'cherry']

# Access elements by index
print(my_list[0]) 

apple

Dictionaries:

# Create a dictionary
person = {"name": "Alice", "age": 30, "city": "New York"}
# Access dictionary values
print(person["name"])

Alice

# Add a new key-value pair
person["occupation"] = "Engineer"
print(person)

{'name': 'Alice', 'age': 30, 'city': 'New York', 'occupation': 'Engineer'}