Skip to content

Instantly share code, notes, and snippets.

View jvelezmagic's full-sized avatar
:octocat:

Jesús Vélez Santiago jvelezmagic

:octocat:
View GitHub Profile
---
title: "Cydar batch correction"
author: ""
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_float: true
toc_depth: 3
code_download: true
# Include docstring package to render documentation
if (!requireNamespace("docstring", quietly = TRUE)) {
install.packages("docstring")
}
library(docstring)
average_expression_heatmaps <- function(object,
assay = NULL,
columns_to_keep = NULL,
# Include docstring package to render documentation
if (!requireNamespace("docstring", quietly = TRUE)) {
install.packages("docstring")
}
library(docstring)
catalyst_expression_heatmaps <- function(sce,
by = "sample_id",
by_keep = NULL,
render_md_as_rmd <- function(file, overwrite = TRUE, ...) {
file_name <- fs::path_ext_remove(file)
file_to_render <- fs::file_copy(
path = file,
new_path = fs::path(file_name, ext = "Rmd"),
overwrite = overwrite
)
tryCatch(
---
title: "Tidytuesday - Week 29"
format:
html
---
## Libraries
```{r libraries}
library(tidyverse)
@jvelezmagic
jvelezmagic / main.py
Created May 17, 2023 12:05
Langchain FastAPI stream with simple memory
# The goal of this file is to provide a FastAPI application for handling
# chat requests amd generation AI-powered responses using conversation chains.
# The application uses the LangChaing library, which includes a chatOpenAI model
# for natural language processing.
# The `StreamingConversationChain` class is responsible for creating and storing
# conversation memories and generating responses. It utilizes the `ChatOpenAI` model
# and a callback handler to stream responses as they're generated.
# The application defines a `ChatRequest` model for handling chat requests,
@jvelezmagic
jvelezmagic / main.py
Last active September 10, 2024 19:40
QA Chatbot streaming with source documents example using FastAPI, LangChain Expression Language, OpenAI, and Chroma.
"""QA Chatbot streaming using FastAPI, LangChain Expression Language , OpenAI, and Chroma.
Features
--------
- Persistent Chat Memory:
Stores chat history in a local file.
- Persistent Vector Store:
Stores document embeddings in a local vector store.
- Standalone Question Generation:
Rephrases follow-up questions to standalone questions in their original language.