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
@jvelezmagic
jvelezmagic / main.py
Last active March 25, 2024 09:46
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.
@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,
---
title: "Tidytuesday - Week 29"
format:
html
---
## Libraries
```{r libraries}
library(tidyverse)
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(
# 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,
# 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,
---
title: "Cydar batch correction"
author: ""
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_float: true
toc_depth: 3
code_download: true