Skip to content

Instantly share code, notes, and snippets.

from typing import List
import json
import sys
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.output_parsers import PydanticOutputParser
from langchain.schema.messages import HumanMessage, SystemMessage
from langchain.chains import ConversationChain
from langchain.memory import ConversationBufferMemory
@jwatte
jwatte / pyproject.toml
Created November 20, 2023 00:50
langchain pyproject.toml
[tool.poetry]
name = "langchain"
version = "0.0.338"
description = "Building applications with LLMs through composability"
authors = []
license = "MIT"
readme = "README.md"
repository = "https://github.com/langchain-ai/langchain"
[tool.poetry.scripts]
@jwatte
jwatte / gist:a5944ec1b81a58cff8ea863a315320b5
Created November 20, 2023 00:48
langchain dev.Dockerfile
# This is a Dockerfile for the Development Container
# see https://github.com/langchain-ai/langchain
# Use the Python base image
ARG VARIANT="3.11-bullseye"
FROM mcr.microsoft.com/devcontainers/python:0-${VARIANT} AS langchain-dev-base
USER vscode
# Define the version of Poetry to install (default is 1.4.2)
test: malloc-release malloc-debug
./malloc-debug
./malloc-release
malloc-debug: MallocBenchmark.cpp
clang -O0 -D_DEBUG=1 -g -o malloc-debug MallocBenchmark.cpp
malloc-release: MallocBenchmark.cpp
clang -O3 -DNDEBUG=1 -o malloc-release MallocBenchmark.cpp
import torch
from imagen_pytorch import Unet, Imagen, ImagenTrainer
from imagen_pytorch.t5 import t5_encode_text, DEFAULT_T5_NAME
from torchvision import transforms
# This doesn't yet format the text embedding tensors right
# TODO: check out https://gist.github.com/Netruk44/38d793e6d04a53cc4d9acbfadbb04a5c
import json
# Pick N random annotations from the list of annotations.
# Load/ccale/sample the corresponding image.
# Generate the T5 text embedding of the given prompt.
# Upload the data to the appropriate slot in each tensor.
def load_images(annots, pathsbyid, tensordim, t_embeds, t_masks, t_images):
# pick N random annotations
todo = annots.copy()
random.shuffle(todo)
todo = todo[0: tensordim]
for ix in range(0, tensordim):
I gave GPT3 a writing prompt, to see how well it would keep track of initial
conditions.
The writing that comes out is in the same ham-handed style as my prompt, it
gets 100% on that! But as a writer / prompt completer:
1. The conditions established in the first paragraph don't carry through -- there's
enough oxygen, so why's the air running out right away?
2. How can he feel the smell of the antenna array while in his suit on the moon?
@jwatte
jwatte / sluglibrary.errors
Created September 26, 2017 02:10
Trying to build sluglibrary on Ubuntu 17.04
Trying to build on Ubuntu 17.04.
jwatte@ripper:~/Downloads/SlugDemo/Linux$ make
mkdir -p Output/Code
gcc -I../Code -I/usr/include -DSLUG_LINUX -DSLUG_OPENGL -m64 -msse -msse2 -std=c++11 -fno-exceptions -fno-rtti -Wall -Wno-multichar -Wno-strict-aliasing -Wno-unused-result -O3 -c ../Code/Main.cpp -o Output/Code/Main.o
gcc -I../Code -I/usr/include -DSLUG_LINUX -DSLUG_OPENGL -m64 -msse -msse2 -std=c++11 -fno-exceptions -fno-rtti -Wall -Wno-multichar -Wno-strict-aliasing -Wno-unused-result -O3 -c ../Code/SlugDemo.cpp -o Output/Code/SlugDemo.o
In file included from /usr/include/GL/glx.h:333:0,
from ../Code/SlugDemo.h:96,
from ../Code/Main.cpp:1:
/usr/include/GL/glxext.h:505:143: error: ‘GLintptr’ has not been declared
class A a where
getB :: B b => a -> b
class B b where
getA :: A a => b -> a
data X = X
instance A X where
getB x = x
-- AUTO-GENERATED, DO NOT EDIT !!!
data CampaignTemplateMaybe = CampaignTemplateMaybe
{ maybe_name :: !(Maybe Text)
, maybe_kind :: !(Maybe Text)
, maybe_definition :: !(Maybe Text)
, maybe_saved :: !(Maybe Bool)
, maybe_hidden :: !(Maybe Bool)
, maybe_last_active :: !(Maybe UTCTime)
}
deriving (Show, Read, Ord, Eq)