Skip to content

Instantly share code, notes, and snippets.

View rvndbalaji's full-sized avatar
:electron:
Changing the world, one commit at a time

Aravind Balaji rvndbalaji

:electron:
Changing the world, one commit at a time
View GitHub Profile
#Using Keras
model = keras_model_sequential()
model %>%
layer_dense(units = 3, input_shape = c(5), activation = 'relu') %>%
layer_dense(units = 2, activation = 'relu') %>%
layer_dense(units = 1, activation = 'sigmoid')
model %>% compile(
loss = 'binary_crossentropy',
optimizer = optimizer_adam(),
# Given an incomplete JSON string, extract a subset JSON that is valid
# Obtain the maximum valid portion of this string
# by removing characters one by one from the end and checking the validity
# By default the incoming json is considered to be an object surrounded by {}
# Set is_list=True if incoming json is a list surrounded by []
# This method might be inefficient for now since it removes 1 character and validates
# TODO Future optimizaion -
# Matching blocks of {} for objects and removing block
@rvndbalaji
rvndbalaji / langgraph_builder.py
Last active April 14, 2025 16:45
Utility class to build dynamic langgrah agents
import base64
import functools
import operator
from typing import *
from typing import Annotated, Any, Dict, List, Sequence
from dto.chat import *
from dto.graph import *
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain.tools import BaseTool