This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer