Skip to content

Instantly share code, notes, and snippets.

View shresthakamal's full-sized avatar
🏠
Working from home

Kamal Shrestha shresthakamal

🏠
Working from home
View GitHub Profile
@shresthakamal
shresthakamal / retreivals.py
Created March 2, 2024 13:32
Vector Store based retreivals
# Load docs
from langchain.document_loaders import WebBaseLoader
loader = WebBaseLoader("https://lilianweng.github.io/posts/2023-06-23-agent/")
data = loader.load()
# Split
from langchain.text_splitter import RecursiveCharacterTextSplitter
text_splitter = RecursiveCharacterTextSplitter(chunk_size = 500, chunk_overlap = 0)
all_splits = text_splitter.split_documents(data)
@shresthakamal
shresthakamal / react-native-start.js
Created March 12, 2024 02:15
Basic React Native Application commands - Starting emulator - Creating Application
// Create an application
npx create-expo-app rate-repository-app --template expo-template-blank@sdk-50
// Note, that the @sdk-50 sets the project's Expo SDK version to 50, which supports React Native version 0.73.
// Install dependencies
npx expo install react-native-web@~0.19.6 [email protected] @expo/metro-runtime@~3.1.1
// Start the emulator
@shresthakamal
shresthakamal / cors.py
Last active January 21, 2025 17:07
FAST API Response and Request [LEARN]
"""CORS or "Cross-Origin Resource Sharing" refers to the situations when a frontend running in a browser has JavaScript code that communicates with a backend, and the backend is in a different "origin" than the frontend.
Origin
An origin is the combination of protocol (http, https), domain (myapp.com, localhost, localhost.tiangolo.com), and port (80, 443, 8080).
So, all these are different origins:
http://localhost