Handling the Source updates (files/folders)
- For this we need to update the metadata
raw_documents[0].metadata.update({
"category": "HR",
"department": "PGE"
})
Running uv Package
Got it π You want to create a Python package using uv (a super-fast Python package manager) and run it locally. Let me guide you step by step.
β
Steps to Create & Run a Package with uv
1. Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
or with pipx:
pipx install uv
Check installation:
uv --version
2. Create a New Project
Use uv to create a new Python project:
uv init mypackage
cd mypackage
This will create a structure like:
mypackage/
βββ pyproject.toml
βββ README.md
βββ src/
βββ mypackage/
βββ __init__.py
3. Add Some Code
Edit src/mypackage/__init__.py:
def greet(name: str) -> str:
return f"Hello, {name}!"
4. Run Code Locally
Option A: Run in a REPL
uv run python
Inside Python:
from mypackage import greet
print(greet("Khaja"))
Option B: Run a Script
Create a script src/mypackage/main.py:
from mypackage import greet
if __name__ == "__main__":
print(greet("Khaja"))
Run it with:
uv run src/mypackage/main.py
5. Install Your Package Locally
You can install it into an environment:
uv pip install -e .
Now you can just do:
uv run python -m mypackage.main
- The production repo is at Refer Here
RecordManager
-
Refer Here for record manager
-
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug package entrypoint",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/src/kb_articles_rag_prd/__init__.py",
"console": "integratedTerminal"
}
]
}
