Compare commits

..

79 Commits

Author SHA1 Message Date
Marcus Schiesser 844561b6cc chore: unified apps/simple and examples 2023-11-29 11:48:43 +07:00
yisding 8a3ac0c338 Merge pull request #242 from run-llama/seldo-patch-1
Update link to python docs
2023-11-27 18:05:03 -08:00
yisding bb125d7d4f Merge pull request #240 from mtutty/add-pgvector-store
Minor fixes in PGVectorStore
2023-11-27 18:04:38 -08:00
yisding a405716847 Merge pull request #233 from run-llama/ms/create-llama-multi-modal
Feat: add GPT4 Vision support (and file upload) to create-llama
2023-11-27 18:03:29 -08:00
Laurie Voss bad6e03095 Update link to python docs 2023-11-27 17:26:50 -08:00
Michael Tutty 2330fddfbb Fix a field mapping in query method, handle empty embeddingResults in add method 2023-11-27 19:03:17 +00:00
Marcus Schiesser 61dfd74134 feat: removed non-streaming for nextjs 2023-11-24 18:04:14 +07:00
Marcus Schiesser 029ff83979 fix: set maxTokens to 4096 so vision model is not stopping too early (seems to have a lower default than other models) 2023-11-24 18:04:14 +07:00
Marcus Schiesser dbbc4cb2e1 feat: add multi-modal (file upload) and model selection to create-llama 2023-11-24 16:49:05 +07:00
Alex Yang 1cce21cdc2 feat: add loading indicator (#203) 2023-11-24 11:48:54 +08:00
yisding 8b786a51b3 create-llama 0.0.10 2023-11-23 10:56:43 -08:00
yisding ad7537dd84 llamaindex 0.0.37 2023-11-23 10:54:44 -08:00
yisding 3bab23172a changeset 2023-11-23 10:53:30 -08:00
yisding 18c132d494 Merge pull request #228 from run-llama/ms/create-llama-fixes
Several fixes for improving compatibility with Next.JS
2023-11-23 10:50:13 -08:00
Marcus Schiesser d072353e08 fix: copy pdf-parse test doc for npm build 2023-11-23 20:58:43 +07:00
Marcus Schiesser c8bbc101cc feat: remove AssemblyAIReader as it's not working with Next.JS 2023-11-23 18:23:24 +07:00
Marcus Schiesser b93f748998 fix: don't resolve mongodb for next.js 2023-11-23 18:20:15 +07:00
Marcus Schiesser ecb100448a fix: remove forceConsistentCasingInFileNames warning 2023-11-23 18:19:29 +07:00
Marcus Schiesser c749c856b5 fix: add missing clsx package 2023-11-23 18:18:35 +07:00
Marcus Schiesser 0baf278972 fix: transformers.js not working with nextjs 2023-11-23 16:46:18 +07:00
Marcus Schiesser ae7780266a fix: curl test for express (streaming) 2023-11-23 15:56:36 +07:00
Marcus Schiesser 587960aebe fix: use dotenv for npm run generate, use .env for NextJS, fix package versions for pnpm 2023-11-23 15:55:47 +07:00
Marcus Schiesser 4e1b6784f7 fix: pdfparse not working with in ESM version 2023-11-23 14:22:29 +07:00
yisding 8b381f2640 LITS 0.0.36 2023-11-21 22:33:14 -08:00
yisding 0dc7fa6c34 Merge pull request #170 from Swimburger/assemblyai
Add AssemblyAI integration
2023-11-21 21:46:08 -08:00
yisding 2a2bf682bf small fix in example 2023-11-21 21:44:58 -08:00
yisding 87526129fb Merge branch 'main' into assemblyai 2023-11-21 21:39:35 -08:00
yisding 8ed1b7aa46 Merge pull request #179 from mtutty/add-pgvector-store
Add PGVectorStore
2023-11-21 21:35:12 -08:00
yisding 4084bd0ecc Merge branch 'main' into add-pgvector-store 2023-11-21 21:33:41 -08:00
yisding d11eaceaf1 Merge pull request #223 from run-llama/claude-21
support for claude-2.1
2023-11-21 21:30:21 -08:00
yisding 1e6986fbc5 pnpm lockfile 2023-11-21 21:20:30 -08:00
yisding 11a19bdec7 make sweep optional in issues 2023-11-21 21:15:32 -08:00
yisding 51064f1b90 Merge pull request #221 from run-llama/ms/add-clip-embeddings
feat: add clip embedding to llamaindex
2023-11-21 21:04:01 -08:00
yisding 3385cd19e8 support for claude-2.1
Added custom RAG prompt for Claude.
Supporting system message format.
2023-11-21 21:01:54 -08:00
yisding 852f8517df Merge pull request #209 from run-llama/jerry/edit_readme
add .env instructions
2023-11-21 21:01:35 -08:00
Marcus Schiesser bb917f9818 refactor: moved embeddings to embeddings folder 2023-11-21 14:20:10 +07:00
Marcus Schiesser 10248fb29f chore: move clip example 2023-11-21 13:53:38 +07:00
Marcus Schiesser 446dc85bdd fix: usage of transformers.js as CJS 2023-11-21 13:42:40 +07:00
Marcus Schiesser 4aa2c226a9 feat: add clip embedding to llamaindex 2023-11-21 11:01:29 +07:00
Marcus Schiesser bf9ba8313a test clip embeddings 2023-11-21 10:59:37 +07:00
yisding 444b59c557 Merge pull request #218 from run-llama/ms/use-cryptojs
feat: use cryptojs instead of crypto
2023-11-20 18:25:31 -08:00
yisding b2e1df94db Merge remote-tracking branch 'origin/main' into ms/use-cryptojs 2023-11-20 18:24:30 -08:00
yisding b4963cabc8 Merge pull request #204 from run-llama/ms/add-mongodb-vector
Feat: added support for MongoDB as vector DB
2023-11-20 18:09:09 -08:00
Marcus Schiesser 2851024340 feat: use cryptojs instead of crypto (removes nodejs dep) 2023-11-20 13:56:04 +07:00
yisding 7f25a25729 create-llama 0.0.9 2023-11-19 18:30:32 -08:00
yisding acfe23265a changeset 2023-11-19 18:17:57 -08:00
yisding 2c6fbbd7dd Merge pull request #217 from run-llama/seldo/python-gitignore 2023-11-19 17:30:49 -08:00
Laurie Voss f84507f513 Merge branch 'main' of github.com:run-llama/LlamaIndexTS into seldo/python-env 2023-11-19 17:26:50 -08:00
Laurie Voss be6a9e4a48 Default .gitignore should ignore .env 2023-11-19 17:26:25 -08:00
yisding 69e7634619 Merge pull request #216 from run-llama/seldo/python-env 2023-11-19 17:14:42 -08:00
Laurie Voss d18748aba4 Merge branch 'main' of github.com:run-llama/LlamaIndexTS into seldo/deploy-fixes 2023-11-19 17:11:45 -08:00
yisding 27c4ef3410 Merge pull request #215 from run-llama/seldo/deploy-fixes 2023-11-19 16:21:19 -08:00
Laurie Voss a7ee392d3e dotenv must load before chat_router or .env isn't picked up in time 2023-11-19 16:15:41 -08:00
Laurie Voss 4415a6fdef next.config.js has to be different for express/python backends 2023-11-19 15:55:27 -08:00
Laurie Voss 1e1e6e96a1 Handle CORS in prod 2023-11-19 15:54:53 -08:00
Laurie Voss 461d1dfbcc Don't commit .env in the backend 2023-11-19 15:52:57 -08:00
Jerry Liu 3e8c923641 cr 2023-11-17 19:39:23 -08:00
yisding 5975fafefb Merge pull request #208 from run-llama/seldo/express-parsing-bug
fix: generated frontend is sending text/plain
2023-11-17 16:57:42 -08:00
Laurie Voss 71169fd545 fix: generated frontend is sending text/plain so handle that instead of JSON 2023-11-17 15:29:56 -08:00
Logan be895d564d Merge pull request #202 from run-llama/logan/fix_llm_def 2023-11-17 15:02:04 -06:00
yisding f36a27c218 create-llama 0.0.8 2023-11-17 09:06:00 -08:00
yisding 8cdb07f151 changeset 2023-11-17 09:05:24 -08:00
yisding ea403a0ffe Merge branch 'main' of github.com:run-llama/LlamaIndexTS 2023-11-17 09:04:33 -08:00
yisding 7f0b4e66ae create-llama 0.0.7 2023-11-17 09:04:01 -08:00
yisding 3b226965ba Merge pull request #205 from run-llama/ms/copy-cache-folder
fix: copy cache folder for vercel deployments
2023-11-17 09:03:26 -08:00
Logan Markewich 63daf77412 remove accidental files 2023-11-17 09:57:43 -06:00
Marcus Schiesser df5cbe30a6 fix: missing JSON parsing and improved compatibility with Python 2023-11-17 15:06:31 +07:00
Marcus Schiesser 9e1a536778 docs: createIndex doesn't work 2023-11-17 14:58:20 +07:00
Marcus Schiesser a1db8833ef feat: sync'ed SimpleMongReader with Python 0.9 and tested/fixed mongodb scripts 2023-11-17 14:05:12 +07:00
Marcus Schiesser 95dd0e0158 feat: add mongo db vector support with example 2023-11-17 14:05:12 +07:00
Marcus Schiesser 079a1d5cc3 fix: copy cache folder for vercel deployments 2023-11-17 08:52:42 +07:00
Logan Markewich 2377d1a466 Fix LLM definitions 2023-11-16 15:55:38 -06:00
yisding 9f9f29391e changeset 2023-11-15 16:25:07 -08:00
Michael Tutty 19f3c857d5 Add comment blocks and support for collection filtering 2023-11-11 18:13:41 +00:00
Michael Tutty 7f3da73aa4 Final cleanup, README for example scripts 2023-11-11 17:48:01 +00:00
Michael Tutty c384c2b610 Resolve upstream conflicts 2023-11-11 16:56:45 +00:00
Michael Tutty dcf358f27d Resolve upstream updates/conflicts 2023-11-10 02:16:42 +00:00
Michael Tutty 40afc8c0e2 Add PGVectorStore, dependencies, example scripts 2023-11-10 02:04:35 +00:00
Niels Swimberghe b22bc8a799 Add AssemblyAI integration 2023-10-31 15:43:33 -04:00
155 changed files with 60355 additions and 4855 deletions
@@ -1,7 +1,6 @@
name: Bugfix
title: "Sweep: "
title: ""
description: Write something like "We notice ... behavior when ... happens instead of ...""
labels: sweep
body:
- type: textarea
id: description
@@ -1,11 +1,10 @@
name: Feature Request
title: "Sweep: "
description: Write something like "Write an api endpoint that does "..." in the "..." file"
labels: sweep
title: ""
description: Write something like "Write an api endpoint that does "..." in the "..." file". If you would like to use sweep.dev prefix with "Sweep:"
body:
- type: textarea
id: description
attributes:
label: Details
description: More details for Sweep
description: More details
placeholder: The new endpoint should use the ... class from ... file because it contains ... logic
@@ -1,11 +1,10 @@
name: Refactor
title: "Sweep: "
description: Write something like "Modify the ... api endpoint to use ... version and ... framework"
labels: sweep
title: ""
description: Write something like "Modify the ... api endpoint to use ... version and ... framework" If you would like to use sweep.dev prefix with "Sweep:"
body:
- type: textarea
id: description
attributes:
label: Details
description: More details for Sweep
description: More details
placeholder: We are migrating this function to ... version because ...
+3 -2
View File
@@ -4,5 +4,6 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
}
}
},
"jest.rootPath": "./packages/core"
}
+1 -1
View File
@@ -5,7 +5,7 @@ slug: /
# What is LlamaIndex.TS?
LlamaIndex.TS is a data framework for LLM applications to ingest, structure, and access private or domain-specific data. While a python package is also available (see [here](https://gpt-index.readthedocs.io/en/latest/)), LlamaIndex.TS offers core features in a simple package, optimized for usage with TypeScript.
LlamaIndex.TS is a data framework for LLM applications to ingest, structure, and access private or domain-specific data. While a python package is also available (see [here](https://docs.llamaindex.ai/en/stable/)), LlamaIndex.TS offers core features in a simple package, optimized for usage with TypeScript.
## 🚀 Why LlamaIndex.TS?
+34
View File
@@ -0,0 +1,34 @@
/* eslint-disable turbo/no-undeclared-env-vars */
import * as dotenv from "dotenv";
import * as fs from "fs";
import { MongoClient } from "mongodb";
// Load environment variables from local .env file
dotenv.config();
const jsonFile = "tinytweets.json";
const mongoUri = process.env.MONGODB_URI!;
const databaseName = process.env.MONGODB_DATABASE!;
const collectionName = process.env.MONGODB_COLLECTION!;
async function importJsonToMongo() {
// Load the tweets from a local file
const tweets = JSON.parse(fs.readFileSync(jsonFile, "utf-8"));
// Create a new client and connect to the server
const client = new MongoClient(mongoUri);
const db = client.db(databaseName);
const collection = db.collection(collectionName);
// Insert the tweets into mongo
await collection.insertMany(tweets);
console.log(
`Data imported successfully to the MongoDB collection ${collectionName}.`,
);
await client.close();
}
// Run the import function
importJsonToMongo();
+50
View File
@@ -0,0 +1,50 @@
/* eslint-disable turbo/no-undeclared-env-vars */
import * as dotenv from "dotenv";
import {
MongoDBAtlasVectorSearch,
SimpleMongoReader,
storageContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
import { MongoClient } from "mongodb";
// Load environment variables from local .env file
dotenv.config();
const mongoUri = process.env.MONGODB_URI!;
const databaseName = process.env.MONGODB_DATABASE!;
const collectionName = process.env.MONGODB_COLLECTION!;
const vectorCollectionName = process.env.MONGODB_VECTORS!;
const indexName = process.env.MONGODB_VECTOR_INDEX!;
async function loadAndIndex() {
// Create a new client and connect to the server
const client = new MongoClient(mongoUri);
// load objects from mongo and convert them into LlamaIndex Document objects
// llamaindex has a special class that does this for you
// it pulls every object in a given collection
const reader = new SimpleMongoReader(client);
const documents = await reader.loadData(databaseName, collectionName, [
"full_text",
]);
// create Atlas as a vector store
const vectorStore = new MongoDBAtlasVectorSearch({
mongodbClient: client,
dbName: databaseName,
collectionName: vectorCollectionName, // this is where your embeddings will be stored
indexName: indexName, // this is the name of the index you will need to create
});
// now create an index from all the Documents and store them in Atlas
const storageContext = await storageContextFromDefaults({ vectorStore });
await VectorStoreIndex.fromDocuments(documents, { storageContext });
console.log(
`Successfully created embeddings in the MongoDB collection ${vectorCollectionName}.`,
);
await client.close();
}
loadAndIndex();
// you can't query your index yet because you need to create a vector search index in mongodb's UI now
+34
View File
@@ -0,0 +1,34 @@
/* eslint-disable turbo/no-undeclared-env-vars */
import * as dotenv from "dotenv";
import {
MongoDBAtlasVectorSearch,
serviceContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
import { MongoClient } from "mongodb";
// Load environment variables from local .env file
dotenv.config();
async function query() {
const client = new MongoClient(process.env.MONGODB_URI!);
const serviceContext = serviceContextFromDefaults();
const store = new MongoDBAtlasVectorSearch({
mongodbClient: client,
dbName: process.env.MONGODB_DATABASE!,
collectionName: process.env.MONGODB_VECTORS!,
indexName: process.env.MONGODB_VECTOR_INDEX!,
});
const index = await VectorStoreIndex.fromVectorStore(store, serviceContext);
const retriever = index.asRetriever({ similarityTopK: 20 });
const queryEngine = index.asQueryEngine({ retriever });
const result = await queryEngine.query(
"What does the author think of web frameworks?",
);
console.log(result.response);
await client.close();
}
query();
+20
View File
@@ -0,0 +1,20 @@
# mongodb-llamaindexts
## 0.0.3
### Patch Changes
- Updated dependencies [3bab231]
- llamaindex@0.0.37
## 0.0.2
### Patch Changes
- Updated dependencies
- Updated dependencies
- Updated dependencies
- Updated dependencies
- Updated dependencies
- Updated dependencies
- llamaindex@0.0.36
+127
View File
@@ -0,0 +1,127 @@
# LlamaIndexTS retrieval augmented generation with MongoDB
### Prepare Environment
Make sure to run `pnpm install` and set your OpenAI environment variable before running these examples.
```
pnpm install
export OPENAI_API_KEY="sk-..."
```
### Sign up for MongoDB Atlas
We'll be using MongoDB's hosted database service, [MongoDB Atlas](https://www.mongodb.com/cloud/atlas/register). You can sign up for free and get a small hosted cluster for free:
![MongoDB Atlas signup](./docs/1_signup.png)
The signup process will walk you through the process of creating your cluster and ensuring it's configured for you to access. Once the cluster is created, choose "Connect" and then "Connect to your application". Choose Python, and you'll be presented with a connection string that looks like this:
![MongoDB Atlas connection string](./docs/2_connection_string.png)
### Set up environment variables
Copy the connection string (make sure you include your password) and put it into a file called `.env` in the root of this repo. It should look like this:
```
MONGODB_URI=mongodb+srv://seldo:xxxxxxxxxxx@llamaindexdemocluster.xfrdhpz.mongodb.net/?retryWrites=true&w=majority
```
You will also need to choose a name for your database, and the collection where we will store the tweets, and also include them in .env. They can be any string, but this is what we used:
```
MONGODB_DATABASE=tiny_tweets_db
MONGODB_COLLECTION=tiny_tweets_collection
```
### Import tweets into MongoDB
You are now ready to import our ready-made data set into Mongo. This is the file `tinytweets.json`, a selection of approximately 1000 tweets from @seldo on Twitter in mid-2019. With your environment set up you can do this by running
```
pnpm ts-node 1_import.ts
```
If you don't want to use tweets, you can replace `json_file` with any other array of JSON objects, but you will need to modify some code later to make sure the correct field gets indexed. There is no LlamaIndex-specific code here; you can load your data into Mongo any way you want to.
### Load and index your data
Now we're ready to index our data. To do this, LlamaIndex will pull your text out of Mongo, split it into chunks, and then send those chunks to OpenAI to be turned into [vector embeddings](https://docs.llamaindex.ai/en/stable/understanding/indexing/indexing.html#what-is-an-embedding). The embeddings will then be stored in a new collection in Mongo. This will take a while depending how much text you have, but the good news is that once it's done you will be able to query quickly without needing to re-index.
We'll be using OpenAI to do the embedding, so now is when you need to [generate an OpenAI API key](https://platform.openai.com/account/api-keys) if you haven't already and add it to your `.env` file like this:
```
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```
You'll also need to pick a name for the new collection where the embeddings will be stored, and add it to `.env`, along with the name of a vector search index (we'll be creating this in the next step, after you've indexed your data):
```
MONGODB_VECTORS=tiny_tweets_vectors
MONGODB_VECTOR_INDEX=tiny_tweets_vector_index
```
If the data you're indexing is the tweets we gave you, you're ready to go:
```bash
pnpm ts-node 2_load_and_index.ts
```
> Note: this script is running a couple of minutes and currently doesn't show any progress.
What you're doing here is creating a Reader which loads the data out of Mongo in the collection and database specified. It looks for text in a set of specific keys in each object. In this case we've given it just one key, "full_text".
Now you're creating a vector search client for Mongo. In addition to a MongoDB client object, you again tell it what database everything is in. This time you give it the name of the collection where you'll store the vector embeddings, and the name of the vector search index you'll create in the next step.
### Create a vector search index
Now if all has gone well you should be able to log in to the Mongo Atlas UI and see two collections in your database: the original data in `tiny_tweets_collection`, and the vector embeddings in `tiny_tweets_vectors`.
![MongoDB Atlas collections](./docs/3_vectors_in_db.png)
Now it's time to create the vector search index so that you can query the data.
It's not yet possible to programmatically create a vector search index using the [`createIndex`](https://www.mongodb.com/docs/manual/reference/method/db.collection.createIndex/) function, therefore we have to create one manually in the UI.
To do so, first, click the Search tab, and then click "Create Search Index":
![MongoDB Atlas create search index](./docs/4_search_tab.png)
We have to use the JSON editor, as the Visual Editor does not yet support to create a vector search index:
![MongoDB Atlas JSON editor](./docs/5_json_editor.png)
Now under "database and collection" select `tiny_tweets_db` and within that select `tiny_tweets_vectors`. Then under "Index name" enter `tiny_tweets_vector_index` (or whatever value you put for MONGODB_VECTOR_INDEX in `.env`). Under that, you'll want to enter this JSON object:
```json
{
"mappings": {
"dynamic": true,
"fields": {
"embedding": {
"dimensions": 1536,
"similarity": "cosine",
"type": "knnVector"
}
}
}
}
```
This tells Mongo that the `embedding` field in each document (in the `tiny_tweets_vectors` collection) is a vector of 1536 dimensions (this is the size of embeddings used by OpenAI), and that we want to use cosine similarity to compare vectors. You don't need to worry too much about these values unless you want to use a different LLM to OpenAI entirely.
The UI will ask you to review and confirm your choices, then you need to wait a minute or two while it generates the index. If all goes well, you should see something like this screen:
![MongoDB Atlas index created](./docs/7_index_created.png)
Now you're ready to query your data!
### Run a test query
You can do this by running
```bash
pnpm ts-node 3_query.ts
```
This sets up a connection to Atlas just like `2_load_and_index.ts` did, then it creates a [query engine](https://docs.llamaindex.ai/en/stable/understanding/querying/querying.html#getting-started) and runs a query against it.
If all is well, you should get a nuanced opinion about web frameworks.
Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

+17
View File
@@ -0,0 +1,17 @@
{
"version": "0.0.3",
"private": true,
"name": "mongodb-llamaindexts",
"dependencies": {
"llamaindex": "workspace:*",
"dotenv": "^16.3.1",
"mongodb": "^6.2.0"
},
"devDependencies": {
"@types/node": "^18.18.6",
"ts-node": "^10.9.1"
},
"scripts": {
"lint": "eslint ."
}
}
File diff suppressed because it is too large Load Diff
-271
View File
@@ -1,271 +0,0 @@
# simple
## 0.0.33
### Patch Changes
- Updated dependencies [63f2108]
- llamaindex@0.0.35
## 0.0.32
### Patch Changes
- Updated dependencies [2a27e21]
- llamaindex@0.0.34
## 0.0.31
### Patch Changes
- Updated dependencies [5e2e92c]
- llamaindex@0.0.33
## 0.0.30
### Patch Changes
- Updated dependencies [90c0b83]
- Updated dependencies [dfd22aa]
- llamaindex@0.0.32
## 0.0.29
### Patch Changes
- Updated dependencies [6c55b2d]
- Updated dependencies [8aa8c65]
- Updated dependencies [6c55b2d]
- llamaindex@0.0.31
## 0.0.28
### Patch Changes
- Updated dependencies [139abad]
- Updated dependencies [139abad]
- Updated dependencies [eb0e994]
- Updated dependencies [eb0e994]
- Updated dependencies [139abad]
- llamaindex@0.0.30
## 0.0.27
### Patch Changes
- Updated dependencies [a52143b]
- Updated dependencies [1b7fd95]
- Updated dependencies [0db3f41]
- llamaindex@0.0.29
## 0.0.26
### Patch Changes
- Updated dependencies [96bb657]
- Updated dependencies [96bb657]
- Updated dependencies [837854d]
- llamaindex@0.0.28
## 0.0.25
### Patch Changes
- Updated dependencies [4a5591b]
- Updated dependencies [4a5591b]
- Updated dependencies [4a5591b]
- llamaindex@0.0.27
## 0.0.24
### Patch Changes
- Updated dependencies [5bb55bc]
- llamaindex@0.0.26
## 0.0.23
### Patch Changes
- Updated dependencies [e21eca2]
- Updated dependencies [40a8f07]
- Updated dependencies [40a8f07]
- llamaindex@0.0.25
## 0.0.22
### Patch Changes
- Updated dependencies [e4af7b3]
- Updated dependencies [259fe63]
- llamaindex@0.0.24
## 0.0.21
### Patch Changes
- Updated dependencies
- Updated dependencies [9d6b2ed]
- llamaindex@0.0.23
## 0.0.20
### Patch Changes
- Updated dependencies [454f3f8]
- Updated dependencies [454f3f8]
- Updated dependencies [454f3f8]
- Updated dependencies [454f3f8]
- Updated dependencies [99df58f]
- llamaindex@0.0.22
## 0.0.19
### Patch Changes
- Updated dependencies [f7a57ca]
- Updated dependencies [0a09de2]
- Updated dependencies [f7a57ca]
- llamaindex@0.0.21
## 0.0.18
### Patch Changes
- Updated dependencies [b526a2d]
- Updated dependencies [b526a2d]
- Updated dependencies [b526a2d]
- llamaindex@0.0.20
## 0.0.17
### Patch Changes
- Updated dependencies [a747f28]
- Updated dependencies [355910b]
- Updated dependencies [355910b]
- llamaindex@0.0.19
## 0.0.16
### Patch Changes
- Updated dependencies [824c13c]
- Updated dependencies [18b8915]
- Updated dependencies [ade9d8f]
- Updated dependencies [824c13c]
- llamaindex@0.0.18
## 0.0.15
### Patch Changes
- Updated dependencies [f80b062]
- Updated dependencies [b3fec86]
- Updated dependencies [b3fec86]
- llamaindex@0.0.17
## 0.0.14
### Patch Changes
- Updated dependencies [ec12633]
- Updated dependencies [9214b06]
- Updated dependencies [3316c6b]
- Updated dependencies [3316c6b]
- llamaindex@0.0.16
## 0.0.13
### Patch Changes
- Updated dependencies [b501eb5]
- Updated dependencies [f9d1a6e]
- llamaindex@0.0.15
## 0.0.12
### Patch Changes
- Updated dependencies [4ef334a]
- Updated dependencies [0af7773]
- Updated dependencies [bea4af9]
- Updated dependencies [4ef334a]
- llamaindex@0.0.14
## 0.0.11
### Patch Changes
- Updated dependencies [4f6f245]
- llamaindex@0.0.13
## 0.0.10
### Patch Changes
- Updated dependencies [68bdaaa]
- llamaindex@0.0.12
## 0.0.9
### Patch Changes
- Updated dependencies [fb7fb76]
- llamaindex@0.0.11
## 0.0.8
### Patch Changes
- Updated dependencies [6f2cb31]
- llamaindex@0.0.10
## 0.0.7
### Patch Changes
- Updated dependencies [02d9bb0]
- llamaindex@0.0.9
## 0.0.6
### Patch Changes
- Updated dependencies [ea5038e]
- llamaindex@0.0.8
## 0.0.5
### Patch Changes
- Updated dependencies [9fa6d4a]
- llamaindex@0.0.7
## 0.0.4
### Patch Changes
- Updated dependencies
- llamaindex@0.0.6
## 0.0.3
### Patch Changes
- Updated dependencies [5a765aa]
- llamaindex@0.0.5
## 0.0.2
### Patch Changes
- Updated dependencies [c65d671]
- llamaindex@0.0.4
## 0.0.1
### Patch Changes
- Updated dependencies [ca9410f]
- llamaindex@0.0.3
-10
View File
@@ -1,10 +0,0 @@
# Simple Examples
Due to packaging, you will need to run these commands to get started.
```bash
pnpm install
pnpm --filter llamaindex build
```
Then run the examples with `ts-node`, for example `npx ts-node vectorIndex.ts`
-16
View File
@@ -1,16 +0,0 @@
import { Anthropic } from "llamaindex";
(async () => {
const anthropic = new Anthropic();
const result = await anthropic.chat([
{ content: "You want to talk in rhymes.", role: "system" },
{ content: "Hello, world!", role: "user" },
{ content: "Hello!", role: "assistant" },
{
content:
"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
role: "user",
},
]);
console.log(result);
})();
-33
View File
@@ -1,33 +0,0 @@
import { stdin as input, stdout as output } from "node:process";
// readline/promises is still experimental so not in @types/node yet
// @ts-ignore
import readline from "node:readline/promises";
import {
ContextChatEngine,
Document,
serviceContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
import essay from "./essay";
async function main() {
const document = new Document({ text: essay });
const serviceContext = serviceContextFromDefaults({ chunkSize: 512 });
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
const retriever = index.asRetriever();
retriever.similarityTopK = 5;
const chatEngine = new ContextChatEngine({ retriever });
const rl = readline.createInterface({ input, output });
while (true) {
const query = await rl.question("Query: ");
const response = await chatEngine.chat(query);
console.log(response.toString());
}
}
main().catch(console.error);
-49
View File
@@ -1,49 +0,0 @@
import {
CompactAndRefine,
OpenAI,
PapaCSVReader,
ResponseSynthesizer,
serviceContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
async function main() {
// Load CSV
const reader = new PapaCSVReader();
const path = "data/titanic_train.csv";
const documents = await reader.loadData(path);
const serviceContext = serviceContextFromDefaults({
llm: new OpenAI({ model: "gpt-4" }),
});
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments(documents, {
serviceContext,
});
const csvPrompt = ({ context = "", query = "" }) => {
return `The following CSV file is loaded from ${path}
\`\`\`csv
${context}
\`\`\`
Given the CSV file, generate me Typescript code to answer the question: ${query}. You can use built in NodeJS functions but avoid using third party libraries.
`;
};
const responseSynthesizer = new ResponseSynthesizer({
responseBuilder: new CompactAndRefine(serviceContext, csvPrompt),
});
const queryEngine = index.asQueryEngine({ responseSynthesizer });
// Query the index
const response = await queryEngine.query(
"What is the correlation between survival and age?",
);
// Output response
console.log(response.toString());
}
main().catch(console.error);
File diff suppressed because it is too large Load Diff
Binary file not shown.
-715
View File
@@ -1,715 +0,0 @@
survived,pclass,name,sex,age,sibsp,parch,ticket,fare,cabin,embarked
0,3,Braund,male,22,1,0,A/5 21171,7.25,,S
1,1,Cumings,female,38,1,0,PC 17599,71.2833,C85,C
1,3,Heikkinen,female,26,0,0,STON/O2. 3101282,7.925,,S
1,1,Futrelle,female,35,1,0,113803,53.1,C123,S
0,3,Allen,male,35,0,0,373450,8.05,,S
0,1,McCarthy,male,54,0,0,17463,51.8625,E46,S
0,3,Palsson,male,2,3,1,349909,21.075,,S
1,3,Johnson,female,27,0,2,347742,11.1333,,S
1,2,Nasser,female,14,1,0,237736,30.0708,,C
1,3,Sandstrom,female,4,1,1,PP 9549,16.7,G6,S
1,1,Bonnell,female,58,0,0,113783,26.55,C103,S
0,3,Saundercock,male,20,0,0,A/5. 2151,8.05,,S
0,3,Andersson,male,39,1,5,347082,31.275,,S
0,3,Vestrom,female,14,0,0,350406,7.8542,,S
1,2,Hewlett,female,55,0,0,248706,16,,S
0,3,Rice,male,2,4,1,382652,29.125,,Q
0,3,Vander,female,31,1,0,345763,18,,S
0,2,Fynney,male,35,0,0,239865,26,,S
1,2,Beesley,male,34,0,0,248698,13,D56,S
1,3,McGowan,female,15,0,0,330923,8.0292,,Q
1,1,Sloper,male,28,0,0,113788,35.5,A6,S
0,3,Palsson,female,8,3,1,349909,21.075,,S
1,3,Asplund,female,38,1,5,347077,31.3875,,S
0,1,Fortune,male,19,3,2,19950,263,C23 C25 C27,S
0,1,Uruchurtu,male,40,0,0,PC 17601,27.7208,,C
0,2,Wheadon,male,66,0,0,C.A. 24579,10.5,,S
0,1,Meyer,male,28,1,0,PC 17604,82.1708,,C
0,1,Holverson,male,42,1,0,113789,52,,S
0,3,Cann,male,21,0,0,A./5. 2152,8.05,,S
0,3,Vander,female,18,2,0,345764,18,,S
1,3,Nicola-Yarred,female,14,1,0,2651,11.2417,,C
0,3,Ahlin,female,40,1,0,7546,9.475,,S
0,2,Turpin,female,27,1,0,11668,21,,S
1,2,Laroche,female,3,1,2,SC/Paris 2123,41.5792,,C
1,3,Devaney,female,19,0,0,330958,7.8792,,Q
0,3,Arnold-Franchi,female,18,1,0,349237,17.8,,S
0,3,Panula,male,7,4,1,3101295,39.6875,,S
0,3,Nosworthy,male,21,0,0,A/4. 39886,7.8,,S
1,1,Harper,female,49,1,0,PC 17572,76.7292,D33,C
1,2,Faunthorpe,female,29,1,0,2926,26,,S
0,1,Ostby,male,65,0,1,113509,61.9792,B30,C
1,2,Rugg,female,21,0,0,C.A. 31026,10.5,,S
0,3,Novel,male,28.5,0,0,2697,7.2292,,C
1,2,West,female,5,1,2,C.A. 34651,27.75,,S
0,3,Goodwin,male,11,5,2,CA 2144,46.9,,S
0,3,Sirayanian,male,22,0,0,2669,7.2292,,C
1,1,Icard,female,38,0,0,113572,80,B28,
0,1,Harris,male,45,1,0,36973,83.475,C83,S
0,3,Skoog,male,4,3,2,347088,27.9,,S
1,2,Nye,female,29,0,0,C.A. 29395,10.5,F33,S
0,3,Crease,male,19,0,0,S.P. 3464,8.1583,,S
1,3,Andersson,female,17,4,2,3101281,7.925,,S
0,3,Kink,male,26,2,0,315151,8.6625,,S
0,2,Jenkin,male,32,0,0,C.A. 33111,10.5,,S
0,3,Goodwin,female,16,5,2,CA 2144,46.9,,S
0,2,Hood,male,21,0,0,S.O.C. 14879,73.5,,S
0,3,Chronopoulos,male,26,1,0,2680,14.4542,,C
1,3,Bing,male,32,0,0,1601,56.4958,,S
0,3,Moen,male,25,0,0,348123,7.65,F G73,S
1,2,Caldwell,male,0.83,0,2,248738,29,,S
1,3,Dowdell,female,30,0,0,364516,12.475,,S
0,3,Waelens,male,22,0,0,345767,9,,S
1,3,Sheerlinck,male,29,0,0,345779,9.5,,S
0,1,Carrau,male,28,0,0,113059,47.1,,S
1,2,Ilett,female,17,0,0,SO/C 14885,10.5,,S
1,3,Backstrom,female,33,3,0,3101278,15.85,,S
0,3,Ford,male,16,1,3,W./C. 6608,34.375,,S
1,1,Fortune,female,23,3,2,19950,263,C23 C25 C27,S
0,3,Celotti,male,24,0,0,343275,8.05,,S
0,3,Christmann,male,29,0,0,343276,8.05,,S
0,3,Andreasson,male,20,0,0,347466,7.8542,,S
0,1,Chaffee,male,46,1,0,W.E.P. 5734,61.175,E31,S
0,3,Dean,male,26,1,2,C.A. 2315,20.575,,S
0,3,Coxon,male,59,0,0,364500,7.25,,S
0,1,Goldschmidt,male,71,0,0,PC 17754,34.6542,A5,C
1,1,Greenfield,male,23,0,1,PC 17759,63.3583,D10 D12,C
1,2,Doling,female,34,0,1,231919,23,,S
0,2,Kantor,male,34,1,0,244367,26,,S
0,3,Petranec,female,28,0,0,349245,7.8958,,S
0,1,White,male,21,0,1,35281,77.2875,D26,S
0,3,Johansson,male,33,0,0,7540,8.6542,,S
0,3,Gustafsson,male,37,2,0,3101276,7.925,,S
0,3,Mionoff,male,28,0,0,349207,7.8958,,S
1,3,Salkjelsvik,female,21,0,0,343120,7.65,,S
0,3,Rekic,male,38,0,0,349249,7.8958,,S
0,1,Porter,male,47,0,0,110465,52,C110,S
0,3,Zabour,female,14.5,1,0,2665,14.4542,,C
0,3,Barton,male,22,0,0,324669,8.05,,S
0,3,Jussila,female,20,1,0,4136,9.825,,S
0,3,Attalah,female,17,0,0,2627,14.4583,,C
0,3,Pekoniemi,male,21,0,0,STON/O 2. 3101294,7.925,,S
0,3,Connors,male,70.5,0,0,370369,7.75,,Q
0,2,Turpin,male,29,1,0,11668,21,,S
0,1,Baxter,male,24,0,1,PC 17558,247.5208,B58 B60,C
0,3,Andersson,female,2,4,2,347082,31.275,,S
0,2,Hickman,male,21,2,0,S.O.C. 14879,73.5,,S
0,2,Nasser,male,32.5,1,0,237736,30.0708,,C
1,2,Webber,female,32.5,0,0,27267,13,E101,S
0,1,White,male,54,0,1,35281,77.2875,D26,S
1,3,Nicola-Yarred,male,12,1,0,2651,11.2417,,C
1,3,Madsen,male,24,0,0,C 17369,7.1417,,S
0,3,Ekstrom,male,45,0,0,347061,6.975,,S
0,3,Drazenoic,male,33,0,0,349241,7.8958,,C
0,3,Coelho,male,20,0,0,SOTON/O.Q. 3101307,7.05,,S
0,3,Robins,female,47,1,0,A/5. 3337,14.5,,S
1,2,Weisz,female,29,1,0,228414,26,,S
0,2,Sobey,male,25,0,0,C.A. 29178,13,,S
0,2,Richard,male,23,0,0,SC/PARIS 2133,15.0458,,C
1,1,Newsom,female,19,0,2,11752,26.2833,D47,S
0,1,Futrelle,male,37,1,0,113803,53.1,C123,S
0,3,Osen,male,16,0,0,7534,9.2167,,S
0,1,Giglio,male,24,0,0,PC 17593,79.2,B86,C
1,3,Nysten,female,22,0,0,347081,7.75,,S
1,3,Hakkarainen,female,24,1,0,STON/O2. 3101279,15.85,,S
0,3,Burke,male,19,0,0,365222,6.75,,Q
0,2,Andrew,male,18,0,0,231945,11.5,,S
0,2,Nicholls,male,19,1,1,C.A. 33112,36.75,,S
1,3,Andersson,male,27,0,0,350043,7.7958,,S
0,3,Ford,female,9,2,2,W./C. 6608,34.375,,S
0,2,Navratil,male,36.5,0,2,230080,26,F2,S
0,2,Byles,male,42,0,0,244310,13,,S
0,2,Bateman,male,51,0,0,S.O.P. 1166,12.525,,S
1,1,Pears,female,22,1,0,113776,66.6,C2,S
0,3,Meo,male,55.5,0,0,A.5. 11206,8.05,,S
0,3,van,male,40.5,0,2,A/5. 851,14.5,,S
0,1,Williams,male,51,0,1,PC 17597,61.3792,,C
1,3,Gilnagh,female,16,0,0,35851,7.7333,,Q
0,3,Corn,male,30,0,0,SOTON/OQ 392090,8.05,,S
0,3,Cribb,male,44,0,1,371362,16.1,,S
1,2,Watt,female,40,0,0,C.A. 33595,15.75,,S
0,3,Bengtsson,male,26,0,0,347068,7.775,,S
0,3,Calic,male,17,0,0,315093,8.6625,,S
0,3,Panula,male,1,4,1,3101295,39.6875,,S
1,3,Goldsmith,male,9,0,2,363291,20.525,,S
0,3,Skoog,female,45,1,4,347088,27.9,,S
0,3,Ling,male,28,0,0,1601,56.4958,,S
0,1,Van,male,61,0,0,111240,33.5,B19,S
0,3,Rice,male,4,4,1,382652,29.125,,Q
1,3,Johnson,female,1,1,1,347742,11.1333,,S
0,3,Sivola,male,21,0,0,STON/O 2. 3101280,7.925,,S
0,1,Smith,male,56,0,0,17764,30.6958,A7,C
0,3,Klasen,male,18,1,1,350404,7.8542,,S
0,1,Isham,female,50,0,0,PC 17595,28.7125,C49,C
0,2,Hale,male,30,0,0,250653,13,,S
0,3,Leonard,male,36,0,0,LINE,0,,S
0,3,Asplund,male,9,4,2,347077,31.3875,,S
1,2,Becker,male,1,2,1,230136,39,F4,S
1,3,Kink-Heilmann,female,4,0,2,315153,22.025,,S
1,1,Romaine,male,45,0,0,111428,26.55,,S
0,3,Bourke,male,40,1,1,364849,15.5,,Q
0,3,Turcin,male,36,0,0,349247,7.8958,,S
1,2,Pinsky,female,32,0,0,234604,13,,S
0,2,Carbines,male,19,0,0,28424,13,,S
1,3,Andersen-Jensen,female,19,1,0,350046,7.8542,,S
1,2,Navratil,male,3,1,1,230080,26,F2,S
1,1,Brown,female,44,0,0,PC 17610,27.7208,B4,C
1,1,Lurette,female,58,0,0,PC 17569,146.5208,B80,C
0,3,Olsen,male,42,0,1,4579,8.4042,,S
0,2,Yrois,female,24,0,0,248747,13,,S
0,3,Vande,male,28,0,0,345770,9.5,,S
0,3,Johanson,male,34,0,0,3101264,6.4958,,S
0,3,Youseff,male,45.5,0,0,2628,7.225,,C
1,3,Cohen,male,18,0,0,A/5 3540,8.05,,S
0,3,Strom,female,2,0,1,347054,10.4625,G6,S
0,3,Backstrom,male,32,1,0,3101278,15.85,,S
1,3,Albimona,male,26,0,0,2699,18.7875,,C
1,3,Carr,female,16,0,0,367231,7.75,,Q
1,1,Blank,male,40,0,0,112277,31,A31,C
0,3,Ali,male,24,0,0,SOTON/O.Q. 3101311,7.05,,S
1,2,Cameron,female,35,0,0,F.C.C. 13528,21,,S
0,3,Perkin,male,22,0,0,A/5 21174,7.25,,S
0,2,Givard,male,30,0,0,250646,13,,S
1,1,Newell,female,31,1,0,35273,113.275,D36,C
1,3,Honkanen,female,27,0,0,STON/O2. 3101283,7.925,,S
0,2,Jacobsohn,male,42,1,0,243847,27,,S
1,1,Bazzani,female,32,0,0,11813,76.2917,D15,C
0,2,Harris,male,30,0,0,W/C 14208,10.5,,S
1,3,Sunderland,male,16,0,0,SOTON/OQ 392089,8.05,,S
0,2,Bracken,male,27,0,0,220367,13,,S
0,3,Green,male,51,0,0,21440,8.05,,S
1,1,Hoyt,male,38,1,0,19943,90,C93,S
0,3,Berglund,male,22,0,0,PP 4348,9.35,,S
1,2,Mellors,male,19,0,0,SW/PP 751,10.5,,S
0,3,Lovell,male,20.5,0,0,A/5 21173,7.25,,S
0,2,Fahlstrom,male,18,0,0,236171,13,,S
1,1,Harris,female,35,1,0,36973,83.475,C83,S
0,3,Larsson,male,29,0,0,347067,7.775,,S
0,2,Sjostedt,male,59,0,0,237442,13.5,,S
1,3,Asplund,female,5,4,2,347077,31.3875,,S
0,2,Leyson,male,24,0,0,C.A. 29566,10.5,,S
0,2,Hold,male,44,1,0,26707,26,,S
1,2,Collyer,female,8,0,2,C.A. 31921,26.25,,S
0,2,Pengelly,male,19,0,0,28665,10.5,,S
0,2,Hunt,male,33,0,0,SCO/W 1585,12.275,,S
0,2,Coleridge,male,29,0,0,W./C. 14263,10.5,,S
0,3,Maenpaa,male,22,0,0,STON/O 2. 3101275,7.125,,S
0,3,Attalah,male,30,0,0,2694,7.225,,C
0,1,Minahan,male,44,2,0,19928,90,C78,Q
0,3,Lindahl,female,25,0,0,347071,7.775,,S
1,2,Hamalainen,female,24,0,2,250649,14.5,,S
1,1,Beckwith,male,37,1,1,11751,52.5542,D35,S
0,2,Carter,male,54,1,0,244252,26,,S
0,3,Strom,female,29,1,1,347054,10.4625,G6,S
0,1,Stead,male,62,0,0,113514,26.55,C87,S
0,3,Lobb,male,30,1,0,A/5. 3336,16.1,,S
0,3,Rosblom,female,41,0,2,370129,20.2125,,S
1,3,Touma,female,29,0,2,2650,15.2458,,C
1,1,Cherry,female,30,0,0,110152,86.5,B77,S
1,1,Ward,female,35,0,0,PC 17755,512.3292,,C
1,2,Parrish,female,50,0,1,230433,26,,S
1,3,Asplund,male,3,4,2,347077,31.3875,,S
0,1,Taussig,male,52,1,1,110413,79.65,E67,S
0,1,Harrison,male,40,0,0,112059,0,B94,S
0,2,Reeves,male,36,0,0,C.A. 17248,10.5,,S
0,3,Panula,male,16,4,1,3101295,39.6875,,S
1,3,Persson,male,25,1,0,347083,7.775,,S
1,1,Graham,female,58,0,1,PC 17582,153.4625,C125,S
1,1,Bissette,female,35,0,0,PC 17760,135.6333,C99,S
1,3,Tornquist,male,25,0,0,LINE,0,,S
1,2,Mellinger,female,41,0,1,250644,19.5,,S
0,1,Natsch,male,37,0,1,PC 17596,29.7,C118,C
1,1,Andrews,female,63,1,0,13502,77.9583,D7,S
0,3,Lindblom,female,45,0,0,347073,7.75,,S
0,3,Rice,male,7,4,1,382652,29.125,,Q
1,3,Abbott,female,35,1,1,C.A. 2673,20.25,,S
0,3,Duane,male,65,0,0,336439,7.75,,Q
0,3,Olsson,male,28,0,0,347464,7.8542,,S
0,3,de,male,16,0,0,345778,9.5,,S
1,3,Dorking,male,19,0,0,A/5. 10482,8.05,,S
0,3,Stankovic,male,33,0,0,349239,8.6625,,C
1,3,de,male,30,0,0,345774,9.5,,S
0,3,Naidenoff,male,22,0,0,349206,7.8958,,S
1,2,Hosono,male,42,0,0,237798,13,,S
1,3,Connolly,female,22,0,0,370373,7.75,,Q
1,1,Barber,female,26,0,0,19877,78.85,,S
1,1,Bishop,female,19,1,0,11967,91.0792,B49,C
0,2,Levy,male,36,0,0,SC/Paris 2163,12.875,D,C
0,3,Haas,female,24,0,0,349236,8.85,,S
0,3,Mineff,male,24,0,0,349233,7.8958,,S
0,3,Hanna,male,23.5,0,0,2693,7.2292,,C
0,1,Allison,female,2,1,2,113781,151.55,C22 C26,S
1,1,Baxter,female,50,0,1,PC 17558,247.5208,B58 B60,C
0,3,Johnson,male,19,0,0,LINE,0,,S
1,1,Allison,male,0.92,1,2,113781,151.55,C22 C26,S
1,1,Penasco,female,17,1,0,PC 17758,108.9,C65,C
0,2,Abelson,male,30,1,0,P/PP 3381,24,,C
1,1,Francatelli,female,30,0,0,PC 17485,56.9292,E36,C
1,1,Hays,female,24,0,0,11767,83.1583,C54,C
1,1,Ryerson,female,18,2,2,PC 17608,262.375,B57 B59 B63 B66,C
0,2,Lahtinen,female,26,1,1,250651,26,,S
0,3,Hendekovic,male,28,0,0,349243,7.8958,,S
0,2,Hart,male,43,1,1,F.C.C. 13529,26.25,,S
1,3,Nilsson,female,26,0,0,347470,7.8542,,S
1,2,Kantor,female,24,1,0,244367,26,,S
0,2,Moraweck,male,54,0,0,29011,14,,S
1,1,Wick,female,31,0,2,36928,164.8667,C7,S
1,1,Spedden,female,40,1,1,16966,134.5,E34,C
0,3,Dennis,male,22,0,0,A/5 21172,7.25,,S
0,3,Danoff,male,27,0,0,349219,7.8958,,S
1,2,Slayter,female,30,0,0,234818,12.35,,Q
1,2,Caldwell,female,22,1,1,248738,29,,S
1,1,Young,female,36,0,0,PC 17760,135.6333,C32,C
0,3,Nysveen,male,61,0,0,345364,6.2375,,S
1,2,Ball,female,36,0,0,28551,13,D,S
1,3,Goldsmith,female,31,1,1,363291,20.525,,S
1,1,Hippach,female,16,0,1,111361,57.9792,B18,C
0,1,Partner,male,45.5,0,0,113043,28.5,C124,S
0,1,Graham,male,38,0,1,PC 17582,153.4625,C91,S
0,3,Vander,male,16,2,0,345764,18,,S
0,1,Pears,male,29,1,0,113776,66.6,C2,S
1,1,Burns,female,41,0,0,16966,134.5,E40,C
1,3,Dahl,male,45,0,0,7598,8.05,,S
0,1,Blackwell,male,45,0,0,113784,35.5,T,S
1,2,Navratil,male,2,1,1,230080,26,F2,S
1,1,Fortune,female,24,3,2,19950,263,C23 C25 C27,S
0,2,Collander,male,28,0,0,248740,13,,S
0,2,Sedgwick,male,25,0,0,244361,13,,S
0,2,Fox,male,36,0,0,229236,13,,S
1,2,Brown,female,24,0,0,248733,13,F33,S
1,2,Smith,female,40,0,0,31418,13,,S
1,3,Coutts,male,3,1,1,C.A. 37671,15.9,,S
0,3,Dimic,male,42,0,0,315088,8.6625,,S
0,3,Odahl,male,23,0,0,7267,9.225,,S
0,3,Elias,male,15,1,1,2695,7.2292,,C
0,3,Arnold-Franchi,male,25,1,0,349237,17.8,,S
0,3,Vanden,male,28,0,0,345783,9.5,,S
1,1,Bowerman,female,22,0,1,113505,55,E33,S
0,2,Funk,female,38,0,0,237671,13,,S
0,3,Skoog,male,40,1,4,347088,27.9,,S
0,2,del,male,29,1,0,SC/PARIS 2167,27.7208,,C
0,3,Barbara,female,45,0,1,2691,14.4542,,C
0,3,Asim,male,35,0,0,SOTON/O.Q. 3101310,7.05,,S
0,3,Adahl,male,30,0,0,C 7076,7.25,,S
1,1,Warren,female,60,1,0,110813,75.25,D37,C
1,1,Aubart,female,24,0,0,PC 17477,69.3,B35,C
1,1,Harder,male,25,1,0,11765,55.4417,E50,C
0,3,Wiklund,male,18,1,0,3101267,6.4958,,S
0,3,Beavan,male,19,0,0,323951,8.05,,S
0,1,Ringhini,male,22,0,0,PC 17760,135.6333,,C
0,3,Palsson,female,3,3,1,349909,21.075,,S
1,3,Landergren,female,22,0,0,C 7077,7.25,,S
0,1,Widener,male,27,0,2,113503,211.5,C82,C
0,3,Betros,male,20,0,0,2648,4.0125,,C
0,3,Gustafsson,male,19,0,0,347069,7.775,,S
1,1,Bidois,female,42,0,0,PC 17757,227.525,,C
1,3,Nakid,female,1,0,2,2653,15.7417,,C
0,3,Tikkanen,male,32,0,0,STON/O 2. 3101293,7.925,,S
1,1,Holverson,female,35,1,0,113789,52,,S
0,2,Davies,male,18,0,0,S.O.C. 14879,73.5,,S
0,3,Goodwin,male,1,5,2,CA 2144,46.9,,S
1,2,Buss,female,36,0,0,27849,13,,S
1,2,Lehmann,female,17,0,0,SC 1748,12,,C
1,1,Carter,male,36,1,2,113760,120,B96 B98,S
1,3,Jansson,male,21,0,0,350034,7.7958,,S
0,3,Gustafsson,male,28,2,0,3101277,7.925,,S
1,1,Newell,female,23,1,0,35273,113.275,D36,C
1,3,Sandstrom,female,24,0,2,PP 9549,16.7,G6,S
0,3,Johansson,male,22,0,0,350052,7.7958,,S
0,3,Olsson,female,31,0,0,350407,7.8542,,S
0,2,McKane,male,46,0,0,28403,26,,S
0,2,Pain,male,23,0,0,244278,10.5,,S
1,2,Trout,female,28,0,0,240929,12.65,,S
1,3,Niskanen,male,39,0,0,STON/O 2. 3101289,7.925,,S
0,3,Adams,male,26,0,0,341826,8.05,,S
0,3,Jussila,female,21,1,0,4137,9.825,,S
0,3,Hakkarainen,male,28,1,0,STON/O2. 3101279,15.85,,S
0,3,Oreskovic,female,20,0,0,315096,8.6625,,S
0,2,Gale,male,34,1,0,28664,21,,S
0,3,Widegren,male,51,0,0,347064,7.75,,S
1,2,Richards,male,3,1,1,29106,18.75,,S
0,3,Birkeland,male,21,0,0,312992,7.775,,S
1,1,Minahan,female,33,1,0,19928,90,C78,Q
1,3,Sundman,male,44,0,0,STON/O 2. 3101269,7.925,,S
1,2,Drew,female,34,1,1,28220,32.5,,S
1,2,Silven,female,18,0,2,250652,13,,S
0,2,Matthews,male,30,0,0,28228,13,,S
0,3,Van,female,10,0,2,345773,24.15,,S
0,3,Charters,male,21,0,0,A/5. 13032,7.7333,,Q
0,3,Zimmerman,male,29,0,0,315082,7.875,,S
0,3,Danbom,female,28,1,1,347080,14.4,,S
0,3,Rosblom,male,18,1,1,370129,20.2125,,S
1,2,Clarke,female,28,1,0,2003,26,,S
1,2,Phillips,female,19,0,0,250655,26,,S
1,3,Pickard,male,32,0,0,SOTON/O.Q. 392078,8.05,E10,S
1,1,Bjornstrom-Steffansson,male,28,0,0,110564,26.55,C52,S
1,2,Louch,female,42,1,0,SC/AH 3085,26,,S
0,3,Kallio,male,17,0,0,STON/O 2. 3101274,7.125,,S
0,1,Silvey,male,50,1,0,13507,55.9,E44,S
1,1,Carter,female,14,1,2,113760,120,B96 B98,S
0,3,Ford,female,21,2,2,W./C. 6608,34.375,,S
1,2,Richards,female,24,2,3,29106,18.75,,S
0,1,Fortune,male,64,1,4,19950,263,C23 C25 C27,S
0,2,Kvillner,male,31,0,0,C.A. 18723,10.5,,S
1,2,Hart,female,45,1,1,F.C.C. 13529,26.25,,S
0,3,Hampe,male,20,0,0,345769,9.5,,S
0,3,Petterson,male,25,1,0,347076,7.775,,S
1,2,Reynaldo,female,28,0,0,230434,13,,S
1,1,Dodge,male,4,0,2,33638,81.8583,A34,S
1,2,Mellinger,female,13,0,1,250644,19.5,,S
1,1,Seward,male,34,0,0,113794,26.55,,S
1,3,Baclini,female,5,2,1,2666,19.2583,,C
1,1,Peuchen,male,52,0,0,113786,30.5,C104,S
0,2,West,male,36,1,2,C.A. 34651,27.75,,S
0,1,Foreman,male,30,0,0,113051,27.75,C111,C
1,1,Goldenberg,male,49,1,0,17453,89.1042,C92,C
1,3,Jalsevac,male,29,0,0,349240,7.8958,,C
0,1,Millet,male,65,0,0,13509,26.55,E38,S
1,2,Toomey,female,50,0,0,F.C.C. 13531,10.5,,S
1,1,Anderson,male,48,0,0,19952,26.55,E12,S
0,3,Morley,male,34,0,0,364506,8.05,,S
0,1,Gee,male,47,0,0,111320,38.5,E63,S
0,2,Milling,male,48,0,0,234360,13,,S
0,3,Goncalves,male,38,0,0,SOTON/O.Q. 3101306,7.05,,S
0,1,Smart,male,56,0,0,113792,26.55,,S
1,3,Baclini,female,0.75,2,1,2666,19.2583,,C
0,3,Cacic,male,38,0,0,315089,8.6625,,S
1,2,West,female,33,1,2,C.A. 34651,27.75,,S
1,2,Jerwan,female,23,0,0,SC/AH Basle 541,13.7917,D,C
0,3,Strandberg,female,22,0,0,7553,9.8375,,S
0,2,Renouf,male,34,1,0,31027,21,,S
0,3,Braund,male,29,1,0,3460,7.0458,,S
0,3,Karlsson,male,22,0,0,350060,7.5208,,S
1,3,Hirvonen,female,2,0,1,3101298,12.2875,,S
0,3,Goodwin,male,9,5,2,CA 2144,46.9,,S
0,3,Rouse,male,50,0,0,A/5 3594,8.05,,S
1,3,Turkula,female,63,0,0,4134,9.5875,,S
1,1,Bishop,male,25,1,0,11967,91.0792,B49,C
1,1,Hoyt,female,35,1,0,19943,90,C93,S
0,1,Kent,male,58,0,0,11771,29.7,B37,C
0,3,Somerton,male,30,0,0,A.5. 18509,8.05,,S
1,3,Coutts,male,9,1,1,C.A. 37671,15.9,,S
0,3,Windelov,male,21,0,0,SOTON/OQ 3101317,7.25,,S
0,1,Molson,male,55,0,0,113787,30.5,C30,S
0,1,Artagaveytia,male,71,0,0,PC 17609,49.5042,,C
0,3,Stanley,male,21,0,0,A/4 45380,8.05,,S
1,1,Eustis,female,54,1,0,36947,78.2667,D20,C
0,1,Allison,female,25,1,2,113781,151.55,C22 C26,S
0,3,Svensson,male,24,0,0,350035,7.7958,,S
0,3,Calic,male,17,0,0,315086,8.6625,,S
0,3,Canavan,female,21,0,0,364846,7.75,,Q
0,3,Laitinen,female,37,0,0,4135,9.5875,,S
1,1,Maioni,female,16,0,0,110152,86.5,B79,S
0,1,Penasco,male,18,1,0,PC 17758,108.9,C65,C
1,2,Quick,female,33,0,2,26360,26,,S
0,3,Olsen,male,28,0,0,C 4001,22.525,,S
1,3,Lang,male,26,0,0,1601,56.4958,,S
1,3,Daly,male,29,0,0,382651,7.75,,Q
1,1,McGough,male,36,0,0,PC 17473,26.2875,E25,S
1,1,Rothschild,female,54,1,0,PC 17603,59.4,,C
0,3,Coleff,male,24,0,0,349209,7.4958,,S
0,1,Walker,male,47,0,0,36967,34.0208,D46,S
1,2,Lemore,female,34,0,0,C.A. 34260,10.5,F33,S
1,2,Angle,female,36,1,0,226875,26,,S
0,3,Pavlovic,male,32,0,0,349242,7.8958,,S
1,1,Perreault,female,30,0,0,12749,93.5,B73,S
0,3,Vovk,male,22,0,0,349252,7.8958,,S
1,1,Hippach,female,44,0,1,111361,57.9792,B18,C
0,3,Farrell,male,40.5,0,0,367232,7.75,,Q
1,2,Ridsdale,female,50,0,0,W./C. 14258,10.5,,S
0,3,Salonen,male,39,0,0,3101296,7.925,,S
0,2,Hocking,male,23,2,1,29104,11.5,,S
1,2,Quick,female,2,1,1,26360,26,,S
0,3,Elias,male,17,1,1,2690,7.2292,,C
0,3,Cacic,female,30,0,0,315084,8.6625,,S
1,2,Hart,female,7,0,2,F.C.C. 13529,26.25,,S
0,1,Butt,male,45,0,0,113050,26.55,B38,S
1,1,LeRoy,female,30,0,0,PC 17761,106.425,,C
1,1,Frolicher,female,22,0,2,13568,49.5,B39,C
1,1,Crosby,female,36,0,2,WE/P 5735,71,B22,S
0,3,Andersson,female,9,4,2,347082,31.275,,S
0,3,Andersson,female,11,4,2,347082,31.275,,S
1,2,Beane,male,32,1,0,2908,26,,S
0,1,Douglas,male,50,1,0,PC 17761,106.425,C86,C
0,1,Nicholson,male,64,0,0,693,26,,S
1,2,Beane,female,19,1,0,2908,26,,S
0,3,Goldsmith,male,33,1,1,363291,20.525,,S
1,2,Davies,male,8,1,1,C.A. 33112,36.75,,S
1,1,Thayer,male,17,0,2,17421,110.8833,C70,C
0,2,Sharp,male,27,0,0,244358,26,,S
1,3,Leeni,male,22,0,0,2620,7.225,,C
1,3,Ohman,female,22,0,0,347085,7.775,,S
0,1,Wright,male,62,0,0,113807,26.55,,S
1,1,Duff,female,48,1,0,11755,39.6,A16,C
1,1,Taussig,female,39,1,1,110413,79.65,E67,S
1,3,de,female,36,1,0,345572,17.4,,S
0,3,Sivic,male,40,0,0,349251,7.8958,,S
0,2,Norman,male,28,0,0,218629,13.5,,S
0,3,Davies,male,24,2,0,A/4 48871,24.15,,S
0,3,Stoytcheff,male,19,0,0,349205,7.8958,,S
0,3,Palsson,female,29,0,4,349909,21.075,,S
1,3,Jonsson,male,32,0,0,350417,7.8542,,S
1,2,Harris,male,62,0,0,S.W./PP 752,10.5,,S
1,1,Appleton,female,53,2,0,11769,51.4792,C101,S
1,1,Flynn,male,36,0,0,PC 17474,26.3875,E25,S
0,3,Rush,male,16,0,0,A/4. 20589,8.05,,S
0,3,Patchett,male,19,0,0,358585,14.5,,S
1,2,Garside,female,34,0,0,243880,13,,S
1,1,Silvey,female,39,1,0,13507,55.9,E44,S
1,3,Jussila,male,32,0,0,STON/O 2. 3101286,7.925,,S
1,2,Christy,female,25,1,1,237789,30,,S
1,1,Thayer,female,39,1,1,17421,110.8833,C68,C
0,2,Downton,male,54,0,0,28403,26,,S
0,1,Ross,male,36,0,0,13049,40.125,A10,C
1,1,Taussig,female,18,0,2,110413,79.65,E68,S
0,2,Jarvis,male,47,0,0,237565,15,,S
1,1,Frolicher-Stehli,male,60,1,1,13567,79.2,B41,C
0,3,Gilinski,male,22,0,0,14973,8.05,,S
0,3,Rintamaki,male,35,0,0,STON/O 2. 3101273,7.125,,S
1,1,Stephenson,female,52,1,0,36947,78.2667,D20,C
0,3,Elsbury,male,47,0,0,A/5 3902,7.25,,S
0,2,Chapman,male,37,1,0,SC/AH 29037,26,,S
0,3,Van,male,36,1,1,345773,24.15,,S
0,3,Johnson,male,49,0,0,LINE,0,,S
1,1,Duff,male,49,1,0,PC 17485,56.9292,A20,C
1,2,Jacobsohn,female,24,2,1,243847,27,,S
0,3,Torber,male,44,0,0,364511,8.05,,S
1,1,Homer,male,35,0,0,111426,26.55,,C
0,3,Lindell,male,36,1,0,349910,15.55,,S
0,3,Karaic,male,30,0,0,349246,7.8958,,S
1,1,Daniel,male,27,0,0,113804,30.5,,S
1,2,Laroche,female,22,1,2,SC/Paris 2123,41.5792,,C
1,1,Shutes,female,40,0,0,PC 17582,153.4625,C125,S
0,3,Andersson,female,39,1,5,347082,31.275,,S
0,3,Brocklebank,male,35,0,0,364512,8.05,,S
1,2,Herman,female,24,1,2,220845,65,,S
0,3,Danbom,male,34,1,1,347080,14.4,,S
0,3,Lobb,female,26,1,0,A/5. 3336,16.1,,S
1,2,Becker,female,4,2,1,230136,39,F4,S
0,2,Gavey,male,26,0,0,31028,10.5,,S
0,3,Yasbeck,male,27,1,0,2659,14.4542,,C
1,1,Kimball,male,42,1,0,11753,52.5542,D19,S
1,3,Nakid,male,20,1,1,2653,15.7417,,C
0,3,Hansen,male,21,0,0,350029,7.8542,,S
0,3,Bowen,male,21,0,0,54636,16.1,,S
0,1,Sutton,male,61,0,0,36963,32.3208,D50,S
0,2,Kirkland,male,57,0,0,219533,12.35,,Q
1,1,Longley,female,21,0,0,13502,77.9583,D9,S
0,3,Bostandyeff,male,26,0,0,349224,7.8958,,S
1,1,Barkworth,male,80,0,0,27042,30,A23,S
0,3,Lundahl,male,51,0,0,347743,7.0542,,S
1,1,Stahelin-Maeglin,male,32,0,0,13214,30.5,B50,C
0,3,Skoog,female,9,3,2,347088,27.9,,S
1,2,Davis,female,28,0,0,237668,13,,S
0,3,Leinonen,male,32,0,0,STON/O 2. 3101292,7.925,,S
0,2,Collyer,male,31,1,1,C.A. 31921,26.25,,S
0,3,Panula,female,41,0,5,3101295,39.6875,,S
0,3,Jensen,male,20,0,0,350050,7.8542,,S
1,1,Sagesser,female,24,0,0,PC 17477,69.3,B35,C
0,3,Skoog,female,2,3,2,347088,27.9,,S
1,3,Baclini,female,0.75,2,1,2666,19.2583,,C
1,1,Harper,male,48,1,0,PC 17572,76.7292,D33,C
0,3,Cor,male,19,0,0,349231,7.8958,,S
1,1,Simonius-Blumer,male,56,0,0,13213,35.5,A26,C
1,3,Stanley,female,23,0,0,CA. 2314,7.55,,S
1,2,Doling,female,18,0,1,231919,23,,S
0,3,Kalvik,male,21,0,0,8475,8.4333,,S
0,3,Hegarty,female,18,0,0,365226,6.75,,Q
0,2,Hickman,male,24,2,0,S.O.C. 14879,73.5,,S
0,3,Bourke,female,32,1,1,364849,15.5,,Q
0,2,Eitemiller,male,23,0,0,29751,13,,S
0,1,Newell,male,58,0,2,35273,113.275,D48,C
1,1,Frauenthal,male,50,2,0,PC 17611,133.65,,S
0,3,Badt,male,40,0,0,2623,7.225,,C
0,1,Colley,male,47,0,0,5727,25.5875,E58,S
0,3,Coleff,male,36,0,0,349210,7.4958,,S
1,3,Lindqvist,male,20,1,0,STON/O 2. 3101285,7.925,,S
0,2,Hickman,male,32,2,0,S.O.C. 14879,73.5,,S
0,2,Butler,male,25,0,0,234686,13,,S
0,3,Cook,male,43,0,0,A/5 3536,8.05,,S
1,2,Brown,female,40,1,1,29750,39,,S
0,1,Davidson,male,31,1,0,F.C. 12750,52,B71,S
0,2,Mitchell,male,70,0,0,C.A. 24580,10.5,,S
1,2,Wilhelms,male,31,0,0,244270,13,,S
0,3,Edvardsson,male,18,0,0,349912,7.775,,S
0,3,Sawyer,male,24.5,0,0,342826,8.05,,S
1,3,Turja,female,18,0,0,4138,9.8417,,S
0,3,Goodwin,female,43,1,6,CA 2144,46.9,,S
1,1,Cardeza,male,36,0,1,PC 17755,512.3292,B51 B53 B55,C
1,1,Hassab,male,27,0,0,PC 17572,76.7292,D49,C
0,3,Olsvigen,male,20,0,0,6563,9.225,,S
0,3,Goodwin,male,14,5,2,CA 2144,46.9,,S
0,2,Brown,male,60,1,1,29750,39,,S
0,2,Laroche,male,25,1,2,SC/Paris 2123,41.5792,,C
0,3,Panula,male,14,4,1,3101295,39.6875,,S
0,3,Dakic,male,19,0,0,349228,10.1708,,S
0,3,Fischer,male,18,0,0,350036,7.7958,,S
1,1,Madill,female,15,0,1,24160,211.3375,B5,S
1,1,Dick,male,31,1,0,17474,57,B20,S
1,3,Karun,female,4,0,1,349256,13.4167,,C
0,3,Saad,male,25,0,0,2672,7.225,,C
0,1,Weir,male,60,0,0,113800,26.55,,S
0,2,Chapman,male,52,0,0,248731,13.5,,S
0,3,Kelly,male,44,0,0,363592,8.05,,S
0,1,Thayer,male,49,1,1,17421,110.8833,C68,C
0,3,Humblen,male,42,0,0,348121,7.65,F G63,S
1,1,Astor,female,18,1,0,PC 17757,227.525,C62 C64,C
1,1,Silverthorne,male,35,0,0,PC 17475,26.2875,E24,S
0,3,Barbara,female,18,0,1,2691,14.4542,,C
0,3,Gallagher,male,25,0,0,36864,7.7417,,Q
0,3,Hansen,male,26,1,0,350025,7.8542,,S
0,2,Morley,male,39,0,0,250655,26,,S
1,2,Kelly,female,45,0,0,223596,13.5,,S
1,1,Calderhead,male,42,0,0,PC 17476,26.2875,E24,S
1,1,Cleaver,female,22,0,0,113781,151.55,,S
1,1,Mayne,female,24,0,0,PC 17482,49.5042,C90,C
1,1,Taylor,male,48,1,0,19996,52,C126,S
0,3,Larsson,male,29,0,0,7545,9.4833,,S
0,2,Greenberg,male,52,0,0,250647,13,,S
0,3,Soholt,male,19,0,0,348124,7.65,F G73,S
1,1,Endres,female,38,0,0,PC 17757,227.525,C45,C
1,2,Troutt,female,27,0,0,34218,10.5,E101,S
0,3,Johnson,male,33,0,0,347062,7.775,,S
1,2,Harper,female,6,0,1,248727,33,,S
0,3,Jensen,male,17,1,0,350048,7.0542,,S
0,2,Gillespie,male,34,0,0,12233,13,,S
0,2,Hodges,male,50,0,0,250643,13,,S
1,1,Chambers,male,27,1,0,113806,53.1,E8,S
0,3,Oreskovic,male,20,0,0,315094,8.6625,,S
1,2,Renouf,female,30,3,0,31027,21,,S
0,2,Bryhl,male,25,1,0,236853,26,,S
0,3,Ilmakangas,female,25,1,0,STON/O2. 3101271,7.925,,S
1,1,Allen,female,29,0,0,24160,211.3375,B5,S
0,3,Hassan,male,11,0,0,2699,18.7875,,C
0,2,Berriman,male,23,0,0,28425,13,,S
0,2,Troupiansky,male,23,0,0,233639,13,,S
0,3,Williams,male,28.5,0,0,54636,16.1,,S
0,3,Ford,female,48,1,3,W./C. 6608,34.375,,S
1,1,Lesurer,male,35,0,0,PC 17755,512.3292,B101,C
0,1,Cavendish,male,36,1,0,19877,78.85,C46,S
1,1,Ryerson,female,21,2,2,PC 17608,262.375,B57 B59 B63 B66,C
0,3,McNamee,male,24,1,0,376566,16.1,,S
1,3,Stranden,male,31,0,0,STON/O 2. 3101288,7.925,,S
0,1,Crosby,male,70,1,1,WE/P 5735,71,B22,S
0,3,Abbott,male,16,1,1,C.A. 2673,20.25,,S
1,2,Sinkkonen,female,30,0,0,250648,13,,S
0,1,Marvin,male,19,1,0,113773,53.1,D30,S
0,3,Connaghton,male,31,0,0,335097,7.75,,Q
1,2,Wells,female,4,1,1,29103,23,,S
1,3,Moor,male,6,0,1,392096,12.475,E121,S
0,3,Vande,male,33,0,0,345780,9.5,,S
0,3,Jonkoff,male,23,0,0,349204,7.8958,,S
1,2,Herman,female,48,1,2,220845,65,,S
1,2,Hamalainen,male,0.67,1,1,250649,14.5,,S
0,3,Carlsson,male,28,0,0,350042,7.7958,,S
0,2,Bailey,male,18,0,0,29108,11.5,,S
0,3,Theobald,male,34,0,0,363294,8.05,,S
1,1,Rothes,female,33,0,0,110152,86.5,B77,S
0,3,Nirva,male,41,0,0,SOTON/O2 3101272,7.125,,S
1,3,Barah,male,20,0,0,2663,7.2292,,C
1,1,Carter,female,36,1,2,113760,120,B96 B98,S
0,3,Eklund,male,16,0,0,347074,7.775,,S
1,1,Hogeboom,female,51,1,0,13502,77.9583,D11,S
0,3,Mangan,female,30.5,0,0,364850,7.75,,Q
0,3,Gronnestad,male,32,0,0,8471,8.3625,,S
0,3,Lievens,male,24,0,0,345781,9.5,,S
0,3,Jensen,male,48,0,0,350047,7.8542,,S
0,2,Mack,female,57,0,0,S.O./P.P. 3,10.5,E77,S
1,2,Hocking,female,54,1,3,29105,23,,S
0,3,Myhrman,male,18,0,0,347078,7.75,,S
1,3,Emanuel,female,5,0,0,364516,12.475,,S
1,1,Robert,female,43,0,1,24160,211.3375,B3,S
1,3,Ayoub,female,13,0,0,2687,7.2292,,C
1,1,Dick,female,17,1,0,17474,57,B20,S
0,1,Long,male,29,0,0,113501,30,D6,S
0,3,Ali,male,25,0,0,SOTON/O.Q. 3101312,7.05,,S
0,3,Harmer,male,25,0,0,374887,7.25,,S
1,3,Sjoblom,female,18,0,0,3101265,7.4958,,S
0,3,Rice,male,8,4,1,382652,29.125,,Q
1,3,Dean,male,1,1,2,C.A. 2315,20.575,,S
0,1,Guggenheim,male,46,0,0,PC 17593,79.2,B82 B84,C
0,2,Gaskell,male,16,0,0,239865,26,,S
0,3,Dantcheff,male,25,0,0,349203,7.8958,,S
0,2,Otter,male,39,0,0,28213,13,,S
1,1,Leader,female,49,0,0,17465,25.9292,D17,S
1,3,Osman,female,31,0,0,349244,8.6833,,S
0,3,Ibrahim,male,30,0,0,2685,7.2292,,C
0,3,Van,female,30,1,1,345773,24.15,,S
0,2,Ponesell,male,34,0,0,250647,13,,S
1,2,Collyer,female,31,1,1,C.A. 31921,26.25,,S
1,1,Carter,male,11,1,2,113760,120,B96 B98,S
1,3,Thomas,male,0.42,0,1,2625,8.5167,,C
1,3,Hedman,male,27,0,0,347089,6.975,,S
0,3,Johansson,male,31,0,0,347063,7.775,,S
0,1,Andrews,male,39,0,0,112050,0,A36,S
0,3,Pettersson,female,18,0,0,347087,7.775,,S
0,2,Meyer,male,39,0,0,248723,13,,S
1,1,Chambers,female,33,1,0,113806,53.1,E8,S
0,3,Alexander,male,26,0,0,3474,7.8875,,S
0,3,Lester,male,39,0,0,A/4 48871,24.15,,S
0,2,Slemen,male,35,0,0,28206,10.5,,S
0,3,Andersson,female,6,4,2,347082,31.275,,S
0,3,Tomlin,male,30.5,0,0,364499,8.05,,S
0,3,Heininen,female,23,0,0,STON/O2. 3101290,7.925,,S
0,2,Mallet,male,31,1,1,S.C./PARIS 2079,37.0042,,C
0,3,Holm,male,43,0,0,C 7075,6.45,,S
0,3,Skoog,male,10,3,2,347088,27.9,,S
1,1,Hays,female,52,1,1,12749,93.5,B69,S
1,3,Lulic,male,27,0,0,315098,8.6625,,S
0,1,Reuchlin,male,38,0,0,19972,0,,S
1,3,Moor,female,27,0,1,392096,12.475,E121,S
0,3,Panula,male,2,4,1,3101295,39.6875,,S
1,2,Mallet,male,1,0,2,S.C./PARIS 2079,37.0042,,C
1,1,Stone,female,62,0,0,113572,80,B28,
1,3,Yasbeck,female,15,1,0,2659,14.4542,,C
1,2,Richards,male,0.83,1,1,29106,18.75,,S
0,3,Augustsson,male,23,0,0,347468,7.8542,,S
0,3,Allum,male,18,0,0,2223,8.3,,S
1,1,Compton,female,39,1,1,PC 17756,83.1583,E49,C
0,3,Pasic,male,21,0,0,315097,8.6625,,S
1,3,Chip,male,32,0,0,1601,56.4958,,S
0,3,Alhomaki,male,20,0,0,SOTON/O2 3101287,7.925,,S
0,2,Mudd,male,16,0,0,S.O./P.P. 3,10.5,,S
1,1,Serepeca,female,30,0,0,113798,31,,C
0,3,Lemberopolous,male,34.5,0,0,2683,6.4375,,C
0,3,Culumovic,male,17,0,0,315090,8.6625,,S
0,3,Abbing,male,42,0,0,C.A. 5547,7.55,,S
0,3,Markoff,male,35,0,0,349213,7.8958,,C
0,2,Harper,male,28,0,1,248727,33,,S
0,3,Andersson,male,4,4,2,347082,31.275,,S
0,3,Svensson,male,74,0,0,347060,7.775,,S
0,3,Boulos,female,9,1,1,2678,15.2458,,C
1,1,Lines,female,16,0,1,PC 17592,39.4,D28,S
0,2,Carter,female,44,1,0,244252,26,,S
1,3,Aks,female,18,0,1,392091,9.35,,S
1,1,Wick,female,45,1,1,36928,164.8667,,S
1,1,Daly,male,51,0,0,113055,26.55,E17,S
1,3,Baclini,female,24,0,3,2666,19.2583,,C
0,3,Hansen,male,41,2,0,350026,14.1083,,S
0,2,Giles,male,21,1,0,28134,11.5,,S
1,1,Swift,female,48,0,0,17466,25.9292,D17,S
0,2,Gill,male,24,0,0,233866,13,,S
1,2,Bystrom,female,42,0,0,236852,13,,S
1,2,Duran,female,27,1,0,SC/PARIS 2149,13.8583,,C
0,1,Roebling,male,31,0,0,PC 17590,50.4958,A24,S
1,3,Johnson,male,4,1,1,347742,11.1333,,S
0,3,Balkic,male,26,0,0,349248,7.8958,,S
1,1,Beckwith,female,47,1,1,11751,52.5542,D35,S
0,1,Carlsson,male,33,0,0,695,5,B51 B53 B55,S
0,3,Vander,male,47,0,0,345765,9,,S
1,2,Abelson,female,28,1,0,P/PP 3381,24,,C
1,3,Najib,female,15,0,0,2667,7.225,,C
0,3,Gustafsson,male,20,0,0,7534,9.8458,,S
0,3,Petroff,male,19,0,0,349212,7.8958,,S
1,1,Potter,female,56,0,1,11767,83.1583,C50,C
1,2,Shelley,female,25,0,1,230433,26,,S
0,3,Markun,male,33,0,0,349257,7.8958,,S
0,3,Dahlberg,female,22,0,0,7552,10.5167,,S
0,2,Banfield,male,28,0,0,C.A./SOTON 34068,10.5,,S
0,3,Sutehall,male,25,0,0,SOTON/OQ 392076,7.05,,S
0,3,Rice,female,39,0,5,382652,29.125,,Q
0,2,Montvila,male,27,0,0,211536,13,,S
1,1,Graham,female,19,0,0,112053,30,B42,S
1,1,Behr,male,26,0,0,111369,30,C148,C
0,3,Dooley,male,32,0,0,370376,7.75,,Q
1 survived pclass name sex age sibsp parch ticket fare cabin embarked
2 0 3 Braund male 22 1 0 A/5 21171 7.25 S
3 1 1 Cumings female 38 1 0 PC 17599 71.2833 C85 C
4 1 3 Heikkinen female 26 0 0 STON/O2. 3101282 7.925 S
5 1 1 Futrelle female 35 1 0 113803 53.1 C123 S
6 0 3 Allen male 35 0 0 373450 8.05 S
7 0 1 McCarthy male 54 0 0 17463 51.8625 E46 S
8 0 3 Palsson male 2 3 1 349909 21.075 S
9 1 3 Johnson female 27 0 2 347742 11.1333 S
10 1 2 Nasser female 14 1 0 237736 30.0708 C
11 1 3 Sandstrom female 4 1 1 PP 9549 16.7 G6 S
12 1 1 Bonnell female 58 0 0 113783 26.55 C103 S
13 0 3 Saundercock male 20 0 0 A/5. 2151 8.05 S
14 0 3 Andersson male 39 1 5 347082 31.275 S
15 0 3 Vestrom female 14 0 0 350406 7.8542 S
16 1 2 Hewlett female 55 0 0 248706 16 S
17 0 3 Rice male 2 4 1 382652 29.125 Q
18 0 3 Vander female 31 1 0 345763 18 S
19 0 2 Fynney male 35 0 0 239865 26 S
20 1 2 Beesley male 34 0 0 248698 13 D56 S
21 1 3 McGowan female 15 0 0 330923 8.0292 Q
22 1 1 Sloper male 28 0 0 113788 35.5 A6 S
23 0 3 Palsson female 8 3 1 349909 21.075 S
24 1 3 Asplund female 38 1 5 347077 31.3875 S
25 0 1 Fortune male 19 3 2 19950 263 C23 C25 C27 S
26 0 1 Uruchurtu male 40 0 0 PC 17601 27.7208 C
27 0 2 Wheadon male 66 0 0 C.A. 24579 10.5 S
28 0 1 Meyer male 28 1 0 PC 17604 82.1708 C
29 0 1 Holverson male 42 1 0 113789 52 S
30 0 3 Cann male 21 0 0 A./5. 2152 8.05 S
31 0 3 Vander female 18 2 0 345764 18 S
32 1 3 Nicola-Yarred female 14 1 0 2651 11.2417 C
33 0 3 Ahlin female 40 1 0 7546 9.475 S
34 0 2 Turpin female 27 1 0 11668 21 S
35 1 2 Laroche female 3 1 2 SC/Paris 2123 41.5792 C
36 1 3 Devaney female 19 0 0 330958 7.8792 Q
37 0 3 Arnold-Franchi female 18 1 0 349237 17.8 S
38 0 3 Panula male 7 4 1 3101295 39.6875 S
39 0 3 Nosworthy male 21 0 0 A/4. 39886 7.8 S
40 1 1 Harper female 49 1 0 PC 17572 76.7292 D33 C
41 1 2 Faunthorpe female 29 1 0 2926 26 S
42 0 1 Ostby male 65 0 1 113509 61.9792 B30 C
43 1 2 Rugg female 21 0 0 C.A. 31026 10.5 S
44 0 3 Novel male 28.5 0 0 2697 7.2292 C
45 1 2 West female 5 1 2 C.A. 34651 27.75 S
46 0 3 Goodwin male 11 5 2 CA 2144 46.9 S
47 0 3 Sirayanian male 22 0 0 2669 7.2292 C
48 1 1 Icard female 38 0 0 113572 80 B28
49 0 1 Harris male 45 1 0 36973 83.475 C83 S
50 0 3 Skoog male 4 3 2 347088 27.9 S
51 1 2 Nye female 29 0 0 C.A. 29395 10.5 F33 S
52 0 3 Crease male 19 0 0 S.P. 3464 8.1583 S
53 1 3 Andersson female 17 4 2 3101281 7.925 S
54 0 3 Kink male 26 2 0 315151 8.6625 S
55 0 2 Jenkin male 32 0 0 C.A. 33111 10.5 S
56 0 3 Goodwin female 16 5 2 CA 2144 46.9 S
57 0 2 Hood male 21 0 0 S.O.C. 14879 73.5 S
58 0 3 Chronopoulos male 26 1 0 2680 14.4542 C
59 1 3 Bing male 32 0 0 1601 56.4958 S
60 0 3 Moen male 25 0 0 348123 7.65 F G73 S
61 1 2 Caldwell male 0.83 0 2 248738 29 S
62 1 3 Dowdell female 30 0 0 364516 12.475 S
63 0 3 Waelens male 22 0 0 345767 9 S
64 1 3 Sheerlinck male 29 0 0 345779 9.5 S
65 0 1 Carrau male 28 0 0 113059 47.1 S
66 1 2 Ilett female 17 0 0 SO/C 14885 10.5 S
67 1 3 Backstrom female 33 3 0 3101278 15.85 S
68 0 3 Ford male 16 1 3 W./C. 6608 34.375 S
69 1 1 Fortune female 23 3 2 19950 263 C23 C25 C27 S
70 0 3 Celotti male 24 0 0 343275 8.05 S
71 0 3 Christmann male 29 0 0 343276 8.05 S
72 0 3 Andreasson male 20 0 0 347466 7.8542 S
73 0 1 Chaffee male 46 1 0 W.E.P. 5734 61.175 E31 S
74 0 3 Dean male 26 1 2 C.A. 2315 20.575 S
75 0 3 Coxon male 59 0 0 364500 7.25 S
76 0 1 Goldschmidt male 71 0 0 PC 17754 34.6542 A5 C
77 1 1 Greenfield male 23 0 1 PC 17759 63.3583 D10 D12 C
78 1 2 Doling female 34 0 1 231919 23 S
79 0 2 Kantor male 34 1 0 244367 26 S
80 0 3 Petranec female 28 0 0 349245 7.8958 S
81 0 1 White male 21 0 1 35281 77.2875 D26 S
82 0 3 Johansson male 33 0 0 7540 8.6542 S
83 0 3 Gustafsson male 37 2 0 3101276 7.925 S
84 0 3 Mionoff male 28 0 0 349207 7.8958 S
85 1 3 Salkjelsvik female 21 0 0 343120 7.65 S
86 0 3 Rekic male 38 0 0 349249 7.8958 S
87 0 1 Porter male 47 0 0 110465 52 C110 S
88 0 3 Zabour female 14.5 1 0 2665 14.4542 C
89 0 3 Barton male 22 0 0 324669 8.05 S
90 0 3 Jussila female 20 1 0 4136 9.825 S
91 0 3 Attalah female 17 0 0 2627 14.4583 C
92 0 3 Pekoniemi male 21 0 0 STON/O 2. 3101294 7.925 S
93 0 3 Connors male 70.5 0 0 370369 7.75 Q
94 0 2 Turpin male 29 1 0 11668 21 S
95 0 1 Baxter male 24 0 1 PC 17558 247.5208 B58 B60 C
96 0 3 Andersson female 2 4 2 347082 31.275 S
97 0 2 Hickman male 21 2 0 S.O.C. 14879 73.5 S
98 0 2 Nasser male 32.5 1 0 237736 30.0708 C
99 1 2 Webber female 32.5 0 0 27267 13 E101 S
100 0 1 White male 54 0 1 35281 77.2875 D26 S
101 1 3 Nicola-Yarred male 12 1 0 2651 11.2417 C
102 1 3 Madsen male 24 0 0 C 17369 7.1417 S
103 0 3 Ekstrom male 45 0 0 347061 6.975 S
104 0 3 Drazenoic male 33 0 0 349241 7.8958 C
105 0 3 Coelho male 20 0 0 SOTON/O.Q. 3101307 7.05 S
106 0 3 Robins female 47 1 0 A/5. 3337 14.5 S
107 1 2 Weisz female 29 1 0 228414 26 S
108 0 2 Sobey male 25 0 0 C.A. 29178 13 S
109 0 2 Richard male 23 0 0 SC/PARIS 2133 15.0458 C
110 1 1 Newsom female 19 0 2 11752 26.2833 D47 S
111 0 1 Futrelle male 37 1 0 113803 53.1 C123 S
112 0 3 Osen male 16 0 0 7534 9.2167 S
113 0 1 Giglio male 24 0 0 PC 17593 79.2 B86 C
114 1 3 Nysten female 22 0 0 347081 7.75 S
115 1 3 Hakkarainen female 24 1 0 STON/O2. 3101279 15.85 S
116 0 3 Burke male 19 0 0 365222 6.75 Q
117 0 2 Andrew male 18 0 0 231945 11.5 S
118 0 2 Nicholls male 19 1 1 C.A. 33112 36.75 S
119 1 3 Andersson male 27 0 0 350043 7.7958 S
120 0 3 Ford female 9 2 2 W./C. 6608 34.375 S
121 0 2 Navratil male 36.5 0 2 230080 26 F2 S
122 0 2 Byles male 42 0 0 244310 13 S
123 0 2 Bateman male 51 0 0 S.O.P. 1166 12.525 S
124 1 1 Pears female 22 1 0 113776 66.6 C2 S
125 0 3 Meo male 55.5 0 0 A.5. 11206 8.05 S
126 0 3 van male 40.5 0 2 A/5. 851 14.5 S
127 0 1 Williams male 51 0 1 PC 17597 61.3792 C
128 1 3 Gilnagh female 16 0 0 35851 7.7333 Q
129 0 3 Corn male 30 0 0 SOTON/OQ 392090 8.05 S
130 0 3 Cribb male 44 0 1 371362 16.1 S
131 1 2 Watt female 40 0 0 C.A. 33595 15.75 S
132 0 3 Bengtsson male 26 0 0 347068 7.775 S
133 0 3 Calic male 17 0 0 315093 8.6625 S
134 0 3 Panula male 1 4 1 3101295 39.6875 S
135 1 3 Goldsmith male 9 0 2 363291 20.525 S
136 0 3 Skoog female 45 1 4 347088 27.9 S
137 0 3 Ling male 28 0 0 1601 56.4958 S
138 0 1 Van male 61 0 0 111240 33.5 B19 S
139 0 3 Rice male 4 4 1 382652 29.125 Q
140 1 3 Johnson female 1 1 1 347742 11.1333 S
141 0 3 Sivola male 21 0 0 STON/O 2. 3101280 7.925 S
142 0 1 Smith male 56 0 0 17764 30.6958 A7 C
143 0 3 Klasen male 18 1 1 350404 7.8542 S
144 0 1 Isham female 50 0 0 PC 17595 28.7125 C49 C
145 0 2 Hale male 30 0 0 250653 13 S
146 0 3 Leonard male 36 0 0 LINE 0 S
147 0 3 Asplund male 9 4 2 347077 31.3875 S
148 1 2 Becker male 1 2 1 230136 39 F4 S
149 1 3 Kink-Heilmann female 4 0 2 315153 22.025 S
150 1 1 Romaine male 45 0 0 111428 26.55 S
151 0 3 Bourke male 40 1 1 364849 15.5 Q
152 0 3 Turcin male 36 0 0 349247 7.8958 S
153 1 2 Pinsky female 32 0 0 234604 13 S
154 0 2 Carbines male 19 0 0 28424 13 S
155 1 3 Andersen-Jensen female 19 1 0 350046 7.8542 S
156 1 2 Navratil male 3 1 1 230080 26 F2 S
157 1 1 Brown female 44 0 0 PC 17610 27.7208 B4 C
158 1 1 Lurette female 58 0 0 PC 17569 146.5208 B80 C
159 0 3 Olsen male 42 0 1 4579 8.4042 S
160 0 2 Yrois female 24 0 0 248747 13 S
161 0 3 Vande male 28 0 0 345770 9.5 S
162 0 3 Johanson male 34 0 0 3101264 6.4958 S
163 0 3 Youseff male 45.5 0 0 2628 7.225 C
164 1 3 Cohen male 18 0 0 A/5 3540 8.05 S
165 0 3 Strom female 2 0 1 347054 10.4625 G6 S
166 0 3 Backstrom male 32 1 0 3101278 15.85 S
167 1 3 Albimona male 26 0 0 2699 18.7875 C
168 1 3 Carr female 16 0 0 367231 7.75 Q
169 1 1 Blank male 40 0 0 112277 31 A31 C
170 0 3 Ali male 24 0 0 SOTON/O.Q. 3101311 7.05 S
171 1 2 Cameron female 35 0 0 F.C.C. 13528 21 S
172 0 3 Perkin male 22 0 0 A/5 21174 7.25 S
173 0 2 Givard male 30 0 0 250646 13 S
174 1 1 Newell female 31 1 0 35273 113.275 D36 C
175 1 3 Honkanen female 27 0 0 STON/O2. 3101283 7.925 S
176 0 2 Jacobsohn male 42 1 0 243847 27 S
177 1 1 Bazzani female 32 0 0 11813 76.2917 D15 C
178 0 2 Harris male 30 0 0 W/C 14208 10.5 S
179 1 3 Sunderland male 16 0 0 SOTON/OQ 392089 8.05 S
180 0 2 Bracken male 27 0 0 220367 13 S
181 0 3 Green male 51 0 0 21440 8.05 S
182 1 1 Hoyt male 38 1 0 19943 90 C93 S
183 0 3 Berglund male 22 0 0 PP 4348 9.35 S
184 1 2 Mellors male 19 0 0 SW/PP 751 10.5 S
185 0 3 Lovell male 20.5 0 0 A/5 21173 7.25 S
186 0 2 Fahlstrom male 18 0 0 236171 13 S
187 1 1 Harris female 35 1 0 36973 83.475 C83 S
188 0 3 Larsson male 29 0 0 347067 7.775 S
189 0 2 Sjostedt male 59 0 0 237442 13.5 S
190 1 3 Asplund female 5 4 2 347077 31.3875 S
191 0 2 Leyson male 24 0 0 C.A. 29566 10.5 S
192 0 2 Hold male 44 1 0 26707 26 S
193 1 2 Collyer female 8 0 2 C.A. 31921 26.25 S
194 0 2 Pengelly male 19 0 0 28665 10.5 S
195 0 2 Hunt male 33 0 0 SCO/W 1585 12.275 S
196 0 2 Coleridge male 29 0 0 W./C. 14263 10.5 S
197 0 3 Maenpaa male 22 0 0 STON/O 2. 3101275 7.125 S
198 0 3 Attalah male 30 0 0 2694 7.225 C
199 0 1 Minahan male 44 2 0 19928 90 C78 Q
200 0 3 Lindahl female 25 0 0 347071 7.775 S
201 1 2 Hamalainen female 24 0 2 250649 14.5 S
202 1 1 Beckwith male 37 1 1 11751 52.5542 D35 S
203 0 2 Carter male 54 1 0 244252 26 S
204 0 3 Strom female 29 1 1 347054 10.4625 G6 S
205 0 1 Stead male 62 0 0 113514 26.55 C87 S
206 0 3 Lobb male 30 1 0 A/5. 3336 16.1 S
207 0 3 Rosblom female 41 0 2 370129 20.2125 S
208 1 3 Touma female 29 0 2 2650 15.2458 C
209 1 1 Cherry female 30 0 0 110152 86.5 B77 S
210 1 1 Ward female 35 0 0 PC 17755 512.3292 C
211 1 2 Parrish female 50 0 1 230433 26 S
212 1 3 Asplund male 3 4 2 347077 31.3875 S
213 0 1 Taussig male 52 1 1 110413 79.65 E67 S
214 0 1 Harrison male 40 0 0 112059 0 B94 S
215 0 2 Reeves male 36 0 0 C.A. 17248 10.5 S
216 0 3 Panula male 16 4 1 3101295 39.6875 S
217 1 3 Persson male 25 1 0 347083 7.775 S
218 1 1 Graham female 58 0 1 PC 17582 153.4625 C125 S
219 1 1 Bissette female 35 0 0 PC 17760 135.6333 C99 S
220 1 3 Tornquist male 25 0 0 LINE 0 S
221 1 2 Mellinger female 41 0 1 250644 19.5 S
222 0 1 Natsch male 37 0 1 PC 17596 29.7 C118 C
223 1 1 Andrews female 63 1 0 13502 77.9583 D7 S
224 0 3 Lindblom female 45 0 0 347073 7.75 S
225 0 3 Rice male 7 4 1 382652 29.125 Q
226 1 3 Abbott female 35 1 1 C.A. 2673 20.25 S
227 0 3 Duane male 65 0 0 336439 7.75 Q
228 0 3 Olsson male 28 0 0 347464 7.8542 S
229 0 3 de male 16 0 0 345778 9.5 S
230 1 3 Dorking male 19 0 0 A/5. 10482 8.05 S
231 0 3 Stankovic male 33 0 0 349239 8.6625 C
232 1 3 de male 30 0 0 345774 9.5 S
233 0 3 Naidenoff male 22 0 0 349206 7.8958 S
234 1 2 Hosono male 42 0 0 237798 13 S
235 1 3 Connolly female 22 0 0 370373 7.75 Q
236 1 1 Barber female 26 0 0 19877 78.85 S
237 1 1 Bishop female 19 1 0 11967 91.0792 B49 C
238 0 2 Levy male 36 0 0 SC/Paris 2163 12.875 D C
239 0 3 Haas female 24 0 0 349236 8.85 S
240 0 3 Mineff male 24 0 0 349233 7.8958 S
241 0 3 Hanna male 23.5 0 0 2693 7.2292 C
242 0 1 Allison female 2 1 2 113781 151.55 C22 C26 S
243 1 1 Baxter female 50 0 1 PC 17558 247.5208 B58 B60 C
244 0 3 Johnson male 19 0 0 LINE 0 S
245 1 1 Allison male 0.92 1 2 113781 151.55 C22 C26 S
246 1 1 Penasco female 17 1 0 PC 17758 108.9 C65 C
247 0 2 Abelson male 30 1 0 P/PP 3381 24 C
248 1 1 Francatelli female 30 0 0 PC 17485 56.9292 E36 C
249 1 1 Hays female 24 0 0 11767 83.1583 C54 C
250 1 1 Ryerson female 18 2 2 PC 17608 262.375 B57 B59 B63 B66 C
251 0 2 Lahtinen female 26 1 1 250651 26 S
252 0 3 Hendekovic male 28 0 0 349243 7.8958 S
253 0 2 Hart male 43 1 1 F.C.C. 13529 26.25 S
254 1 3 Nilsson female 26 0 0 347470 7.8542 S
255 1 2 Kantor female 24 1 0 244367 26 S
256 0 2 Moraweck male 54 0 0 29011 14 S
257 1 1 Wick female 31 0 2 36928 164.8667 C7 S
258 1 1 Spedden female 40 1 1 16966 134.5 E34 C
259 0 3 Dennis male 22 0 0 A/5 21172 7.25 S
260 0 3 Danoff male 27 0 0 349219 7.8958 S
261 1 2 Slayter female 30 0 0 234818 12.35 Q
262 1 2 Caldwell female 22 1 1 248738 29 S
263 1 1 Young female 36 0 0 PC 17760 135.6333 C32 C
264 0 3 Nysveen male 61 0 0 345364 6.2375 S
265 1 2 Ball female 36 0 0 28551 13 D S
266 1 3 Goldsmith female 31 1 1 363291 20.525 S
267 1 1 Hippach female 16 0 1 111361 57.9792 B18 C
268 0 1 Partner male 45.5 0 0 113043 28.5 C124 S
269 0 1 Graham male 38 0 1 PC 17582 153.4625 C91 S
270 0 3 Vander male 16 2 0 345764 18 S
271 0 1 Pears male 29 1 0 113776 66.6 C2 S
272 1 1 Burns female 41 0 0 16966 134.5 E40 C
273 1 3 Dahl male 45 0 0 7598 8.05 S
274 0 1 Blackwell male 45 0 0 113784 35.5 T S
275 1 2 Navratil male 2 1 1 230080 26 F2 S
276 1 1 Fortune female 24 3 2 19950 263 C23 C25 C27 S
277 0 2 Collander male 28 0 0 248740 13 S
278 0 2 Sedgwick male 25 0 0 244361 13 S
279 0 2 Fox male 36 0 0 229236 13 S
280 1 2 Brown female 24 0 0 248733 13 F33 S
281 1 2 Smith female 40 0 0 31418 13 S
282 1 3 Coutts male 3 1 1 C.A. 37671 15.9 S
283 0 3 Dimic male 42 0 0 315088 8.6625 S
284 0 3 Odahl male 23 0 0 7267 9.225 S
285 0 3 Elias male 15 1 1 2695 7.2292 C
286 0 3 Arnold-Franchi male 25 1 0 349237 17.8 S
287 0 3 Vanden male 28 0 0 345783 9.5 S
288 1 1 Bowerman female 22 0 1 113505 55 E33 S
289 0 2 Funk female 38 0 0 237671 13 S
290 0 3 Skoog male 40 1 4 347088 27.9 S
291 0 2 del male 29 1 0 SC/PARIS 2167 27.7208 C
292 0 3 Barbara female 45 0 1 2691 14.4542 C
293 0 3 Asim male 35 0 0 SOTON/O.Q. 3101310 7.05 S
294 0 3 Adahl male 30 0 0 C 7076 7.25 S
295 1 1 Warren female 60 1 0 110813 75.25 D37 C
296 1 1 Aubart female 24 0 0 PC 17477 69.3 B35 C
297 1 1 Harder male 25 1 0 11765 55.4417 E50 C
298 0 3 Wiklund male 18 1 0 3101267 6.4958 S
299 0 3 Beavan male 19 0 0 323951 8.05 S
300 0 1 Ringhini male 22 0 0 PC 17760 135.6333 C
301 0 3 Palsson female 3 3 1 349909 21.075 S
302 1 3 Landergren female 22 0 0 C 7077 7.25 S
303 0 1 Widener male 27 0 2 113503 211.5 C82 C
304 0 3 Betros male 20 0 0 2648 4.0125 C
305 0 3 Gustafsson male 19 0 0 347069 7.775 S
306 1 1 Bidois female 42 0 0 PC 17757 227.525 C
307 1 3 Nakid female 1 0 2 2653 15.7417 C
308 0 3 Tikkanen male 32 0 0 STON/O 2. 3101293 7.925 S
309 1 1 Holverson female 35 1 0 113789 52 S
310 0 2 Davies male 18 0 0 S.O.C. 14879 73.5 S
311 0 3 Goodwin male 1 5 2 CA 2144 46.9 S
312 1 2 Buss female 36 0 0 27849 13 S
313 1 2 Lehmann female 17 0 0 SC 1748 12 C
314 1 1 Carter male 36 1 2 113760 120 B96 B98 S
315 1 3 Jansson male 21 0 0 350034 7.7958 S
316 0 3 Gustafsson male 28 2 0 3101277 7.925 S
317 1 1 Newell female 23 1 0 35273 113.275 D36 C
318 1 3 Sandstrom female 24 0 2 PP 9549 16.7 G6 S
319 0 3 Johansson male 22 0 0 350052 7.7958 S
320 0 3 Olsson female 31 0 0 350407 7.8542 S
321 0 2 McKane male 46 0 0 28403 26 S
322 0 2 Pain male 23 0 0 244278 10.5 S
323 1 2 Trout female 28 0 0 240929 12.65 S
324 1 3 Niskanen male 39 0 0 STON/O 2. 3101289 7.925 S
325 0 3 Adams male 26 0 0 341826 8.05 S
326 0 3 Jussila female 21 1 0 4137 9.825 S
327 0 3 Hakkarainen male 28 1 0 STON/O2. 3101279 15.85 S
328 0 3 Oreskovic female 20 0 0 315096 8.6625 S
329 0 2 Gale male 34 1 0 28664 21 S
330 0 3 Widegren male 51 0 0 347064 7.75 S
331 1 2 Richards male 3 1 1 29106 18.75 S
332 0 3 Birkeland male 21 0 0 312992 7.775 S
333 1 1 Minahan female 33 1 0 19928 90 C78 Q
334 1 3 Sundman male 44 0 0 STON/O 2. 3101269 7.925 S
335 1 2 Drew female 34 1 1 28220 32.5 S
336 1 2 Silven female 18 0 2 250652 13 S
337 0 2 Matthews male 30 0 0 28228 13 S
338 0 3 Van female 10 0 2 345773 24.15 S
339 0 3 Charters male 21 0 0 A/5. 13032 7.7333 Q
340 0 3 Zimmerman male 29 0 0 315082 7.875 S
341 0 3 Danbom female 28 1 1 347080 14.4 S
342 0 3 Rosblom male 18 1 1 370129 20.2125 S
343 1 2 Clarke female 28 1 0 2003 26 S
344 1 2 Phillips female 19 0 0 250655 26 S
345 1 3 Pickard male 32 0 0 SOTON/O.Q. 392078 8.05 E10 S
346 1 1 Bjornstrom-Steffansson male 28 0 0 110564 26.55 C52 S
347 1 2 Louch female 42 1 0 SC/AH 3085 26 S
348 0 3 Kallio male 17 0 0 STON/O 2. 3101274 7.125 S
349 0 1 Silvey male 50 1 0 13507 55.9 E44 S
350 1 1 Carter female 14 1 2 113760 120 B96 B98 S
351 0 3 Ford female 21 2 2 W./C. 6608 34.375 S
352 1 2 Richards female 24 2 3 29106 18.75 S
353 0 1 Fortune male 64 1 4 19950 263 C23 C25 C27 S
354 0 2 Kvillner male 31 0 0 C.A. 18723 10.5 S
355 1 2 Hart female 45 1 1 F.C.C. 13529 26.25 S
356 0 3 Hampe male 20 0 0 345769 9.5 S
357 0 3 Petterson male 25 1 0 347076 7.775 S
358 1 2 Reynaldo female 28 0 0 230434 13 S
359 1 1 Dodge male 4 0 2 33638 81.8583 A34 S
360 1 2 Mellinger female 13 0 1 250644 19.5 S
361 1 1 Seward male 34 0 0 113794 26.55 S
362 1 3 Baclini female 5 2 1 2666 19.2583 C
363 1 1 Peuchen male 52 0 0 113786 30.5 C104 S
364 0 2 West male 36 1 2 C.A. 34651 27.75 S
365 0 1 Foreman male 30 0 0 113051 27.75 C111 C
366 1 1 Goldenberg male 49 1 0 17453 89.1042 C92 C
367 1 3 Jalsevac male 29 0 0 349240 7.8958 C
368 0 1 Millet male 65 0 0 13509 26.55 E38 S
369 1 2 Toomey female 50 0 0 F.C.C. 13531 10.5 S
370 1 1 Anderson male 48 0 0 19952 26.55 E12 S
371 0 3 Morley male 34 0 0 364506 8.05 S
372 0 1 Gee male 47 0 0 111320 38.5 E63 S
373 0 2 Milling male 48 0 0 234360 13 S
374 0 3 Goncalves male 38 0 0 SOTON/O.Q. 3101306 7.05 S
375 0 1 Smart male 56 0 0 113792 26.55 S
376 1 3 Baclini female 0.75 2 1 2666 19.2583 C
377 0 3 Cacic male 38 0 0 315089 8.6625 S
378 1 2 West female 33 1 2 C.A. 34651 27.75 S
379 1 2 Jerwan female 23 0 0 SC/AH Basle 541 13.7917 D C
380 0 3 Strandberg female 22 0 0 7553 9.8375 S
381 0 2 Renouf male 34 1 0 31027 21 S
382 0 3 Braund male 29 1 0 3460 7.0458 S
383 0 3 Karlsson male 22 0 0 350060 7.5208 S
384 1 3 Hirvonen female 2 0 1 3101298 12.2875 S
385 0 3 Goodwin male 9 5 2 CA 2144 46.9 S
386 0 3 Rouse male 50 0 0 A/5 3594 8.05 S
387 1 3 Turkula female 63 0 0 4134 9.5875 S
388 1 1 Bishop male 25 1 0 11967 91.0792 B49 C
389 1 1 Hoyt female 35 1 0 19943 90 C93 S
390 0 1 Kent male 58 0 0 11771 29.7 B37 C
391 0 3 Somerton male 30 0 0 A.5. 18509 8.05 S
392 1 3 Coutts male 9 1 1 C.A. 37671 15.9 S
393 0 3 Windelov male 21 0 0 SOTON/OQ 3101317 7.25 S
394 0 1 Molson male 55 0 0 113787 30.5 C30 S
395 0 1 Artagaveytia male 71 0 0 PC 17609 49.5042 C
396 0 3 Stanley male 21 0 0 A/4 45380 8.05 S
397 1 1 Eustis female 54 1 0 36947 78.2667 D20 C
398 0 1 Allison female 25 1 2 113781 151.55 C22 C26 S
399 0 3 Svensson male 24 0 0 350035 7.7958 S
400 0 3 Calic male 17 0 0 315086 8.6625 S
401 0 3 Canavan female 21 0 0 364846 7.75 Q
402 0 3 Laitinen female 37 0 0 4135 9.5875 S
403 1 1 Maioni female 16 0 0 110152 86.5 B79 S
404 0 1 Penasco male 18 1 0 PC 17758 108.9 C65 C
405 1 2 Quick female 33 0 2 26360 26 S
406 0 3 Olsen male 28 0 0 C 4001 22.525 S
407 1 3 Lang male 26 0 0 1601 56.4958 S
408 1 3 Daly male 29 0 0 382651 7.75 Q
409 1 1 McGough male 36 0 0 PC 17473 26.2875 E25 S
410 1 1 Rothschild female 54 1 0 PC 17603 59.4 C
411 0 3 Coleff male 24 0 0 349209 7.4958 S
412 0 1 Walker male 47 0 0 36967 34.0208 D46 S
413 1 2 Lemore female 34 0 0 C.A. 34260 10.5 F33 S
414 1 2 Angle female 36 1 0 226875 26 S
415 0 3 Pavlovic male 32 0 0 349242 7.8958 S
416 1 1 Perreault female 30 0 0 12749 93.5 B73 S
417 0 3 Vovk male 22 0 0 349252 7.8958 S
418 1 1 Hippach female 44 0 1 111361 57.9792 B18 C
419 0 3 Farrell male 40.5 0 0 367232 7.75 Q
420 1 2 Ridsdale female 50 0 0 W./C. 14258 10.5 S
421 0 3 Salonen male 39 0 0 3101296 7.925 S
422 0 2 Hocking male 23 2 1 29104 11.5 S
423 1 2 Quick female 2 1 1 26360 26 S
424 0 3 Elias male 17 1 1 2690 7.2292 C
425 0 3 Cacic female 30 0 0 315084 8.6625 S
426 1 2 Hart female 7 0 2 F.C.C. 13529 26.25 S
427 0 1 Butt male 45 0 0 113050 26.55 B38 S
428 1 1 LeRoy female 30 0 0 PC 17761 106.425 C
429 1 1 Frolicher female 22 0 2 13568 49.5 B39 C
430 1 1 Crosby female 36 0 2 WE/P 5735 71 B22 S
431 0 3 Andersson female 9 4 2 347082 31.275 S
432 0 3 Andersson female 11 4 2 347082 31.275 S
433 1 2 Beane male 32 1 0 2908 26 S
434 0 1 Douglas male 50 1 0 PC 17761 106.425 C86 C
435 0 1 Nicholson male 64 0 0 693 26 S
436 1 2 Beane female 19 1 0 2908 26 S
437 0 3 Goldsmith male 33 1 1 363291 20.525 S
438 1 2 Davies male 8 1 1 C.A. 33112 36.75 S
439 1 1 Thayer male 17 0 2 17421 110.8833 C70 C
440 0 2 Sharp male 27 0 0 244358 26 S
441 1 3 Leeni male 22 0 0 2620 7.225 C
442 1 3 Ohman female 22 0 0 347085 7.775 S
443 0 1 Wright male 62 0 0 113807 26.55 S
444 1 1 Duff female 48 1 0 11755 39.6 A16 C
445 1 1 Taussig female 39 1 1 110413 79.65 E67 S
446 1 3 de female 36 1 0 345572 17.4 S
447 0 3 Sivic male 40 0 0 349251 7.8958 S
448 0 2 Norman male 28 0 0 218629 13.5 S
449 0 3 Davies male 24 2 0 A/4 48871 24.15 S
450 0 3 Stoytcheff male 19 0 0 349205 7.8958 S
451 0 3 Palsson female 29 0 4 349909 21.075 S
452 1 3 Jonsson male 32 0 0 350417 7.8542 S
453 1 2 Harris male 62 0 0 S.W./PP 752 10.5 S
454 1 1 Appleton female 53 2 0 11769 51.4792 C101 S
455 1 1 Flynn male 36 0 0 PC 17474 26.3875 E25 S
456 0 3 Rush male 16 0 0 A/4. 20589 8.05 S
457 0 3 Patchett male 19 0 0 358585 14.5 S
458 1 2 Garside female 34 0 0 243880 13 S
459 1 1 Silvey female 39 1 0 13507 55.9 E44 S
460 1 3 Jussila male 32 0 0 STON/O 2. 3101286 7.925 S
461 1 2 Christy female 25 1 1 237789 30 S
462 1 1 Thayer female 39 1 1 17421 110.8833 C68 C
463 0 2 Downton male 54 0 0 28403 26 S
464 0 1 Ross male 36 0 0 13049 40.125 A10 C
465 1 1 Taussig female 18 0 2 110413 79.65 E68 S
466 0 2 Jarvis male 47 0 0 237565 15 S
467 1 1 Frolicher-Stehli male 60 1 1 13567 79.2 B41 C
468 0 3 Gilinski male 22 0 0 14973 8.05 S
469 0 3 Rintamaki male 35 0 0 STON/O 2. 3101273 7.125 S
470 1 1 Stephenson female 52 1 0 36947 78.2667 D20 C
471 0 3 Elsbury male 47 0 0 A/5 3902 7.25 S
472 0 2 Chapman male 37 1 0 SC/AH 29037 26 S
473 0 3 Van male 36 1 1 345773 24.15 S
474 0 3 Johnson male 49 0 0 LINE 0 S
475 1 1 Duff male 49 1 0 PC 17485 56.9292 A20 C
476 1 2 Jacobsohn female 24 2 1 243847 27 S
477 0 3 Torber male 44 0 0 364511 8.05 S
478 1 1 Homer male 35 0 0 111426 26.55 C
479 0 3 Lindell male 36 1 0 349910 15.55 S
480 0 3 Karaic male 30 0 0 349246 7.8958 S
481 1 1 Daniel male 27 0 0 113804 30.5 S
482 1 2 Laroche female 22 1 2 SC/Paris 2123 41.5792 C
483 1 1 Shutes female 40 0 0 PC 17582 153.4625 C125 S
484 0 3 Andersson female 39 1 5 347082 31.275 S
485 0 3 Brocklebank male 35 0 0 364512 8.05 S
486 1 2 Herman female 24 1 2 220845 65 S
487 0 3 Danbom male 34 1 1 347080 14.4 S
488 0 3 Lobb female 26 1 0 A/5. 3336 16.1 S
489 1 2 Becker female 4 2 1 230136 39 F4 S
490 0 2 Gavey male 26 0 0 31028 10.5 S
491 0 3 Yasbeck male 27 1 0 2659 14.4542 C
492 1 1 Kimball male 42 1 0 11753 52.5542 D19 S
493 1 3 Nakid male 20 1 1 2653 15.7417 C
494 0 3 Hansen male 21 0 0 350029 7.8542 S
495 0 3 Bowen male 21 0 0 54636 16.1 S
496 0 1 Sutton male 61 0 0 36963 32.3208 D50 S
497 0 2 Kirkland male 57 0 0 219533 12.35 Q
498 1 1 Longley female 21 0 0 13502 77.9583 D9 S
499 0 3 Bostandyeff male 26 0 0 349224 7.8958 S
500 1 1 Barkworth male 80 0 0 27042 30 A23 S
501 0 3 Lundahl male 51 0 0 347743 7.0542 S
502 1 1 Stahelin-Maeglin male 32 0 0 13214 30.5 B50 C
503 0 3 Skoog female 9 3 2 347088 27.9 S
504 1 2 Davis female 28 0 0 237668 13 S
505 0 3 Leinonen male 32 0 0 STON/O 2. 3101292 7.925 S
506 0 2 Collyer male 31 1 1 C.A. 31921 26.25 S
507 0 3 Panula female 41 0 5 3101295 39.6875 S
508 0 3 Jensen male 20 0 0 350050 7.8542 S
509 1 1 Sagesser female 24 0 0 PC 17477 69.3 B35 C
510 0 3 Skoog female 2 3 2 347088 27.9 S
511 1 3 Baclini female 0.75 2 1 2666 19.2583 C
512 1 1 Harper male 48 1 0 PC 17572 76.7292 D33 C
513 0 3 Cor male 19 0 0 349231 7.8958 S
514 1 1 Simonius-Blumer male 56 0 0 13213 35.5 A26 C
515 1 3 Stanley female 23 0 0 CA. 2314 7.55 S
516 1 2 Doling female 18 0 1 231919 23 S
517 0 3 Kalvik male 21 0 0 8475 8.4333 S
518 0 3 Hegarty female 18 0 0 365226 6.75 Q
519 0 2 Hickman male 24 2 0 S.O.C. 14879 73.5 S
520 0 3 Bourke female 32 1 1 364849 15.5 Q
521 0 2 Eitemiller male 23 0 0 29751 13 S
522 0 1 Newell male 58 0 2 35273 113.275 D48 C
523 1 1 Frauenthal male 50 2 0 PC 17611 133.65 S
524 0 3 Badt male 40 0 0 2623 7.225 C
525 0 1 Colley male 47 0 0 5727 25.5875 E58 S
526 0 3 Coleff male 36 0 0 349210 7.4958 S
527 1 3 Lindqvist male 20 1 0 STON/O 2. 3101285 7.925 S
528 0 2 Hickman male 32 2 0 S.O.C. 14879 73.5 S
529 0 2 Butler male 25 0 0 234686 13 S
530 0 3 Cook male 43 0 0 A/5 3536 8.05 S
531 1 2 Brown female 40 1 1 29750 39 S
532 0 1 Davidson male 31 1 0 F.C. 12750 52 B71 S
533 0 2 Mitchell male 70 0 0 C.A. 24580 10.5 S
534 1 2 Wilhelms male 31 0 0 244270 13 S
535 0 3 Edvardsson male 18 0 0 349912 7.775 S
536 0 3 Sawyer male 24.5 0 0 342826 8.05 S
537 1 3 Turja female 18 0 0 4138 9.8417 S
538 0 3 Goodwin female 43 1 6 CA 2144 46.9 S
539 1 1 Cardeza male 36 0 1 PC 17755 512.3292 B51 B53 B55 C
540 1 1 Hassab male 27 0 0 PC 17572 76.7292 D49 C
541 0 3 Olsvigen male 20 0 0 6563 9.225 S
542 0 3 Goodwin male 14 5 2 CA 2144 46.9 S
543 0 2 Brown male 60 1 1 29750 39 S
544 0 2 Laroche male 25 1 2 SC/Paris 2123 41.5792 C
545 0 3 Panula male 14 4 1 3101295 39.6875 S
546 0 3 Dakic male 19 0 0 349228 10.1708 S
547 0 3 Fischer male 18 0 0 350036 7.7958 S
548 1 1 Madill female 15 0 1 24160 211.3375 B5 S
549 1 1 Dick male 31 1 0 17474 57 B20 S
550 1 3 Karun female 4 0 1 349256 13.4167 C
551 0 3 Saad male 25 0 0 2672 7.225 C
552 0 1 Weir male 60 0 0 113800 26.55 S
553 0 2 Chapman male 52 0 0 248731 13.5 S
554 0 3 Kelly male 44 0 0 363592 8.05 S
555 0 1 Thayer male 49 1 1 17421 110.8833 C68 C
556 0 3 Humblen male 42 0 0 348121 7.65 F G63 S
557 1 1 Astor female 18 1 0 PC 17757 227.525 C62 C64 C
558 1 1 Silverthorne male 35 0 0 PC 17475 26.2875 E24 S
559 0 3 Barbara female 18 0 1 2691 14.4542 C
560 0 3 Gallagher male 25 0 0 36864 7.7417 Q
561 0 3 Hansen male 26 1 0 350025 7.8542 S
562 0 2 Morley male 39 0 0 250655 26 S
563 1 2 Kelly female 45 0 0 223596 13.5 S
564 1 1 Calderhead male 42 0 0 PC 17476 26.2875 E24 S
565 1 1 Cleaver female 22 0 0 113781 151.55 S
566 1 1 Mayne female 24 0 0 PC 17482 49.5042 C90 C
567 1 1 Taylor male 48 1 0 19996 52 C126 S
568 0 3 Larsson male 29 0 0 7545 9.4833 S
569 0 2 Greenberg male 52 0 0 250647 13 S
570 0 3 Soholt male 19 0 0 348124 7.65 F G73 S
571 1 1 Endres female 38 0 0 PC 17757 227.525 C45 C
572 1 2 Troutt female 27 0 0 34218 10.5 E101 S
573 0 3 Johnson male 33 0 0 347062 7.775 S
574 1 2 Harper female 6 0 1 248727 33 S
575 0 3 Jensen male 17 1 0 350048 7.0542 S
576 0 2 Gillespie male 34 0 0 12233 13 S
577 0 2 Hodges male 50 0 0 250643 13 S
578 1 1 Chambers male 27 1 0 113806 53.1 E8 S
579 0 3 Oreskovic male 20 0 0 315094 8.6625 S
580 1 2 Renouf female 30 3 0 31027 21 S
581 0 2 Bryhl male 25 1 0 236853 26 S
582 0 3 Ilmakangas female 25 1 0 STON/O2. 3101271 7.925 S
583 1 1 Allen female 29 0 0 24160 211.3375 B5 S
584 0 3 Hassan male 11 0 0 2699 18.7875 C
585 0 2 Berriman male 23 0 0 28425 13 S
586 0 2 Troupiansky male 23 0 0 233639 13 S
587 0 3 Williams male 28.5 0 0 54636 16.1 S
588 0 3 Ford female 48 1 3 W./C. 6608 34.375 S
589 1 1 Lesurer male 35 0 0 PC 17755 512.3292 B101 C
590 0 1 Cavendish male 36 1 0 19877 78.85 C46 S
591 1 1 Ryerson female 21 2 2 PC 17608 262.375 B57 B59 B63 B66 C
592 0 3 McNamee male 24 1 0 376566 16.1 S
593 1 3 Stranden male 31 0 0 STON/O 2. 3101288 7.925 S
594 0 1 Crosby male 70 1 1 WE/P 5735 71 B22 S
595 0 3 Abbott male 16 1 1 C.A. 2673 20.25 S
596 1 2 Sinkkonen female 30 0 0 250648 13 S
597 0 1 Marvin male 19 1 0 113773 53.1 D30 S
598 0 3 Connaghton male 31 0 0 335097 7.75 Q
599 1 2 Wells female 4 1 1 29103 23 S
600 1 3 Moor male 6 0 1 392096 12.475 E121 S
601 0 3 Vande male 33 0 0 345780 9.5 S
602 0 3 Jonkoff male 23 0 0 349204 7.8958 S
603 1 2 Herman female 48 1 2 220845 65 S
604 1 2 Hamalainen male 0.67 1 1 250649 14.5 S
605 0 3 Carlsson male 28 0 0 350042 7.7958 S
606 0 2 Bailey male 18 0 0 29108 11.5 S
607 0 3 Theobald male 34 0 0 363294 8.05 S
608 1 1 Rothes female 33 0 0 110152 86.5 B77 S
609 0 3 Nirva male 41 0 0 SOTON/O2 3101272 7.125 S
610 1 3 Barah male 20 0 0 2663 7.2292 C
611 1 1 Carter female 36 1 2 113760 120 B96 B98 S
612 0 3 Eklund male 16 0 0 347074 7.775 S
613 1 1 Hogeboom female 51 1 0 13502 77.9583 D11 S
614 0 3 Mangan female 30.5 0 0 364850 7.75 Q
615 0 3 Gronnestad male 32 0 0 8471 8.3625 S
616 0 3 Lievens male 24 0 0 345781 9.5 S
617 0 3 Jensen male 48 0 0 350047 7.8542 S
618 0 2 Mack female 57 0 0 S.O./P.P. 3 10.5 E77 S
619 1 2 Hocking female 54 1 3 29105 23 S
620 0 3 Myhrman male 18 0 0 347078 7.75 S
621 1 3 Emanuel female 5 0 0 364516 12.475 S
622 1 1 Robert female 43 0 1 24160 211.3375 B3 S
623 1 3 Ayoub female 13 0 0 2687 7.2292 C
624 1 1 Dick female 17 1 0 17474 57 B20 S
625 0 1 Long male 29 0 0 113501 30 D6 S
626 0 3 Ali male 25 0 0 SOTON/O.Q. 3101312 7.05 S
627 0 3 Harmer male 25 0 0 374887 7.25 S
628 1 3 Sjoblom female 18 0 0 3101265 7.4958 S
629 0 3 Rice male 8 4 1 382652 29.125 Q
630 1 3 Dean male 1 1 2 C.A. 2315 20.575 S
631 0 1 Guggenheim male 46 0 0 PC 17593 79.2 B82 B84 C
632 0 2 Gaskell male 16 0 0 239865 26 S
633 0 3 Dantcheff male 25 0 0 349203 7.8958 S
634 0 2 Otter male 39 0 0 28213 13 S
635 1 1 Leader female 49 0 0 17465 25.9292 D17 S
636 1 3 Osman female 31 0 0 349244 8.6833 S
637 0 3 Ibrahim male 30 0 0 2685 7.2292 C
638 0 3 Van female 30 1 1 345773 24.15 S
639 0 2 Ponesell male 34 0 0 250647 13 S
640 1 2 Collyer female 31 1 1 C.A. 31921 26.25 S
641 1 1 Carter male 11 1 2 113760 120 B96 B98 S
642 1 3 Thomas male 0.42 0 1 2625 8.5167 C
643 1 3 Hedman male 27 0 0 347089 6.975 S
644 0 3 Johansson male 31 0 0 347063 7.775 S
645 0 1 Andrews male 39 0 0 112050 0 A36 S
646 0 3 Pettersson female 18 0 0 347087 7.775 S
647 0 2 Meyer male 39 0 0 248723 13 S
648 1 1 Chambers female 33 1 0 113806 53.1 E8 S
649 0 3 Alexander male 26 0 0 3474 7.8875 S
650 0 3 Lester male 39 0 0 A/4 48871 24.15 S
651 0 2 Slemen male 35 0 0 28206 10.5 S
652 0 3 Andersson female 6 4 2 347082 31.275 S
653 0 3 Tomlin male 30.5 0 0 364499 8.05 S
654 0 3 Heininen female 23 0 0 STON/O2. 3101290 7.925 S
655 0 2 Mallet male 31 1 1 S.C./PARIS 2079 37.0042 C
656 0 3 Holm male 43 0 0 C 7075 6.45 S
657 0 3 Skoog male 10 3 2 347088 27.9 S
658 1 1 Hays female 52 1 1 12749 93.5 B69 S
659 1 3 Lulic male 27 0 0 315098 8.6625 S
660 0 1 Reuchlin male 38 0 0 19972 0 S
661 1 3 Moor female 27 0 1 392096 12.475 E121 S
662 0 3 Panula male 2 4 1 3101295 39.6875 S
663 1 2 Mallet male 1 0 2 S.C./PARIS 2079 37.0042 C
664 1 1 Stone female 62 0 0 113572 80 B28
665 1 3 Yasbeck female 15 1 0 2659 14.4542 C
666 1 2 Richards male 0.83 1 1 29106 18.75 S
667 0 3 Augustsson male 23 0 0 347468 7.8542 S
668 0 3 Allum male 18 0 0 2223 8.3 S
669 1 1 Compton female 39 1 1 PC 17756 83.1583 E49 C
670 0 3 Pasic male 21 0 0 315097 8.6625 S
671 1 3 Chip male 32 0 0 1601 56.4958 S
672 0 3 Alhomaki male 20 0 0 SOTON/O2 3101287 7.925 S
673 0 2 Mudd male 16 0 0 S.O./P.P. 3 10.5 S
674 1 1 Serepeca female 30 0 0 113798 31 C
675 0 3 Lemberopolous male 34.5 0 0 2683 6.4375 C
676 0 3 Culumovic male 17 0 0 315090 8.6625 S
677 0 3 Abbing male 42 0 0 C.A. 5547 7.55 S
678 0 3 Markoff male 35 0 0 349213 7.8958 C
679 0 2 Harper male 28 0 1 248727 33 S
680 0 3 Andersson male 4 4 2 347082 31.275 S
681 0 3 Svensson male 74 0 0 347060 7.775 S
682 0 3 Boulos female 9 1 1 2678 15.2458 C
683 1 1 Lines female 16 0 1 PC 17592 39.4 D28 S
684 0 2 Carter female 44 1 0 244252 26 S
685 1 3 Aks female 18 0 1 392091 9.35 S
686 1 1 Wick female 45 1 1 36928 164.8667 S
687 1 1 Daly male 51 0 0 113055 26.55 E17 S
688 1 3 Baclini female 24 0 3 2666 19.2583 C
689 0 3 Hansen male 41 2 0 350026 14.1083 S
690 0 2 Giles male 21 1 0 28134 11.5 S
691 1 1 Swift female 48 0 0 17466 25.9292 D17 S
692 0 2 Gill male 24 0 0 233866 13 S
693 1 2 Bystrom female 42 0 0 236852 13 S
694 1 2 Duran female 27 1 0 SC/PARIS 2149 13.8583 C
695 0 1 Roebling male 31 0 0 PC 17590 50.4958 A24 S
696 1 3 Johnson male 4 1 1 347742 11.1333 S
697 0 3 Balkic male 26 0 0 349248 7.8958 S
698 1 1 Beckwith female 47 1 1 11751 52.5542 D35 S
699 0 1 Carlsson male 33 0 0 695 5 B51 B53 B55 S
700 0 3 Vander male 47 0 0 345765 9 S
701 1 2 Abelson female 28 1 0 P/PP 3381 24 C
702 1 3 Najib female 15 0 0 2667 7.225 C
703 0 3 Gustafsson male 20 0 0 7534 9.8458 S
704 0 3 Petroff male 19 0 0 349212 7.8958 S
705 1 1 Potter female 56 0 1 11767 83.1583 C50 C
706 1 2 Shelley female 25 0 1 230433 26 S
707 0 3 Markun male 33 0 0 349257 7.8958 S
708 0 3 Dahlberg female 22 0 0 7552 10.5167 S
709 0 2 Banfield male 28 0 0 C.A./SOTON 34068 10.5 S
710 0 3 Sutehall male 25 0 0 SOTON/OQ 392076 7.05 S
711 0 3 Rice female 39 0 5 382652 29.125 Q
712 0 2 Montvila male 27 0 0 211536 13 S
713 1 1 Graham female 19 0 0 112053 30 B42 S
714 1 1 Behr male 26 0 0 111369 30 C148 C
715 0 3 Dooley male 32 0 0 370376 7.75 Q
-24
View File
@@ -1,24 +0,0 @@
import { SimpleDirectoryReader } from "llamaindex";
function callback(
category: string,
name: string,
status: any,
message?: string,
): boolean {
console.log(category, name, status, message);
if (name.endsWith(".pdf")) {
console.log("I DON'T WANT PDF FILES!");
return false;
}
return true;
}
async function main() {
// Load page
const reader = new SimpleDirectoryReader(callback);
const params = { directoryPath: "./data" };
await reader.loadData(params);
}
main().catch(console.error);
-353
View File
@@ -1,353 +0,0 @@
const essay = `What I Worked On
February 2021
Before college the two main things I worked on, outside of school, were writing and programming. I didn't write essays. I wrote what beginning writers were supposed to write then, and probably still are: short stories. My stories were awful. They had hardly any plot, just characters with strong feelings, which I imagined made them deep.
The first programs I tried writing were on the IBM 1401 that our school district used for what was then called "data processing." This was in 9th grade, so I was 13 or 14. The school district's 1401 happened to be in the basement of our junior high school, and my friend Rich Draves and I got permission to use it. It was like a mini Bond villain's lair down there, with all these alien-looking machines — CPU, disk drives, printer, card reader — sitting up on a raised floor under bright fluorescent lights.
The language we used was an early version of Fortran. You had to type programs on punch cards, then stack them in the card reader and press a button to load the program into memory and run it. The result would ordinarily be to print something on the spectacularly loud printer.
I was puzzled by the 1401. I couldn't figure out what to do with it. And in retrospect there's not much I could have done with it. The only form of input to programs was data stored on punched cards, and I didn't have any data stored on punched cards. The only other option was to do things that didn't rely on any input, like calculate approximations of pi, but I didn't know enough math to do anything interesting of that type. So I'm not surprised I can't remember any programs I wrote, because they can't have done much. My clearest memory is of the moment I learned it was possible for programs not to terminate, when one of mine didn't. On a machine without time-sharing, this was a social as well as a technical error, as the data center manager's expression made clear.
With microcomputers, everything changed. Now you could have a computer sitting right in front of you, on a desk, that could respond to your keystrokes as it was running instead of just churning through a stack of punch cards and then stopping. [1]
The first of my friends to get a microcomputer built it himself. It was sold as a kit by Heathkit. I remember vividly how impressed and envious I felt watching him sitting in front of it, typing programs right into the computer.
Computers were expensive in those days and it took me years of nagging before I convinced my father to buy one, a TRS-80, in about 1980. The gold standard then was the Apple II, but a TRS-80 was good enough. This was when I really started programming. I wrote simple games, a program to predict how high my model rockets would fly, and a word processor that my father used to write at least one book. There was only room in memory for about 2 pages of text, so he'd write 2 pages at a time and then print them out, but it was a lot better than a typewriter.
Though I liked programming, I didn't plan to study it in college. In college I was going to study philosophy, which sounded much more powerful. It seemed, to my naive high school self, to be the study of the ultimate truths, compared to which the things studied in other fields would be mere domain knowledge. What I discovered when I got to college was that the other fields took up so much of the space of ideas that there wasn't much left for these supposed ultimate truths. All that seemed left for philosophy were edge cases that people in other fields felt could safely be ignored.
I couldn't have put this into words when I was 18. All I knew at the time was that I kept taking philosophy courses and they kept being boring. So I decided to switch to AI.
AI was in the air in the mid 1980s, but there were two things especially that made me want to work on it: a novel by Heinlein called The Moon is a Harsh Mistress, which featured an intelligent computer called Mike, and a PBS documentary that showed Terry Winograd using SHRDLU. I haven't tried rereading The Moon is a Harsh Mistress, so I don't know how well it has aged, but when I read it I was drawn entirely into its world. It seemed only a matter of time before we'd have Mike, and when I saw Winograd using SHRDLU, it seemed like that time would be a few years at most. All you had to do was teach SHRDLU more words.
There weren't any classes in AI at Cornell then, not even graduate classes, so I started trying to teach myself. Which meant learning Lisp, since in those days Lisp was regarded as the language of AI. The commonly used programming languages then were pretty primitive, and programmers' ideas correspondingly so. The default language at Cornell was a Pascal-like language called PL/I, and the situation was similar elsewhere. Learning Lisp expanded my concept of a program so fast that it was years before I started to have a sense of where the new limits were. This was more like it; this was what I had expected college to do. It wasn't happening in a class, like it was supposed to, but that was ok. For the next couple years I was on a roll. I knew what I was going to do.
For my undergraduate thesis, I reverse-engineered SHRDLU. My God did I love working on that program. It was a pleasing bit of code, but what made it even more exciting was my belief — hard to imagine now, but not unique in 1985 — that it was already climbing the lower slopes of intelligence.
I had gotten into a program at Cornell that didn't make you choose a major. You could take whatever classes you liked, and choose whatever you liked to put on your degree. I of course chose "Artificial Intelligence." When I got the actual physical diploma, I was dismayed to find that the quotes had been included, which made them read as scare-quotes. At the time this bothered me, but now it seems amusingly accurate, for reasons I was about to discover.
I applied to 3 grad schools: MIT and Yale, which were renowned for AI at the time, and Harvard, which I'd visited because Rich Draves went there, and was also home to Bill Woods, who'd invented the type of parser I used in my SHRDLU clone. Only Harvard accepted me, so that was where I went.
I don't remember the moment it happened, or if there even was a specific moment, but during the first year of grad school I realized that AI, as practiced at the time, was a hoax. By which I mean the sort of AI in which a program that's told "the dog is sitting on the chair" translates this into some formal representation and adds it to the list of things it knows.
What these programs really showed was that there's a subset of natural language that's a formal language. But a very proper subset. It was clear that there was an unbridgeable gap between what they could do and actually understanding natural language. It was not, in fact, simply a matter of teaching SHRDLU more words. That whole way of doing AI, with explicit data structures representing concepts, was not going to work. Its brokenness did, as so often happens, generate a lot of opportunities to write papers about various band-aids that could be applied to it, but it was never going to get us Mike.
So I looked around to see what I could salvage from the wreckage of my plans, and there was Lisp. I knew from experience that Lisp was interesting for its own sake and not just for its association with AI, even though that was the main reason people cared about it at the time. So I decided to focus on Lisp. In fact, I decided to write a book about Lisp hacking. It's scary to think how little I knew about Lisp hacking when I started writing that book. But there's nothing like writing a book about something to help you learn it. The book, On Lisp, wasn't published till 1993, but I wrote much of it in grad school.
Computer Science is an uneasy alliance between two halves, theory and systems. The theory people prove things, and the systems people build things. I wanted to build things. I had plenty of respect for theory — indeed, a sneaking suspicion that it was the more admirable of the two halves — but building things seemed so much more exciting.
The problem with systems work, though, was that it didn't last. Any program you wrote today, no matter how good, would be obsolete in a couple decades at best. People might mention your software in footnotes, but no one would actually use it. And indeed, it would seem very feeble work. Only people with a sense of the history of the field would even realize that, in its time, it had been good.
There were some surplus Xerox Dandelions floating around the computer lab at one point. Anyone who wanted one to play around with could have one. I was briefly tempted, but they were so slow by present standards; what was the point? No one else wanted one either, so off they went. That was what happened to systems work.
I wanted not just to build things, but to build things that would last.
In this dissatisfied state I went in 1988 to visit Rich Draves at CMU, where he was in grad school. One day I went to visit the Carnegie Institute, where I'd spent a lot of time as a kid. While looking at a painting there I realized something that might seem obvious, but was a big surprise to me. There, right on the wall, was something you could make that would last. Paintings didn't become obsolete. Some of the best ones were hundreds of years old.
And moreover this was something you could make a living doing. Not as easily as you could by writing software, of course, but I thought if you were really industrious and lived really cheaply, it had to be possible to make enough to survive. And as an artist you could be truly independent. You wouldn't have a boss, or even need to get research funding.
I had always liked looking at paintings. Could I make them? I had no idea. I'd never imagined it was even possible. I knew intellectually that people made art — that it didn't just appear spontaneously — but it was as if the people who made it were a different species. They either lived long ago or were mysterious geniuses doing strange things in profiles in Life magazine. The idea of actually being able to make art, to put that verb before that noun, seemed almost miraculous.
That fall I started taking art classes at Harvard. Grad students could take classes in any department, and my advisor, Tom Cheatham, was very easy going. If he even knew about the strange classes I was taking, he never said anything.
So now I was in a PhD program in computer science, yet planning to be an artist, yet also genuinely in love with Lisp hacking and working away at On Lisp. In other words, like many a grad student, I was working energetically on multiple projects that were not my thesis.
I didn't see a way out of this situation. I didn't want to drop out of grad school, but how else was I going to get out? I remember when my friend Robert Morris got kicked out of Cornell for writing the internet worm of 1988, I was envious that he'd found such a spectacular way to get out of grad school.
Then one day in April 1990 a crack appeared in the wall. I ran into professor Cheatham and he asked if I was far enough along to graduate that June. I didn't have a word of my dissertation written, but in what must have been the quickest bit of thinking in my life, I decided to take a shot at writing one in the 5 weeks or so that remained before the deadline, reusing parts of On Lisp where I could, and I was able to respond, with no perceptible delay "Yes, I think so. I'll give you something to read in a few days."
I picked applications of continuations as the topic. In retrospect I should have written about macros and embedded languages. There's a whole world there that's barely been explored. But all I wanted was to get out of grad school, and my rapidly written dissertation sufficed, just barely.
Meanwhile I was applying to art schools. I applied to two: RISD in the US, and the Accademia di Belli Arti in Florence, which, because it was the oldest art school, I imagined would be good. RISD accepted me, and I never heard back from the Accademia, so off to Providence I went.
I'd applied for the BFA program at RISD, which meant in effect that I had to go to college again. This was not as strange as it sounds, because I was only 25, and art schools are full of people of different ages. RISD counted me as a transfer sophomore and said I had to do the foundation that summer. The foundation means the classes that everyone has to take in fundamental subjects like drawing, color, and design.
Toward the end of the summer I got a big surprise: a letter from the Accademia, which had been delayed because they'd sent it to Cambridge England instead of Cambridge Massachusetts, inviting me to take the entrance exam in Florence that fall. This was now only weeks away. My nice landlady let me leave my stuff in her attic. I had some money saved from consulting work I'd done in grad school; there was probably enough to last a year if I lived cheaply. Now all I had to do was learn Italian.
Only stranieri (foreigners) had to take this entrance exam. In retrospect it may well have been a way of excluding them, because there were so many stranieri attracted by the idea of studying art in Florence that the Italian students would otherwise have been outnumbered. I was in decent shape at painting and drawing from the RISD foundation that summer, but I still don't know how I managed to pass the written exam. I remember that I answered the essay question by writing about Cezanne, and that I cranked up the intellectual level as high as I could to make the most of my limited vocabulary. [2]
I'm only up to age 25 and already there are such conspicuous patterns. Here I was, yet again about to attend some august institution in the hopes of learning about some prestigious subject, and yet again about to be disappointed. The students and faculty in the painting department at the Accademia were the nicest people you could imagine, but they had long since arrived at an arrangement whereby the students wouldn't require the faculty to teach anything, and in return the faculty wouldn't require the students to learn anything. And at the same time all involved would adhere outwardly to the conventions of a 19th century atelier. We actually had one of those little stoves, fed with kindling, that you see in 19th century studio paintings, and a nude model sitting as close to it as possible without getting burned. Except hardly anyone else painted her besides me. The rest of the students spent their time chatting or occasionally trying to imitate things they'd seen in American art magazines.
Our model turned out to live just down the street from me. She made a living from a combination of modelling and making fakes for a local antique dealer. She'd copy an obscure old painting out of a book, and then he'd take the copy and maltreat it to make it look old. [3]
While I was a student at the Accademia I started painting still lives in my bedroom at night. These paintings were tiny, because the room was, and because I painted them on leftover scraps of canvas, which was all I could afford at the time. Painting still lives is different from painting people, because the subject, as its name suggests, can't move. People can't sit for more than about 15 minutes at a time, and when they do they don't sit very still. So the traditional m.o. for painting people is to know how to paint a generic person, which you then modify to match the specific person you're painting. Whereas a still life you can, if you want, copy pixel by pixel from what you're seeing. You don't want to stop there, of course, or you get merely photographic accuracy, and what makes a still life interesting is that it's been through a head. You want to emphasize the visual cues that tell you, for example, that the reason the color changes suddenly at a certain point is that it's the edge of an object. By subtly emphasizing such things you can make paintings that are more realistic than photographs not just in some metaphorical sense, but in the strict information-theoretic sense. [4]
I liked painting still lives because I was curious about what I was seeing. In everyday life, we aren't consciously aware of much we're seeing. Most visual perception is handled by low-level processes that merely tell your brain "that's a water droplet" without telling you details like where the lightest and darkest points are, or "that's a bush" without telling you the shape and position of every leaf. This is a feature of brains, not a bug. In everyday life it would be distracting to notice every leaf on every bush. But when you have to paint something, you have to look more closely, and when you do there's a lot to see. You can still be noticing new things after days of trying to paint something people usually take for granted, just as you can after days of trying to write an essay about something people usually take for granted.
This is not the only way to paint. I'm not 100% sure it's even a good way to paint. But it seemed a good enough bet to be worth trying.
Our teacher, professor Ulivi, was a nice guy. He could see I worked hard, and gave me a good grade, which he wrote down in a sort of passport each student had. But the Accademia wasn't teaching me anything except Italian, and my money was running out, so at the end of the first year I went back to the US.
I wanted to go back to RISD, but I was now broke and RISD was very expensive, so I decided to get a job for a year and then return to RISD the next fall. I got one at a company called Interleaf, which made software for creating documents. You mean like Microsoft Word? Exactly. That was how I learned that low end software tends to eat high end software. But Interleaf still had a few years to live yet. [5]
Interleaf had done something pretty bold. Inspired by Emacs, they'd added a scripting language, and even made the scripting language a dialect of Lisp. Now they wanted a Lisp hacker to write things in it. This was the closest thing I've had to a normal job, and I hereby apologize to my boss and coworkers, because I was a bad employee. Their Lisp was the thinnest icing on a giant C cake, and since I didn't know C and didn't want to learn it, I never understood most of the software. Plus I was terribly irresponsible. This was back when a programming job meant showing up every day during certain working hours. That seemed unnatural to me, and on this point the rest of the world is coming around to my way of thinking, but at the time it caused a lot of friction. Toward the end of the year I spent much of my time surreptitiously working on On Lisp, which I had by this time gotten a contract to publish.
The good part was that I got paid huge amounts of money, especially by art student standards. In Florence, after paying my part of the rent, my budget for everything else had been $7 a day. Now I was getting paid more than 4 times that every hour, even when I was just sitting in a meeting. By living cheaply I not only managed to save enough to go back to RISD, but also paid off my college loans.
I learned some useful things at Interleaf, though they were mostly about what not to do. I learned that it's better for technology companies to be run by product people than sales people (though sales is a real skill and people who are good at it are really good at it), that it leads to bugs when code is edited by too many people, that cheap office space is no bargain if it's depressing, that planned meetings are inferior to corridor conversations, that big, bureaucratic customers are a dangerous source of money, and that there's not much overlap between conventional office hours and the optimal time for hacking, or conventional offices and the optimal place for it.
But the most important thing I learned, and which I used in both Viaweb and Y Combinator, is that the low end eats the high end: that it's good to be the "entry level" option, even though that will be less prestigious, because if you're not, someone else will be, and will squash you against the ceiling. Which in turn means that prestige is a danger sign.
When I left to go back to RISD the next fall, I arranged to do freelance work for the group that did projects for customers, and this was how I survived for the next several years. When I came back to visit for a project later on, someone told me about a new thing called HTML, which was, as he described it, a derivative of SGML. Markup language enthusiasts were an occupational hazard at Interleaf and I ignored him, but this HTML thing later became a big part of my life.
In the fall of 1992 I moved back to Providence to continue at RISD. The foundation had merely been intro stuff, and the Accademia had been a (very civilized) joke. Now I was going to see what real art school was like. But alas it was more like the Accademia than not. Better organized, certainly, and a lot more expensive, but it was now becoming clear that art school did not bear the same relationship to art that medical school bore to medicine. At least not the painting department. The textile department, which my next door neighbor belonged to, seemed to be pretty rigorous. No doubt illustration and architecture were too. But painting was post-rigorous. Painting students were supposed to express themselves, which to the more worldly ones meant to try to cook up some sort of distinctive signature style.
A signature style is the visual equivalent of what in show business is known as a "schtick": something that immediately identifies the work as yours and no one else's. For example, when you see a painting that looks like a certain kind of cartoon, you know it's by Roy Lichtenstein. So if you see a big painting of this type hanging in the apartment of a hedge fund manager, you know he paid millions of dollars for it. That's not always why artists have a signature style, but it's usually why buyers pay a lot for such work. [6]
There were plenty of earnest students too: kids who "could draw" in high school, and now had come to what was supposed to be the best art school in the country, to learn to draw even better. They tended to be confused and demoralized by what they found at RISD, but they kept going, because painting was what they did. I was not one of the kids who could draw in high school, but at RISD I was definitely closer to their tribe than the tribe of signature style seekers.
I learned a lot in the color class I took at RISD, but otherwise I was basically teaching myself to paint, and I could do that for free. So in 1993 I dropped out. I hung around Providence for a bit, and then my college friend Nancy Parmet did me a big favor. A rent-controlled apartment in a building her mother owned in New York was becoming vacant. Did I want it? It wasn't much more than my current place, and New York was supposed to be where the artists were. So yes, I wanted it! [7]
Asterix comics begin by zooming in on a tiny corner of Roman Gaul that turns out not to be controlled by the Romans. You can do something similar on a map of New York City: if you zoom in on the Upper East Side, there's a tiny corner that's not rich, or at least wasn't in 1993. It's called Yorkville, and that was my new home. Now I was a New York artist — in the strictly technical sense of making paintings and living in New York.
I was nervous about money, because I could sense that Interleaf was on the way down. Freelance Lisp hacking work was very rare, and I didn't want to have to program in another language, which in those days would have meant C++ if I was lucky. So with my unerring nose for financial opportunity, I decided to write another book on Lisp. This would be a popular book, the sort of book that could be used as a textbook. I imagined myself living frugally off the royalties and spending all my time painting. (The painting on the cover of this book, ANSI Common Lisp, is one that I painted around this time.)
The best thing about New York for me was the presence of Idelle and Julian Weber. Idelle Weber was a painter, one of the early photorealists, and I'd taken her painting class at Harvard. I've never known a teacher more beloved by her students. Large numbers of former students kept in touch with her, including me. After I moved to New York I became her de facto studio assistant.
She liked to paint on big, square canvases, 4 to 5 feet on a side. One day in late 1994 as I was stretching one of these monsters there was something on the radio about a famous fund manager. He wasn't that much older than me, and was super rich. The thought suddenly occurred to me: why don't I become rich? Then I'll be able to work on whatever I want.
Meanwhile I'd been hearing more and more about this new thing called the World Wide Web. Robert Morris showed it to me when I visited him in Cambridge, where he was now in grad school at Harvard. It seemed to me that the web would be a big deal. I'd seen what graphical user interfaces had done for the popularity of microcomputers. It seemed like the web would do the same for the internet.
If I wanted to get rich, here was the next train leaving the station. I was right about that part. What I got wrong was the idea. I decided we should start a company to put art galleries online. I can't honestly say, after reading so many Y Combinator applications, that this was the worst startup idea ever, but it was up there. Art galleries didn't want to be online, and still don't, not the fancy ones. That's not how they sell. I wrote some software to generate web sites for galleries, and Robert wrote some to resize images and set up an http server to serve the pages. Then we tried to sign up galleries. To call this a difficult sale would be an understatement. It was difficult to give away. A few galleries let us make sites for them for free, but none paid us.
Then some online stores started to appear, and I realized that except for the order buttons they were identical to the sites we'd been generating for galleries. This impressive-sounding thing called an "internet storefront" was something we already knew how to build.
So in the summer of 1995, after I submitted the camera-ready copy of ANSI Common Lisp to the publishers, we started trying to write software to build online stores. At first this was going to be normal desktop software, which in those days meant Windows software. That was an alarming prospect, because neither of us knew how to write Windows software or wanted to learn. We lived in the Unix world. But we decided we'd at least try writing a prototype store builder on Unix. Robert wrote a shopping cart, and I wrote a new site generator for stores — in Lisp, of course.
We were working out of Robert's apartment in Cambridge. His roommate was away for big chunks of time, during which I got to sleep in his room. For some reason there was no bed frame or sheets, just a mattress on the floor. One morning as I was lying on this mattress I had an idea that made me sit up like a capital L. What if we ran the software on the server, and let users control it by clicking on links? Then we'd never have to write anything to run on users' computers. We could generate the sites on the same server we'd serve them from. Users wouldn't need anything more than a browser.
This kind of software, known as a web app, is common now, but at the time it wasn't clear that it was even possible. To find out, we decided to try making a version of our store builder that you could control through the browser. A couple days later, on August 12, we had one that worked. The UI was horrible, but it proved you could build a whole store through the browser, without any client software or typing anything into the command line on the server.
Now we felt like we were really onto something. I had visions of a whole new generation of software working this way. You wouldn't need versions, or ports, or any of that crap. At Interleaf there had been a whole group called Release Engineering that seemed to be at least as big as the group that actually wrote the software. Now you could just update the software right on the server.
We started a new company we called Viaweb, after the fact that our software worked via the web, and we got $10,000 in seed funding from Idelle's husband Julian. In return for that and doing the initial legal work and giving us business advice, we gave him 10% of the company. Ten years later this deal became the model for Y Combinator's. We knew founders needed something like this, because we'd needed it ourselves.
At this stage I had a negative net worth, because the thousand dollars or so I had in the bank was more than counterbalanced by what I owed the government in taxes. (Had I diligently set aside the proper proportion of the money I'd made consulting for Interleaf? No, I had not.) So although Robert had his graduate student stipend, I needed that seed funding to live on.
We originally hoped to launch in September, but we got more ambitious about the software as we worked on it. Eventually we managed to build a WYSIWYG site builder, in the sense that as you were creating pages, they looked exactly like the static ones that would be generated later, except that instead of leading to static pages, the links all referred to closures stored in a hash table on the server.
It helped to have studied art, because the main goal of an online store builder is to make users look legit, and the key to looking legit is high production values. If you get page layouts and fonts and colors right, you can make a guy running a store out of his bedroom look more legit than a big company.
(If you're curious why my site looks so old-fashioned, it's because it's still made with this software. It may look clunky today, but in 1996 it was the last word in slick.)
In September, Robert rebelled. "We've been working on this for a month," he said, "and it's still not done." This is funny in retrospect, because he would still be working on it almost 3 years later. But I decided it might be prudent to recruit more programmers, and I asked Robert who else in grad school with him was really good. He recommended Trevor Blackwell, which surprised me at first, because at that point I knew Trevor mainly for his plan to reduce everything in his life to a stack of notecards, which he carried around with him. But Rtm was right, as usual. Trevor turned out to be a frighteningly effective hacker.
It was a lot of fun working with Robert and Trevor. They're the two most independent-minded people I know, and in completely different ways. If you could see inside Rtm's brain it would look like a colonial New England church, and if you could see inside Trevor's it would look like the worst excesses of Austrian Rococo.
We opened for business, with 6 stores, in January 1996. It was just as well we waited a few months, because although we worried we were late, we were actually almost fatally early. There was a lot of talk in the press then about ecommerce, but not many people actually wanted online stores. [8]
There were three main parts to the software: the editor, which people used to build sites and which I wrote, the shopping cart, which Robert wrote, and the manager, which kept track of orders and statistics, and which Trevor wrote. In its time, the editor was one of the best general-purpose site builders. I kept the code tight and didn't have to integrate with any other software except Robert's and Trevor's, so it was quite fun to work on. If all I'd had to do was work on this software, the next 3 years would have been the easiest of my life. Unfortunately I had to do a lot more, all of it stuff I was worse at than programming, and the next 3 years were instead the most stressful.
There were a lot of startups making ecommerce software in the second half of the 90s. We were determined to be the Microsoft Word, not the Interleaf. Which meant being easy to use and inexpensive. It was lucky for us that we were poor, because that caused us to make Viaweb even more inexpensive than we realized. We charged $100 a month for a small store and $300 a month for a big one. This low price was a big attraction, and a constant thorn in the sides of competitors, but it wasn't because of some clever insight that we set the price low. We had no idea what businesses paid for things. $300 a month seemed like a lot of money to us.
We did a lot of things right by accident like that. For example, we did what's now called "doing things that don't scale," although at the time we would have described it as "being so lame that we're driven to the most desperate measures to get users." The most common of which was building stores for them. This seemed particularly humiliating, since the whole raison d'etre of our software was that people could use it to make their own stores. But anything to get users.
We learned a lot more about retail than we wanted to know. For example, that if you could only have a small image of a man's shirt (and all images were small then by present standards), it was better to have a closeup of the collar than a picture of the whole shirt. The reason I remember learning this was that it meant I had to rescan about 30 images of men's shirts. My first set of scans were so beautiful too.
Though this felt wrong, it was exactly the right thing to be doing. Building stores for users taught us about retail, and about how it felt to use our software. I was initially both mystified and repelled by "business" and thought we needed a "business person" to be in charge of it, but once we started to get users, I was converted, in much the same way I was converted to fatherhood once I had kids. Whatever users wanted, I was all theirs. Maybe one day we'd have so many users that I couldn't scan their images for them, but in the meantime there was nothing more important to do.
Another thing I didn't get at the time is that growth rate is the ultimate test of a startup. Our growth rate was fine. We had about 70 stores at the end of 1996 and about 500 at the end of 1997. I mistakenly thought the thing that mattered was the absolute number of users. And that is the thing that matters in the sense that that's how much money you're making, and if you're not making enough, you might go out of business. But in the long term the growth rate takes care of the absolute number. If we'd been a startup I was advising at Y Combinator, I would have said: Stop being so stressed out, because you're doing fine. You're growing 7x a year. Just don't hire too many more people and you'll soon be profitable, and then you'll control your own destiny.
Alas I hired lots more people, partly because our investors wanted me to, and partly because that's what startups did during the Internet Bubble. A company with just a handful of employees would have seemed amateurish. So we didn't reach breakeven until about when Yahoo bought us in the summer of 1998. Which in turn meant we were at the mercy of investors for the entire life of the company. And since both we and our investors were noobs at startups, the result was a mess even by startup standards.
It was a huge relief when Yahoo bought us. In principle our Viaweb stock was valuable. It was a share in a business that was profitable and growing rapidly. But it didn't feel very valuable to me; I had no idea how to value a business, but I was all too keenly aware of the near-death experiences we seemed to have every few months. Nor had I changed my grad student lifestyle significantly since we started. So when Yahoo bought us it felt like going from rags to riches. Since we were going to California, I bought a car, a yellow 1998 VW GTI. I remember thinking that its leather seats alone were by far the most luxurious thing I owned.
The next year, from the summer of 1998 to the summer of 1999, must have been the least productive of my life. I didn't realize it at the time, but I was worn out from the effort and stress of running Viaweb. For a while after I got to California I tried to continue my usual m.o. of programming till 3 in the morning, but fatigue combined with Yahoo's prematurely aged culture and grim cube farm in Santa Clara gradually dragged me down. After a few months it felt disconcertingly like working at Interleaf.
Yahoo had given us a lot of options when they bought us. At the time I thought Yahoo was so overvalued that they'd never be worth anything, but to my astonishment the stock went up 5x in the next year. I hung on till the first chunk of options vested, then in the summer of 1999 I left. It had been so long since I'd painted anything that I'd half forgotten why I was doing this. My brain had been entirely full of software and men's shirts for 4 years. But I had done this to get rich so I could paint, I reminded myself, and now I was rich, so I should go paint.
When I said I was leaving, my boss at Yahoo had a long conversation with me about my plans. I told him all about the kinds of pictures I wanted to paint. At the time I was touched that he took such an interest in me. Now I realize it was because he thought I was lying. My options at that point were worth about $2 million a month. If I was leaving that kind of money on the table, it could only be to go and start some new startup, and if I did, I might take people with me. This was the height of the Internet Bubble, and Yahoo was ground zero of it. My boss was at that moment a billionaire. Leaving then to start a new startup must have seemed to him an insanely, and yet also plausibly, ambitious plan.
But I really was quitting to paint, and I started immediately. There was no time to lose. I'd already burned 4 years getting rich. Now when I talk to founders who are leaving after selling their companies, my advice is always the same: take a vacation. That's what I should have done, just gone off somewhere and done nothing for a month or two, but the idea never occurred to me.
So I tried to paint, but I just didn't seem to have any energy or ambition. Part of the problem was that I didn't know many people in California. I'd compounded this problem by buying a house up in the Santa Cruz Mountains, with a beautiful view but miles from anywhere. I stuck it out for a few more months, then in desperation I went back to New York, where unless you understand about rent control you'll be surprised to hear I still had my apartment, sealed up like a tomb of my old life. Idelle was in New York at least, and there were other people trying to paint there, even though I didn't know any of them.
When I got back to New York I resumed my old life, except now I was rich. It was as weird as it sounds. I resumed all my old patterns, except now there were doors where there hadn't been. Now when I was tired of walking, all I had to do was raise my hand, and (unless it was raining) a taxi would stop to pick me up. Now when I walked past charming little restaurants I could go in and order lunch. It was exciting for a while. Painting started to go better. I experimented with a new kind of still life where I'd paint one painting in the old way, then photograph it and print it, blown up, on canvas, and then use that as the underpainting for a second still life, painted from the same objects (which hopefully hadn't rotted yet).
Meanwhile I looked for an apartment to buy. Now I could actually choose what neighborhood to live in. Where, I asked myself and various real estate agents, is the Cambridge of New York? Aided by occasional visits to actual Cambridge, I gradually realized there wasn't one. Huh.
Around this time, in the spring of 2000, I had an idea. It was clear from our experience with Viaweb that web apps were the future. Why not build a web app for making web apps? Why not let people edit code on our server through the browser, and then host the resulting applications for them? [9] You could run all sorts of services on the servers that these applications could use just by making an API call: making and receiving phone calls, manipulating images, taking credit card payments, etc.
I got so excited about this idea that I couldn't think about anything else. It seemed obvious that this was the future. I didn't particularly want to start another company, but it was clear that this idea would have to be embodied as one, so I decided to move to Cambridge and start it. I hoped to lure Robert into working on it with me, but there I ran into a hitch. Robert was now a postdoc at MIT, and though he'd made a lot of money the last time I'd lured him into working on one of my schemes, it had also been a huge time sink. So while he agreed that it sounded like a plausible idea, he firmly refused to work on it.
Hmph. Well, I'd do it myself then. I recruited Dan Giffin, who had worked for Viaweb, and two undergrads who wanted summer jobs, and we got to work trying to build what it's now clear is about twenty companies and several open source projects worth of software. The language for defining applications would of course be a dialect of Lisp. But I wasn't so naive as to assume I could spring an overt Lisp on a general audience; we'd hide the parentheses, like Dylan did.
By then there was a name for the kind of company Viaweb was, an "application service provider," or ASP. This name didn't last long before it was replaced by "software as a service," but it was current for long enough that I named this new company after it: it was going to be called Aspra.
I started working on the application builder, Dan worked on network infrastructure, and the two undergrads worked on the first two services (images and phone calls). But about halfway through the summer I realized I really didn't want to run a company — especially not a big one, which it was looking like this would have to be. I'd only started Viaweb because I needed the money. Now that I didn't need money anymore, why was I doing this? If this vision had to be realized as a company, then screw the vision. I'd build a subset that could be done as an open source project.
Much to my surprise, the time I spent working on this stuff was not wasted after all. After we started Y Combinator, I would often encounter startups working on parts of this new architecture, and it was very useful to have spent so much time thinking about it and even trying to write some of it.
The subset I would build as an open source project was the new Lisp, whose parentheses I now wouldn't even have to hide. A lot of Lisp hackers dream of building a new Lisp, partly because one of the distinctive features of the language is that it has dialects, and partly, I think, because we have in our minds a Platonic form of Lisp that all existing dialects fall short of. I certainly did. So at the end of the summer Dan and I switched to working on this new dialect of Lisp, which I called Arc, in a house I bought in Cambridge.
The following spring, lightning struck. I was invited to give a talk at a Lisp conference, so I gave one about how we'd used Lisp at Viaweb. Afterward I put a postscript file of this talk online, on paulgraham.com, which I'd created years before using Viaweb but had never used for anything. In one day it got 30,000 page views. What on earth had happened? The referring urls showed that someone had posted it on Slashdot. [10]
Wow, I thought, there's an audience. If I write something and put it on the web, anyone can read it. That may seem obvious now, but it was surprising then. In the print era there was a narrow channel to readers, guarded by fierce monsters known as editors. The only way to get an audience for anything you wrote was to get it published as a book, or in a newspaper or magazine. Now anyone could publish anything.
This had been possible in principle since 1993, but not many people had realized it yet. I had been intimately involved with building the infrastructure of the web for most of that time, and a writer as well, and it had taken me 8 years to realize it. Even then it took me several years to understand the implications. It meant there would be a whole new generation of essays. [11]
In the print era, the channel for publishing essays had been vanishingly small. Except for a few officially anointed thinkers who went to the right parties in New York, the only people allowed to publish essays were specialists writing about their specialties. There were so many essays that had never been written, because there had been no way to publish them. Now they could be, and I was going to write them. [12]
I've worked on several different things, but to the extent there was a turning point where I figured out what to work on, it was when I started publishing essays online. From then on I knew that whatever else I did, I'd always write essays too.
I knew that online essays would be a marginal medium at first. Socially they'd seem more like rants posted by nutjobs on their GeoCities sites than the genteel and beautifully typeset compositions published in The New Yorker. But by this point I knew enough to find that encouraging instead of discouraging.
One of the most conspicuous patterns I've noticed in my life is how well it has worked, for me at least, to work on things that weren't prestigious. Still life has always been the least prestigious form of painting. Viaweb and Y Combinator both seemed lame when we started them. I still get the glassy eye from strangers when they ask what I'm writing, and I explain that it's an essay I'm going to publish on my web site. Even Lisp, though prestigious intellectually in something like the way Latin is, also seems about as hip.
It's not that unprestigious types of work are good per se. But when you find yourself drawn to some kind of work despite its current lack of prestige, it's a sign both that there's something real to be discovered there, and that you have the right kind of motives. Impure motives are a big danger for the ambitious. If anything is going to lead you astray, it will be the desire to impress people. So while working on things that aren't prestigious doesn't guarantee you're on the right track, it at least guarantees you're not on the most common type of wrong one.
Over the next several years I wrote lots of essays about all kinds of different topics. O'Reilly reprinted a collection of them as a book, called Hackers & Painters after one of the essays in it. I also worked on spam filters, and did some more painting. I used to have dinners for a group of friends every thursday night, which taught me how to cook for groups. And I bought another building in Cambridge, a former candy factory (and later, twas said, porn studio), to use as an office.
One night in October 2003 there was a big party at my house. It was a clever idea of my friend Maria Daniels, who was one of the thursday diners. Three separate hosts would all invite their friends to one party. So for every guest, two thirds of the other guests would be people they didn't know but would probably like. One of the guests was someone I didn't know but would turn out to like a lot: a woman called Jessica Livingston. A couple days later I asked her out.
Jessica was in charge of marketing at a Boston investment bank. This bank thought it understood startups, but over the next year, as she met friends of mine from the startup world, she was surprised how different reality was. And how colorful their stories were. So she decided to compile a book of interviews with startup founders.
When the bank had financial problems and she had to fire half her staff, she started looking for a new job. In early 2005 she interviewed for a marketing job at a Boston VC firm. It took them weeks to make up their minds, and during this time I started telling her about all the things that needed to be fixed about venture capital. They should make a larger number of smaller investments instead of a handful of giant ones, they should be funding younger, more technical founders instead of MBAs, they should let the founders remain as CEO, and so on.
One of my tricks for writing essays had always been to give talks. The prospect of having to stand up in front of a group of people and tell them something that won't waste their time is a great spur to the imagination. When the Harvard Computer Society, the undergrad computer club, asked me to give a talk, I decided I would tell them how to start a startup. Maybe they'd be able to avoid the worst of the mistakes we'd made.
So I gave this talk, in the course of which I told them that the best sources of seed funding were successful startup founders, because then they'd be sources of advice too. Whereupon it seemed they were all looking expectantly at me. Horrified at the prospect of having my inbox flooded by business plans (if I'd only known), I blurted out "But not me!" and went on with the talk. But afterward it occurred to me that I should really stop procrastinating about angel investing. I'd been meaning to since Yahoo bought us, and now it was 7 years later and I still hadn't done one angel investment.
Meanwhile I had been scheming with Robert and Trevor about projects we could work on together. I missed working with them, and it seemed like there had to be something we could collaborate on.
As Jessica and I were walking home from dinner on March 11, at the corner of Garden and Walker streets, these three threads converged. Screw the VCs who were taking so long to make up their minds. We'd start our own investment firm and actually implement the ideas we'd been talking about. I'd fund it, and Jessica could quit her job and work for it, and we'd get Robert and Trevor as partners too. [13]
Once again, ignorance worked in our favor. We had no idea how to be angel investors, and in Boston in 2005 there were no Ron Conways to learn from. So we just made what seemed like the obvious choices, and some of the things we did turned out to be novel.
There are multiple components to Y Combinator, and we didn't figure them all out at once. The part we got first was to be an angel firm. In those days, those two words didn't go together. There were VC firms, which were organized companies with people whose job it was to make investments, but they only did big, million dollar investments. And there were angels, who did smaller investments, but these were individuals who were usually focused on other things and made investments on the side. And neither of them helped founders enough in the beginning. We knew how helpless founders were in some respects, because we remembered how helpless we'd been. For example, one thing Julian had done for us that seemed to us like magic was to get us set up as a company. We were fine writing fairly difficult software, but actually getting incorporated, with bylaws and stock and all that stuff, how on earth did you do that? Our plan was not only to make seed investments, but to do for startups everything Julian had done for us.
YC was not organized as a fund. It was cheap enough to run that we funded it with our own money. That went right by 99% of readers, but professional investors are thinking "Wow, that means they got all the returns." But once again, this was not due to any particular insight on our part. We didn't know how VC firms were organized. It never occurred to us to try to raise a fund, and if it had, we wouldn't have known where to start. [14]
The most distinctive thing about YC is the batch model: to fund a bunch of startups all at once, twice a year, and then to spend three months focusing intensively on trying to help them. That part we discovered by accident, not merely implicitly but explicitly due to our ignorance about investing. We needed to get experience as investors. What better way, we thought, than to fund a whole bunch of startups at once? We knew undergrads got temporary jobs at tech companies during the summer. Why not organize a summer program where they'd start startups instead? We wouldn't feel guilty for being in a sense fake investors, because they would in a similar sense be fake founders. So while we probably wouldn't make much money out of it, we'd at least get to practice being investors on them, and they for their part would probably have a more interesting summer than they would working at Microsoft.
We'd use the building I owned in Cambridge as our headquarters. We'd all have dinner there once a week — on tuesdays, since I was already cooking for the thursday diners on thursdays — and after dinner we'd bring in experts on startups to give talks.
We knew undergrads were deciding then about summer jobs, so in a matter of days we cooked up something we called the Summer Founders Program, and I posted an announcement on my site, inviting undergrads to apply. I had never imagined that writing essays would be a way to get "deal flow," as investors call it, but it turned out to be the perfect source. [15] We got 225 applications for the Summer Founders Program, and we were surprised to find that a lot of them were from people who'd already graduated, or were about to that spring. Already this SFP thing was starting to feel more serious than we'd intended.
We invited about 20 of the 225 groups to interview in person, and from those we picked 8 to fund. They were an impressive group. That first batch included reddit, Justin Kan and Emmett Shear, who went on to found Twitch, Aaron Swartz, who had already helped write the RSS spec and would a few years later become a martyr for open access, and Sam Altman, who would later become the second president of YC. I don't think it was entirely luck that the first batch was so good. You had to be pretty bold to sign up for a weird thing like the Summer Founders Program instead of a summer job at a legit place like Microsoft or Goldman Sachs.
The deal for startups was based on a combination of the deal we did with Julian ($10k for 10%) and what Robert said MIT grad students got for the summer ($6k). We invested $6k per founder, which in the typical two-founder case was $12k, in return for 6%. That had to be fair, because it was twice as good as the deal we ourselves had taken. Plus that first summer, which was really hot, Jessica brought the founders free air conditioners. [16]
Fairly quickly I realized that we had stumbled upon the way to scale startup funding. Funding startups in batches was more convenient for us, because it meant we could do things for a lot of startups at once, but being part of a batch was better for the startups too. It solved one of the biggest problems faced by founders: the isolation. Now you not only had colleagues, but colleagues who understood the problems you were facing and could tell you how they were solving them.
As YC grew, we started to notice other advantages of scale. The alumni became a tight community, dedicated to helping one another, and especially the current batch, whose shoes they remembered being in. We also noticed that the startups were becoming one another's customers. We used to refer jokingly to the "YC GDP," but as YC grows this becomes less and less of a joke. Now lots of startups get their initial set of customers almost entirely from among their batchmates.
I had not originally intended YC to be a full-time job. I was going to do three things: hack, write essays, and work on YC. As YC grew, and I grew more excited about it, it started to take up a lot more than a third of my attention. But for the first few years I was still able to work on other things.
In the summer of 2006, Robert and I started working on a new version of Arc. This one was reasonably fast, because it was compiled into Scheme. To test this new Arc, I wrote Hacker News in it. It was originally meant to be a news aggregator for startup founders and was called Startup News, but after a few months I got tired of reading about nothing but startups. Plus it wasn't startup founders we wanted to reach. It was future startup founders. So I changed the name to Hacker News and the topic to whatever engaged one's intellectual curiosity.
HN was no doubt good for YC, but it was also by far the biggest source of stress for me. If all I'd had to do was select and help founders, life would have been so easy. And that implies that HN was a mistake. Surely the biggest source of stress in one's work should at least be something close to the core of the work. Whereas I was like someone who was in pain while running a marathon not from the exertion of running, but because I had a blister from an ill-fitting shoe. When I was dealing with some urgent problem during YC, there was about a 60% chance it had to do with HN, and a 40% chance it had do with everything else combined. [17]
As well as HN, I wrote all of YC's internal software in Arc. But while I continued to work a good deal in Arc, I gradually stopped working on Arc, partly because I didn't have time to, and partly because it was a lot less attractive to mess around with the language now that we had all this infrastructure depending on it. So now my three projects were reduced to two: writing essays and working on YC.
YC was different from other kinds of work I've done. Instead of deciding for myself what to work on, the problems came to me. Every 6 months there was a new batch of startups, and their problems, whatever they were, became our problems. It was very engaging work, because their problems were quite varied, and the good founders were very effective. If you were trying to learn the most you could about startups in the shortest possible time, you couldn't have picked a better way to do it.
There were parts of the job I didn't like. Disputes between cofounders, figuring out when people were lying to us, fighting with people who maltreated the startups, and so on. But I worked hard even at the parts I didn't like. I was haunted by something Kevin Hale once said about companies: "No one works harder than the boss." He meant it both descriptively and prescriptively, and it was the second part that scared me. I wanted YC to be good, so if how hard I worked set the upper bound on how hard everyone else worked, I'd better work very hard.
One day in 2010, when he was visiting California for interviews, Robert Morris did something astonishing: he offered me unsolicited advice. I can only remember him doing that once before. One day at Viaweb, when I was bent over double from a kidney stone, he suggested that it would be a good idea for him to take me to the hospital. That was what it took for Rtm to offer unsolicited advice. So I remember his exact words very clearly. "You know," he said, "you should make sure Y Combinator isn't the last cool thing you do."
At the time I didn't understand what he meant, but gradually it dawned on me that he was saying I should quit. This seemed strange advice, because YC was doing great. But if there was one thing rarer than Rtm offering advice, it was Rtm being wrong. So this set me thinking. It was true that on my current trajectory, YC would be the last thing I did, because it was only taking up more of my attention. It had already eaten Arc, and was in the process of eating essays too. Either YC was my life's work or I'd have to leave eventually. And it wasn't, so I would.
In the summer of 2012 my mother had a stroke, and the cause turned out to be a blood clot caused by colon cancer. The stroke destroyed her balance, and she was put in a nursing home, but she really wanted to get out of it and back to her house, and my sister and I were determined to help her do it. I used to fly up to Oregon to visit her regularly, and I had a lot of time to think on those flights. On one of them I realized I was ready to hand YC over to someone else.
I asked Jessica if she wanted to be president, but she didn't, so we decided we'd try to recruit Sam Altman. We talked to Robert and Trevor and we agreed to make it a complete changing of the guard. Up till that point YC had been controlled by the original LLC we four had started. But we wanted YC to last for a long time, and to do that it couldn't be controlled by the founders. So if Sam said yes, we'd let him reorganize YC. Robert and I would retire, and Jessica and Trevor would become ordinary partners.
When we asked Sam if he wanted to be president of YC, initially he said no. He wanted to start a startup to make nuclear reactors. But I kept at it, and in October 2013 he finally agreed. We decided he'd take over starting with the winter 2014 batch. For the rest of 2013 I left running YC more and more to Sam, partly so he could learn the job, and partly because I was focused on my mother, whose cancer had returned.
She died on January 15, 2014. We knew this was coming, but it was still hard when it did.
I kept working on YC till March, to help get that batch of startups through Demo Day, then I checked out pretty completely. (I still talk to alumni and to new startups working on things I'm interested in, but that only takes a few hours a week.)
What should I do next? Rtm's advice hadn't included anything about that. I wanted to do something completely different, so I decided I'd paint. I wanted to see how good I could get if I really focused on it. So the day after I stopped working on YC, I started painting. I was rusty and it took a while to get back into shape, but it was at least completely engaging. [18]
I spent most of the rest of 2014 painting. I'd never been able to work so uninterruptedly before, and I got to be better than I had been. Not good enough, but better. Then in November, right in the middle of a painting, I ran out of steam. Up till that point I'd always been curious to see how the painting I was working on would turn out, but suddenly finishing this one seemed like a chore. So I stopped working on it and cleaned my brushes and haven't painted since. So far anyway.
I realize that sounds rather wimpy. But attention is a zero sum game. If you can choose what to work on, and you choose a project that's not the best one (or at least a good one) for you, then it's getting in the way of another project that is. And at 50 there was some opportunity cost to screwing around.
I started writing essays again, and wrote a bunch of new ones over the next few months. I even wrote a couple that weren't about startups. Then in March 2015 I started working on Lisp again.
The distinctive thing about Lisp is that its core is a language defined by writing an interpreter in itself. It wasn't originally intended as a programming language in the ordinary sense. It was meant to be a formal model of computation, an alternative to the Turing machine. If you want to write an interpreter for a language in itself, what's the minimum set of predefined operators you need? The Lisp that John McCarthy invented, or more accurately discovered, is an answer to that question. [19]
McCarthy didn't realize this Lisp could even be used to program computers till his grad student Steve Russell suggested it. Russell translated McCarthy's interpreter into IBM 704 machine language, and from that point Lisp started also to be a programming language in the ordinary sense. But its origins as a model of computation gave it a power and elegance that other languages couldn't match. It was this that attracted me in college, though I didn't understand why at the time.
McCarthy's 1960 Lisp did nothing more than interpret Lisp expressions. It was missing a lot of things you'd want in a programming language. So these had to be added, and when they were, they weren't defined using McCarthy's original axiomatic approach. That wouldn't have been feasible at the time. McCarthy tested his interpreter by hand-simulating the execution of programs. But it was already getting close to the limit of interpreters you could test that way — indeed, there was a bug in it that McCarthy had overlooked. To test a more complicated interpreter, you'd have had to run it, and computers then weren't powerful enough.
Now they are, though. Now you could continue using McCarthy's axiomatic approach till you'd defined a complete programming language. And as long as every change you made to McCarthy's Lisp was a discoveredness-preserving transformation, you could, in principle, end up with a complete language that had this quality. Harder to do than to talk about, of course, but if it was possible in principle, why not try? So I decided to take a shot at it. It took 4 years, from March 26, 2015 to October 12, 2019. It was fortunate that I had a precisely defined goal, or it would have been hard to keep at it for so long.
I wrote this new Lisp, called Bel, in itself in Arc. That may sound like a contradiction, but it's an indication of the sort of trickery I had to engage in to make this work. By means of an egregious collection of hacks I managed to make something close enough to an interpreter written in itself that could actually run. Not fast, but fast enough to test.
I had to ban myself from writing essays during most of this time, or I'd never have finished. In late 2015 I spent 3 months writing essays, and when I went back to working on Bel I could barely understand the code. Not so much because it was badly written as because the problem is so convoluted. When you're working on an interpreter written in itself, it's hard to keep track of what's happening at what level, and errors can be practically encrypted by the time you get them.
So I said no more essays till Bel was done. But I told few people about Bel while I was working on it. So for years it must have seemed that I was doing nothing, when in fact I was working harder than I'd ever worked on anything. Occasionally after wrestling for hours with some gruesome bug I'd check Twitter or HN and see someone asking "Does Paul Graham still code?"
Working on Bel was hard but satisfying. I worked on it so intensively that at any given time I had a decent chunk of the code in my head and could write more there. I remember taking the boys to the coast on a sunny day in 2015 and figuring out how to deal with some problem involving continuations while I watched them play in the tide pools. It felt like I was doing life right. I remember that because I was slightly dismayed at how novel it felt. The good news is that I had more moments like this over the next few years.
In the summer of 2016 we moved to England. We wanted our kids to see what it was like living in another country, and since I was a British citizen by birth, that seemed the obvious choice. We only meant to stay for a year, but we liked it so much that we still live there. So most of Bel was written in England.
In the fall of 2019, Bel was finally finished. Like McCarthy's original Lisp, it's a spec rather than an implementation, although like McCarthy's Lisp it's a spec expressed as code.
Now that I could write essays again, I wrote a bunch about topics I'd had stacked up. I kept writing essays through 2020, but I also started to think about other things I could work on. How should I choose what to do? Well, how had I chosen what to work on in the past? I wrote an essay for myself to answer that question, and I was surprised how long and messy the answer turned out to be. If this surprised me, who'd lived it, then I thought perhaps it would be interesting to other people, and encouraging to those with similarly messy lives. So I wrote a more detailed version for others to read, and this is the last sentence of it.
Notes
[1] My experience skipped a step in the evolution of computers: time-sharing machines with interactive OSes. I went straight from batch processing to microcomputers, which made microcomputers seem all the more exciting.
[2] Italian words for abstract concepts can nearly always be predicted from their English cognates (except for occasional traps like polluzione). It's the everyday words that differ. So if you string together a lot of abstract concepts with a few simple verbs, you can make a little Italian go a long way.
[3] I lived at Piazza San Felice 4, so my walk to the Accademia went straight down the spine of old Florence: past the Pitti, across the bridge, past Orsanmichele, between the Duomo and the Baptistery, and then up Via Ricasoli to Piazza San Marco. I saw Florence at street level in every possible condition, from empty dark winter evenings to sweltering summer days when the streets were packed with tourists.
[4] You can of course paint people like still lives if you want to, and they're willing. That sort of portrait is arguably the apex of still life painting, though the long sitting does tend to produce pained expressions in the sitters.
[5] Interleaf was one of many companies that had smart people and built impressive technology, and yet got crushed by Moore's Law. In the 1990s the exponential growth in the power of commodity (i.e. Intel) processors rolled up high-end, special-purpose hardware and software companies like a bulldozer.
[6] The signature style seekers at RISD weren't specifically mercenary. In the art world, money and coolness are tightly coupled. Anything expensive comes to be seen as cool, and anything seen as cool will soon become equally expensive.
[7] Technically the apartment wasn't rent-controlled but rent-stabilized, but this is a refinement only New Yorkers would know or care about. The point is that it was really cheap, less than half market price.
[8] Most software you can launch as soon as it's done. But when the software is an online store builder and you're hosting the stores, if you don't have any users yet, that fact will be painfully obvious. So before we could launch publicly we had to launch privately, in the sense of recruiting an initial set of users and making sure they had decent-looking stores.
[9] We'd had a code editor in Viaweb for users to define their own page styles. They didn't know it, but they were editing Lisp expressions underneath. But this wasn't an app editor, because the code ran when the merchants' sites were generated, not when shoppers visited them.
[10] This was the first instance of what is now a familiar experience, and so was what happened next, when I read the comments and found they were full of angry people. How could I claim that Lisp was better than other languages? Weren't they all Turing complete? People who see the responses to essays I write sometimes tell me how sorry they feel for me, but I'm not exaggerating when I reply that it has always been like this, since the very beginning. It comes with the territory. An essay must tell readers things they don't already know, and some people dislike being told such things.
[11] People put plenty of stuff on the internet in the 90s of course, but putting something online is not the same as publishing it online. Publishing online means you treat the online version as the (or at least a) primary version.
[12] There is a general lesson here that our experience with Y Combinator also teaches: Customs continue to constrain you long after the restrictions that caused them have disappeared. Customary VC practice had once, like the customs about publishing essays, been based on real constraints. Startups had once been much more expensive to start, and proportionally rare. Now they could be cheap and common, but the VCs' customs still reflected the old world, just as customs about writing essays still reflected the constraints of the print era.
Which in turn implies that people who are independent-minded (i.e. less influenced by custom) will have an advantage in fields affected by rapid change (where customs are more likely to be obsolete).
Here's an interesting point, though: you can't always predict which fields will be affected by rapid change. Obviously software and venture capital will be, but who would have predicted that essay writing would be?
[13] Y Combinator was not the original name. At first we were called Cambridge Seed. But we didn't want a regional name, in case someone copied us in Silicon Valley, so we renamed ourselves after one of the coolest tricks in the lambda calculus, the Y combinator.
I picked orange as our color partly because it's the warmest, and partly because no VC used it. In 2005 all the VCs used staid colors like maroon, navy blue, and forest green, because they were trying to appeal to LPs, not founders. The YC logo itself is an inside joke: the Viaweb logo had been a white V on a red circle, so I made the YC logo a white Y on an orange square.
[14] YC did become a fund for a couple years starting in 2009, because it was getting so big I could no longer afford to fund it personally. But after Heroku got bought we had enough money to go back to being self-funded.
[15] I've never liked the term "deal flow," because it implies that the number of new startups at any given time is fixed. This is not only false, but it's the purpose of YC to falsify it, by causing startups to be founded that would not otherwise have existed.
[16] She reports that they were all different shapes and sizes, because there was a run on air conditioners and she had to get whatever she could, but that they were all heavier than she could carry now.
[17] Another problem with HN was a bizarre edge case that occurs when you both write essays and run a forum. When you run a forum, you're assumed to see if not every conversation, at least every conversation involving you. And when you write essays, people post highly imaginative misinterpretations of them on forums. Individually these two phenomena are tedious but bearable, but the combination is disastrous. You actually have to respond to the misinterpretations, because the assumption that you're present in the conversation means that not responding to any sufficiently upvoted misinterpretation reads as a tacit admission that it's correct. But that in turn encourages more; anyone who wants to pick a fight with you senses that now is their chance.
[18] The worst thing about leaving YC was not working with Jessica anymore. We'd been working on YC almost the whole time we'd known each other, and we'd neither tried nor wanted to separate it from our personal lives, so leaving was like pulling up a deeply rooted tree.
[19] One way to get more precise about the concept of invented vs discovered is to talk about space aliens. Any sufficiently advanced alien civilization would certainly know about the Pythagorean theorem, for example. I believe, though with less certainty, that they would also know about the Lisp in McCarthy's 1960 paper.
But if so there's no reason to suppose that this is the limit of the language that might be known to them. Presumably aliens need numbers and errors and I/O too. So it seems likely there exists at least one path out of McCarthy's Lisp along which discoveredness is preserved.
Thanks to Trevor Blackwell, John Collison, Patrick Collison, Daniel Gackle, Ralph Hazell, Jessica Livingston, Robert Morris, and Harj Taggar for reading drafts of this.`;
export default essay;
-40
View File
@@ -1,40 +0,0 @@
import { stdin as input, stdout as output } from "node:process";
// readline/promises is still experimental so not in @types/node yet
// @ts-ignore
import readline from "node:readline/promises";
import { ChatMessage, LlamaDeuce, OpenAI } from "llamaindex";
(async () => {
const gpt4 = new OpenAI({ model: "gpt-4", temperature: 0.9 });
const l2 = new LlamaDeuce({
model: "Llama-2-70b-chat-4bit",
temperature: 0.9,
});
const rl = readline.createInterface({ input, output });
const start = await rl.question("Start: ");
const history: ChatMessage[] = [
{
content:
"Prefer shorter answers. Keep your response to 100 words or less.",
role: "system",
},
{ content: start, role: "user" },
];
while (true) {
const next = history.length % 2 === 1 ? gpt4 : l2;
const r = await next.chat(
history.map(({ content, role }) => ({
content,
role: next === l2 ? role : role === "user" ? "assistant" : "user",
})),
);
history.push({
content: r.message.content,
role: next === l2 ? "assistant" : "user",
});
await rl.question((next === l2 ? "Llama: " : "GPT: ") + r.message.content);
}
})();
-21
View File
@@ -1,21 +0,0 @@
import { HTMLReader, VectorStoreIndex } from "llamaindex";
async function main() {
// Load page
const reader = new HTMLReader();
const documents = await reader.loadData("data/18-1_Changelog.html");
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments(documents);
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query(
"What were the notable changes in 18.1?",
);
// Output response
console.log(response.toString());
}
main().catch(console.error);
-32
View File
@@ -1,32 +0,0 @@
import {
Document,
KeywordTableIndex,
KeywordTableRetrieverMode,
} from "llamaindex";
import essay from "./essay";
async function main() {
const document = new Document({ text: essay, id_: "essay" });
const index = await KeywordTableIndex.fromDocuments([document]);
const allModes: KeywordTableRetrieverMode[] = [
KeywordTableRetrieverMode.DEFAULT,
KeywordTableRetrieverMode.SIMPLE,
KeywordTableRetrieverMode.RAKE,
];
allModes.forEach(async (mode) => {
const queryEngine = index.asQueryEngine({
retriever: index.asRetriever({
mode,
}),
});
const response = await queryEngine.query(
"What did the author do growing up?",
);
console.log(response.toString());
});
}
main().catch((e: Error) => {
console.error(e, e.stack);
});
-7
View File
@@ -1,7 +0,0 @@
import { DeuceChatStrategy, LlamaDeuce } from "llamaindex";
(async () => {
const deuce = new LlamaDeuce({ chatStrategy: DeuceChatStrategy.META });
const result = await deuce.chat([{ content: "Hello, world!", role: "user" }]);
console.log(result);
})();
-47
View File
@@ -1,47 +0,0 @@
import { ChatMessage, SimpleChatEngine } from "llamaindex";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline/promises";
import { Anthropic } from "../../packages/core/src/llm/LLM";
async function main() {
const query: string = `
Where is Istanbul?
`;
// const llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0.1 });
const llm = new Anthropic();
const message: ChatMessage = { content: query, role: "user" };
//TODO: Add callbacks later
//Stream Complete
//Note: Setting streaming flag to true or false will auto-set your return type to
//either an AsyncGenerator or a Response.
// Omitting the streaming flag automatically sets streaming to false
const chatEngine: SimpleChatEngine = new SimpleChatEngine({
chatHistory: undefined,
llm: llm,
});
const rl = readline.createInterface({ input, output });
while (true) {
const query = await rl.question("Query: ");
if (!query) {
break;
}
//Case 1: .chat(query, undefined, true) => Stream
//Case 2: .chat(query, undefined, false) => Response object
//Case 3: .chat(query, undefined) => Response object
const chatStream = await chatEngine.chat(query, undefined, true);
var accumulated_result = "";
for await (const part of chatStream) {
accumulated_result += part;
process.stdout.write(part);
}
}
}
main();
-35
View File
@@ -1,35 +0,0 @@
import {
Document,
NodeWithScore,
ResponseSynthesizer,
SimpleNodeParser,
TextNode,
} from "llamaindex";
(async () => {
const nodeParser = new SimpleNodeParser();
const nodes = nodeParser.getNodesFromDocuments([
new Document({ text: "I am 10 years old. John is 20 years old." }),
]);
console.log(nodes);
const responseSynthesizer = new ResponseSynthesizer();
const nodesWithScore: NodeWithScore[] = [
{
node: new TextNode({ text: "I am 10 years old." }),
score: 1,
},
{
node: new TextNode({ text: "John is 20 years old." }),
score: 0.5,
},
];
const response = await responseSynthesizer.synthesize(
"What age am I?",
nodesWithScore,
);
console.log(response.response);
})();
-20
View File
@@ -1,20 +0,0 @@
import { MarkdownReader, VectorStoreIndex } from "llamaindex";
async function main() {
// Load Markdown file
const reader = new MarkdownReader();
const documents = await reader.loadData("node_modules/llamaindex/README.md");
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments(documents);
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query("What does the example code do?");
// Output response
console.log(response.toString());
}
main().catch(console.error);
-68
View File
@@ -1,68 +0,0 @@
import { MongoClient } from "mongodb";
import { Document } from "../../packages/core/src/Node";
import { VectorStoreIndex } from "../../packages/core/src/indices";
import { SimpleMongoReader } from "../../packages/core/src/readers/SimpleMongoReader";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline/promises";
async function main() {
//Dummy test code
const query: object = { _id: "waldo" };
const options: object = {};
const projections: object = { embedding: 0 };
const limit: number = Infinity;
const uri: string = process.env.MONGODB_URI ?? "fake_uri";
const client: MongoClient = new MongoClient(uri);
//Where the real code starts
const MR = new SimpleMongoReader(client);
const documents: Document[] = await MR.loadData(
"data",
"posts",
1,
{},
options,
projections,
);
//
//If you need to look at low-level details of
// a queryEngine (for example, needing to check each individual node)
//
// Split text and create embeddings. Store them in a VectorStoreIndex
// var storageContext = await storageContextFromDefaults({});
// var serviceContext = serviceContextFromDefaults({});
// const docStore = storageContext.docStore;
// for (const doc of documents) {
// docStore.setDocumentHash(doc.id_, doc.hash);
// }
// const nodes = serviceContext.nodeParser.getNodesFromDocuments(documents);
// console.log(nodes);
//
//Making Vector Store from documents
//
const index = await VectorStoreIndex.fromDocuments(documents);
// Create query engine
const queryEngine = index.asQueryEngine();
const rl = readline.createInterface({ input, output });
while (true) {
const query = await rl.question("Query: ");
if (!query) {
break;
}
const response = await queryEngine.query(query);
// Output response
console.log(response.toString());
}
}
main();
-89
View File
@@ -1,89 +0,0 @@
import { Client } from "@notionhq/client";
import { program } from "commander";
import { NotionReader, VectorStoreIndex } from "llamaindex";
import { stdin as input, stdout as output } from "node:process";
// readline/promises is still experimental so not in @types/node yet
// @ts-ignore
import readline from "node:readline/promises";
program
.argument("[page]", "Notion page id (must be provided)")
.action(async (page, _options, command) => {
// Initializing a client
if (!process.env.NOTION_TOKEN) {
console.log(
"No NOTION_TOKEN found in environment variables. You will need to register an integration https://www.notion.com/my-integrations and put it in your NOTION_TOKEN environment variable.",
);
return;
}
const notion = new Client({
auth: process.env.NOTION_TOKEN,
});
if (!page) {
const response = await notion.search({
filter: {
value: "page",
property: "object",
},
sort: {
direction: "descending",
timestamp: "last_edited_time",
},
});
const { results } = response;
if (results.length === 0) {
console.log(
"No pages found. You will need to share it with your integration. (tap the three dots on the top right, find Add connections, and add your integration)",
);
return;
} else {
const pages = results
.map((result) => {
if (!("url" in result)) {
return null;
}
return {
id: result.id,
url: result.url,
};
})
.filter((page) => page !== null);
console.log("Found pages:");
console.table(pages);
console.log(`To run, run ts-node ${command.name()} [page id]`);
return;
}
}
const reader = new NotionReader({ client: notion });
const documents = await reader.loadData(page);
console.log(documents);
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments(documents);
// Create query engine
const queryEngine = index.asQueryEngine();
const rl = readline.createInterface({ input, output });
while (true) {
const query = await rl.question("Query: ");
if (!query) {
break;
}
const response = await queryEngine.query(query);
// Output response
console.log(response.toString());
}
});
program.parse();
-15
View File
@@ -1,15 +0,0 @@
import { OpenAI } from "llamaindex";
(async () => {
const llm = new OpenAI({ model: "gpt-4-1106-preview", temperature: 0.1 });
// complete api
const response1 = await llm.complete("How are you?");
console.log(response1.message.content);
// chat api
const response2 = await llm.chat([
{ content: "Tell me a joke.", role: "user" },
]);
console.log(response2.message.content);
})();
-18
View File
@@ -1,18 +0,0 @@
{
"version": "0.0.33",
"private": true,
"name": "simple",
"dependencies": {
"@notionhq/client": "^2.2.13",
"@pinecone-database/pinecone": "^1.1.2",
"commander": "^11.1.0",
"llamaindex": "workspace:*"
},
"devDependencies": {
"@types/node": "^18.18.6",
"ts-node": "^10.9.1"
},
"scripts": {
"lint": "eslint ."
}
}
-19
View File
@@ -1,19 +0,0 @@
import { PDFReader, VectorStoreIndex } from "llamaindex";
async function main() {
// Load PDF
const reader = new PDFReader();
const documents = await reader.loadData("data/brk-2022.pdf");
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments(documents);
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query("What mistakes did they make?");
// Output response
console.log(response.toString());
}
main().catch(console.error);
-23
View File
@@ -1,23 +0,0 @@
import { Portkey } from "llamaindex";
(async () => {
const llms = [{}];
const portkey = new Portkey({
mode: "single",
llms: [
{
provider: "anyscale",
virtual_key: "anyscale-3b3c04",
model: "meta-llama/Llama-2-13b-chat-hf",
max_tokens: 2000,
},
],
});
const result = portkey.stream_chat([
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Tell me a joke." },
]);
for await (const res of result) {
process.stdout.write(res);
}
})();
-16
View File
@@ -1,16 +0,0 @@
import fs from "node:fs/promises";
import { SentenceSplitter } from "llamaindex";
async function main() {
const path = "node_modules/llamaindex/examples/abramov.txt";
const essay = await fs.readFile(path, "utf-8");
const textSplitter = new SentenceSplitter();
const chunks = textSplitter.splitTextWithOverlaps(essay);
console.log(chunks);
}
main();
-44
View File
@@ -1,44 +0,0 @@
import {
Document,
storageContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
import essay from "./essay";
async function main() {
// Create Document object with essay
const document = new Document({ text: essay, id_: "essay" });
// Split text and create embeddings. Store them in a VectorStoreIndex
// persist the vector store automatically with the storage context
const storageContext = await storageContextFromDefaults({
persistDir: "./storage",
});
const index = await VectorStoreIndex.fromDocuments([document], {
storageContext,
});
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query(
"What did the author do in college?",
);
// Output response
console.log(response.toString());
// load the index
const secondStorageContext = await storageContextFromDefaults({
persistDir: "./storage",
});
const loadedIndex = await VectorStoreIndex.init({
storageContext: secondStorageContext,
});
const loadedQueryEngine = loadedIndex.asQueryEngine();
const loadedResponse = await loadedQueryEngine.query(
"What did the author do growing up?",
);
console.log(loadedResponse.toString());
}
main().catch(console.error);
-26
View File
@@ -1,26 +0,0 @@
import { Document, SubQuestionQueryEngine, VectorStoreIndex } from "llamaindex";
import essay from "./essay";
(async () => {
const document = new Document({ text: essay, id_: essay });
const index = await VectorStoreIndex.fromDocuments([document]);
const queryEngine = SubQuestionQueryEngine.fromDefaults({
queryEngineTools: [
{
queryEngine: index.asQueryEngine(),
metadata: {
name: "pg_essay",
description: "Paul Graham essay on What I Worked On",
},
},
],
});
const response = await queryEngine.query(
"How was Paul Grahams life different before and after YC?",
);
console.log(response.toString());
})();
-31
View File
@@ -1,31 +0,0 @@
import {
Document,
SimpleNodeParser,
SummaryIndex,
SummaryRetrieverMode,
serviceContextFromDefaults,
} from "llamaindex";
import essay from "./essay";
async function main() {
const serviceContext = serviceContextFromDefaults({
nodeParser: new SimpleNodeParser({
chunkSize: 40,
}),
});
const document = new Document({ text: essay, id_: "essay" });
const index = await SummaryIndex.fromDocuments([document], {
serviceContext,
});
const queryEngine = index.asQueryEngine({
retriever: index.asRetriever({ mode: SummaryRetrieverMode.LLM }),
});
const response = await queryEngine.query(
"What did the author do growing up?",
);
console.log(response.toString());
}
main().catch((e: Error) => {
console.error(e, e.stack);
});
-27
View File
@@ -1,27 +0,0 @@
import fs from "node:fs/promises";
import { Document, VectorStoreIndex } from "llamaindex";
async function main() {
// Load essay from abramov.txt in Node
const path = "node_modules/llamaindex/examples/abramov.txt";
const essay = await fs.readFile(path, "utf-8");
// Create Document object with essay
const document = new Document({ text: essay, id_: path });
// Split text and create embeddings. Store them in a VectorStoreIndex
const index = await VectorStoreIndex.fromDocuments([document]);
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query(
"What did the author do in college?",
);
// Output response
console.log(response.toString());
}
main().catch(console.error);
-35
View File
@@ -1,35 +0,0 @@
import fs from "node:fs/promises";
import {
Anthropic,
Document,
serviceContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
async function main() {
// Load essay from abramov.txt in Node
const path = "node_modules/llamaindex/examples/abramov.txt";
const essay = await fs.readFile(path, "utf-8");
// Create Document object with essay
const document = new Document({ text: essay, id_: path });
// Split text and create embeddings. Store them in a VectorStoreIndex
const serviceContext = serviceContextFromDefaults({ llm: new Anthropic() });
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query(
"What did the author do in college?",
);
// Output response
console.log(response.toString());
}
main().catch(console.error);
-42
View File
@@ -1,42 +0,0 @@
import {
Document,
OpenAI,
RetrieverQueryEngine,
serviceContextFromDefaults,
SimilarityPostprocessor,
VectorStoreIndex,
} from "llamaindex";
import essay from "./essay";
// Customize retrieval and query args
async function main() {
const document = new Document({ text: essay, id_: "essay" });
const serviceContext = serviceContextFromDefaults({
llm: new OpenAI({ model: "gpt-3.5-turbo", temperature: 0.1 }),
});
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
const retriever = index.asRetriever();
retriever.similarityTopK = 5;
const nodePostprocessor = new SimilarityPostprocessor({
similarityCutoff: 0.7,
});
// TODO: cannot pass responseSynthesizer into retriever query engine
const queryEngine = new RetrieverQueryEngine(
retriever,
undefined,
undefined,
[nodePostprocessor],
);
const response = await queryEngine.query(
"What did the author do growing up?",
);
console.log(response.response);
}
main().catch(console.error);
-197
View File
@@ -1,197 +0,0 @@
import {
OpenAI,
ResponseSynthesizer,
RetrieverQueryEngine,
serviceContextFromDefaults,
TextNode,
TreeSummarize,
VectorIndexRetriever,
VectorStore,
VectorStoreIndex,
VectorStoreQuery,
VectorStoreQueryResult,
} from "llamaindex";
import { Index, Pinecone, RecordMetadata } from "@pinecone-database/pinecone";
/**
* Please do not use this class in production; it's only for demonstration purposes.
*/
class PineconeVectorStore<T extends RecordMetadata = RecordMetadata>
implements VectorStore
{
storesText = true;
isEmbeddingQuery = false;
indexName!: string;
pineconeClient!: Pinecone;
index!: Index<T>;
constructor({ indexName, client }: { indexName: string; client: Pinecone }) {
this.indexName = indexName;
this.pineconeClient = client;
this.index = client.index<T>(indexName);
}
client() {
return this.pineconeClient;
}
async query(
query: VectorStoreQuery,
kwargs?: any,
): Promise<VectorStoreQueryResult> {
let queryEmbedding: number[] = [];
if (query.queryEmbedding) {
if (typeof query.alpha === "number") {
const alpha = query.alpha;
queryEmbedding = query.queryEmbedding.map((v) => v * alpha);
} else {
queryEmbedding = query.queryEmbedding;
}
}
// Current LlamaIndexTS implementation only support exact match filter, so we use kwargs instead.
const filter = kwargs?.filter || {};
const response = await this.index.query({
filter,
vector: queryEmbedding,
topK: query.similarityTopK,
includeValues: true,
includeMetadata: true,
});
console.log(
`Numbers of vectors returned by Pinecone after preFilters are applied: ${
response?.matches?.length || 0
}.`,
);
const topKIds: string[] = [];
const topKNodes: TextNode[] = [];
const topKScores: number[] = [];
const metadataToNode = (metadata?: T): Partial<TextNode> => {
if (!metadata) {
throw new Error("metadata is undefined.");
}
const nodeContent = metadata["_node_content"];
if (!nodeContent) {
throw new Error("nodeContent is undefined.");
}
if (typeof nodeContent !== "string") {
throw new Error("nodeContent is not a string.");
}
return JSON.parse(nodeContent);
};
if (response.matches) {
for (const match of response.matches) {
const node = new TextNode({
...metadataToNode(match.metadata),
embedding: match.values,
});
topKIds.push(match.id);
topKNodes.push(node);
topKScores.push(match.score ?? 0);
}
}
const result = {
ids: topKIds,
nodes: topKNodes,
similarities: topKScores,
};
return result;
}
add(): Promise<string[]> {
return Promise.resolve([]);
}
delete(): Promise<void> {
throw new Error("Method `delete` not implemented.");
}
persist(): Promise<void> {
throw new Error("Method `persist` not implemented.");
}
}
/**
* The goal of this example is to show how to use Pinecone as a vector store
* for LlamaIndexTS with(out) preFilters.
*
* It should not be used in production like that,
* as you might want to find a proper PineconeVectorStore implementation.
*/
async function main() {
process.env.PINECONE_API_KEY = "Your Pinecone API Key.";
process.env.PINECONE_ENVIRONMENT = "Your Pinecone Environment.";
process.env.PINECONE_PROJECT_ID = "Your Pinecone Project ID.";
process.env.PINECONE_INDEX_NAME = "Your Pinecone Index Name.";
process.env.OPENAI_API_KEY = "Your OpenAI API Key.";
process.env.OPENAI_API_ORGANIZATION = "Your OpenAI API Organization.";
const getPineconeVectorStore = async () => {
return new PineconeVectorStore({
indexName: process.env.PINECONE_INDEX_NAME || "index-name",
client: new Pinecone(),
});
};
const getServiceContext = () => {
const openAI = new OpenAI({
model: "gpt-4",
apiKey: process.env.OPENAI_API_KEY,
});
return serviceContextFromDefaults({
llm: openAI,
});
};
const getQueryEngine = async (filter: unknown) => {
const vectorStore = await getPineconeVectorStore();
const serviceContext = getServiceContext();
const vectorStoreIndex = await VectorStoreIndex.fromVectorStore(
vectorStore,
serviceContext,
);
const retriever = new VectorIndexRetriever({
index: vectorStoreIndex,
similarityTopK: 500,
});
const responseSynthesizer = new ResponseSynthesizer({
serviceContext,
responseBuilder: new TreeSummarize(serviceContext),
});
return new RetrieverQueryEngine(retriever, responseSynthesizer, {
filter,
});
};
// whatever is a key from your metadata
const queryEngine = await getQueryEngine({
whatever: {
$gte: 1,
$lte: 100,
},
});
const response = await queryEngine.query("How many results do you have?");
console.log(response.toString());
}
main().catch(console.error);
-36
View File
@@ -1,36 +0,0 @@
import fs from "node:fs/promises";
import {
Document,
OpenAI,
serviceContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
async function main() {
// Load essay from abramov.txt in Node
const path = "node_modules/llamaindex/examples/abramov.txt";
const essay = await fs.readFile(path, "utf-8");
// Create Document object with essay
const document = new Document({ text: essay, id_: path });
// Split text and create embeddings. Store them in a VectorStoreIndex
const serviceContext = serviceContextFromDefaults({
llm: new OpenAI({ model: "gpt-4" }),
});
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// Query the index
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query(
"What did the author do in college?",
);
// Output response
console.log(response.toString());
}
main().catch(console.error);
-15
View File
@@ -1,15 +0,0 @@
import { OpenAI } from "llamaindex";
(async () => {
const llm = new OpenAI({ model: "gpt-4-vision-preview", temperature: 0.1 });
// complete api
const response1 = await llm.complete("How are you?");
console.log(response1.message.content);
// chat api
const response2 = await llm.chat([
{ content: "Tell me a joke!", role: "user" },
]);
console.log(response2.message.content);
})();
+24 -4
View File
@@ -1,9 +1,29 @@
# Simple Examples
Make sure to run `npm install` and set your OpenAI environment variable before running these examples.
Before running any of the examples, make sure to set your OpenAI environment variable:
```
npm install
```bash
export OPENAI_API_KEY="sk-..."
npx ts-node vectorIndex.ts
```
There are two ways to run the examples, using the latest published version of `llamaindex` or using a local build.
## Using the latest published version
Make sure to call `npm install` before running these examples:
```bash
npm install
```
Then run the examples with `ts-node`, for example `npx ts-node vectorIndex.ts`
## Using the local build
```bash
pnpm install
pnpm --filter llamaindex build
pnpm link ../packages/core
```
Then run the examples with `ts-node`, for example `pnpx ts-node vectorIndex.ts`
-2
View File
@@ -4,8 +4,6 @@ import { Anthropic } from "llamaindex";
const anthropic = new Anthropic();
const result = await anthropic.chat([
{ content: "You want to talk in rhymes.", role: "system" },
{ content: "Hello, world!", role: "user" },
{ content: "Hello!", role: "assistant" },
{
content:
"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
+33
View File
@@ -0,0 +1,33 @@
import { ClipEmbedding, similarity, SimilarityType } from "llamaindex";
async function main() {
const clip = new ClipEmbedding();
// Get text embeddings
const text1 = "a car";
const textEmbedding1 = await clip.getTextEmbedding(text1);
const text2 = "a football match";
const textEmbedding2 = await clip.getTextEmbedding(text2);
// Get image embedding
const image =
"https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/football-match.jpg";
const imageEmbedding = await clip.getImageEmbedding(image);
// Calc similarity
const sim1 = similarity(
textEmbedding1,
imageEmbedding,
SimilarityType.DEFAULT,
);
const sim2 = similarity(
textEmbedding2,
imageEmbedding,
SimilarityType.DEFAULT,
);
console.log(`Similarity between "${text1}" and the image is ${sim1}`);
console.log(`Similarity between "${text2}" and the image is ${sim2}`);
}
main();
-47
View File
@@ -1,47 +0,0 @@
import { ChatMessage, SimpleChatEngine } from "llamaindex";
import { stdin as input, stdout as output } from "node:process";
import readline from "node:readline/promises";
import { Anthropic } from "../../packages/core/src/llm/LLM";
async function main() {
const query: string = `
Where is Istanbul?
`;
// const llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0.1 });
const llm = new Anthropic();
const message: ChatMessage = { content: query, role: "user" };
//TODO: Add callbacks later
//Stream Complete
//Note: Setting streaming flag to true or false will auto-set your return type to
//either an AsyncGenerator or a Response.
// Omitting the streaming flag automatically sets streaming to false
const chatEngine: SimpleChatEngine = new SimpleChatEngine({
chatHistory: undefined,
llm: llm,
});
const rl = readline.createInterface({ input, output });
while (true) {
const query = await rl.question("Query: ");
if (!query) {
break;
}
//Case 1: .chat(query, undefined, true) => Stream
//Case 2: .chat(query, undefined, false) => Response object
//Case 3: .chat(query, undefined) => Response object
const chatStream = await chatEngine.chat(query, undefined, true);
var accumulated_result = "";
for await (const part of chatStream) {
accumulated_result += part;
process.stdout.write(part);
}
}
}
main();
+5 -1
View File
@@ -3,10 +3,14 @@
"private": true,
"name": "simple",
"dependencies": {
"@notionhq/client": "^2.2.13",
"@pinecone-database/pinecone": "^1.1.2",
"commander": "^11.1.0",
"llamaindex": "latest"
},
"devDependencies": {
"@types/node": "^18"
"@types/node": "^18.18.6",
"ts-node": "^10.9.1"
},
"scripts": {
"lint": "eslint ."
+33
View File
@@ -0,0 +1,33 @@
# Postgres Vector Store
There are two scripts available here: load-docs.ts and query.ts
## Prerequisites
You'll need a postgres database instance against which to run these scripts. A simple docker command would look like this:
> `docker run -d --rm --name vector-db -p 5432:5432 -e "POSTGRES_HOST_AUTH_METHOD=trust" ankane/pgvector`
Set the PGHOST and PGUSER (and PGPASSWORD) environment variables to match your database setup.
You'll also need a value for OPENAI_API_KEY in your environment.
**NOTE:** Using `--rm` in the example docker command above means that the vector store will be deleted every time the container is stopped. For production purposes, use a volume to ensure persistence across restarts.
## Setup and Loading Docs
Read and follow the instructions in the README.md file located one directory up to make sure your JS/TS dependencies are set up. The commands listed below are also run from that parent directory.
To import documents and save the embedding vectors to your database:
> `npx ts-node pg-vector-store/load-docs.ts data`
where data is the directory containing your input files. Using the _data_ directory in the example above will read all of the files in that directory using the llamaindexTS default readers for each file type.
## RAG Querying
To query using the resulting vector store:
> `npx ts-node pg-vector-store/query.ts`
The script will prompt for a question, then process and present the answer using the PGVectorStore data and your OpenAI API key. It will continue to prompt until you enter `q`, `quit` or `exit` as the next query.
+68
View File
@@ -0,0 +1,68 @@
// load-docs.ts
import fs from "fs/promises";
import {
SimpleDirectoryReader,
storageContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
import { PGVectorStore } from "../../../packages/core/src/storage/vectorStore/PGVectorStore";
async function getSourceFilenames(sourceDir: string) {
return await fs
.readdir(sourceDir)
.then((fileNames) => fileNames.map((file) => sourceDir + "/" + file));
}
function callback(
category: string,
name: string,
status: any,
message: string = "",
): boolean {
console.log(category, name, status, message);
return true;
}
async function main(args: any) {
const sourceDir: string = args.length > 2 ? args[2] : "../data";
console.log(`Finding documents in ${sourceDir}`);
const fileList = await getSourceFilenames(sourceDir);
const count = fileList.length;
console.log(`Found ${count} files`);
console.log(`Importing contents from ${count} files in ${sourceDir}`);
var fileName = "";
try {
// Passing callback fn to the ctor here
// will enable looging to console.
// See callback fn, defined above.
const rdr = new SimpleDirectoryReader(callback);
const docs = await rdr.loadData({ directoryPath: sourceDir });
const pgvs = new PGVectorStore();
pgvs.setCollection(sourceDir);
pgvs.clearCollection();
const ctx = await storageContextFromDefaults({ vectorStore: pgvs });
console.debug(" - creating vector store");
const index = await VectorStoreIndex.fromDocuments(docs, {
storageContext: ctx,
});
console.debug(" - done.");
} catch (err) {
console.error(fileName, err);
console.log(
"If your PGVectorStore init failed, make sure to set env vars for PGUSER or USER, PGHOST, PGPORT and PGPASSWORD as needed.",
);
process.exit(1);
}
console.log(
"Done. Try running query.ts to ask questions against the imported embeddings.",
);
process.exit(0);
}
main(process.argv).catch((err) => console.error(err));
+67
View File
@@ -0,0 +1,67 @@
import { VectorStoreIndex } from "../../../packages/core/src/indices/vectorStore/VectorStoreIndex";
import { serviceContextFromDefaults } from "../../../packages/core/src/ServiceContext";
import { PGVectorStore } from "../../../packages/core/src/storage/vectorStore/PGVectorStore";
async function main() {
const readline = require("readline").createInterface({
input: process.stdin,
output: process.stdout,
});
try {
const pgvs = new PGVectorStore();
// Optional - set your collection name, default is no filter on this field.
// pgvs.setCollection();
const ctx = serviceContextFromDefaults();
const index = await VectorStoreIndex.fromVectorStore(pgvs, ctx);
// Query the index
const queryEngine = await index.asQueryEngine();
let question = "";
while (!isQuit(question)) {
question = await getUserInput(readline);
if (isQuit(question)) {
readline.close();
process.exit(0);
}
try {
const answer = await queryEngine.query(question);
console.log(answer.response);
} catch (error) {
console.error("Error:", error);
}
}
} catch (err) {
console.error(err);
console.log(
"If your PGVectorStore init failed, make sure to set env vars for PGUSER or USER, PGHOST, PGPORT and PGPASSWORD as needed.",
);
process.exit(1);
}
}
function isQuit(question: string) {
return ["q", "quit", "exit"].includes(question.trim().toLowerCase());
}
// Function to get user input as a promise
function getUserInput(readline: any): Promise<string> {
return new Promise((resolve) => {
readline.question(
"What would you like to know?\n>",
(userInput: string) => {
resolve(userInput);
},
);
});
}
main()
.catch(console.error)
.finally(() => {
process.exit(1);
});
+12 -1
View File
@@ -2,7 +2,10 @@ import fs from "node:fs/promises";
import {
Anthropic,
anthropicTextQaPrompt,
CompactAndRefine,
Document,
ResponseSynthesizer,
serviceContextFromDefaults,
VectorStoreIndex,
} from "llamaindex";
@@ -18,12 +21,20 @@ async function main() {
// Split text and create embeddings. Store them in a VectorStoreIndex
const serviceContext = serviceContextFromDefaults({ llm: new Anthropic() });
const responseSynthesizer = new ResponseSynthesizer({
responseBuilder: new CompactAndRefine(
serviceContext,
anthropicTextQaPrompt,
),
});
const index = await VectorStoreIndex.fromDocuments([document], {
serviceContext,
});
// Query the index
const queryEngine = index.asQueryEngine();
const queryEngine = index.asQueryEngine({ responseSynthesizer });
const response = await queryEngine.query(
"What did the author do in college?",
);
+2 -2
View File
@@ -13,8 +13,8 @@
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@turbo/gen": "^1.10.16",
"@types/jest": "^29.5.8",
"eslint": "^8.53.0",
"@types/jest": "^29.5.10",
"eslint": "^8.54.0",
"eslint-config-custom": "workspace:*",
"husky": "^8.0.3",
"jest": "^29.7.0",
+18 -1
View File
@@ -1,10 +1,27 @@
# llamaindex
## 0.0.37
### Patch Changes
- 3bab231: Fixed errors (#225 and #226) Thanks @marcusschiesser
## 0.0.36
### Patch Changes
- Support for Claude 2.1
- Add AssemblyAI integration (thanks @Swimburger)
- Use cryptoJS (thanks @marcusschiesser)
- Add PGVectorStore (thanks @mtutty)
- Add CLIP embeddings (thanks @marcusschiesser)
- Add MongoDB support (thanks @marcusschiesser)
## 0.0.35
### Patch Changes
- 63f2108: Add multimodal support (thanks Marcus)
- 63f2108: Add multimodal support (thanks @marcusschiesser)
## 0.0.34
+18 -12
View File
@@ -1,19 +1,23 @@
{
"name": "llamaindex",
"version": "0.0.35",
"version": "0.0.37",
"license": "MIT",
"dependencies": {
"@anthropic-ai/sdk": "^0.9.0",
"@anthropic-ai/sdk": "^0.9.1",
"@notionhq/client": "^2.2.13",
"js-tiktoken": "^1.0.7",
"@xenova/transformers": "^2.8.0",
"crypto-js": "^4.2.0",
"js-tiktoken": "^1.0.8",
"lodash": "^4.17.21",
"mammoth": "^1.6.0",
"md-utils-ts": "^2.0.0",
"mongodb": "^6.2.0",
"mongodb": "^6.3.0",
"notion-md-crawler": "^0.0.2",
"openai": "^4.16.1",
"openai": "^4.20.0",
"papaparse": "^5.4.1",
"pdf-parse": "^1.1.1",
"pg": "^8.11.3",
"pgvector": "^0.1.5",
"portkey-ai": "^0.1.16",
"rake-modified": "^1.0.8",
"replicate": "^0.21.1",
@@ -22,14 +26,16 @@
"wink-nlp": "^1.14.3"
},
"devDependencies": {
"@types/lodash": "^4.14.200",
"@types/node": "^18.18.8",
"@types/papaparse": "^5.3.10",
"@types/pdf-parse": "^1.1.3",
"@types/uuid": "^9.0.6",
"@types/crypto-js": "^4.2.1",
"@types/lodash": "^4.14.202",
"@types/node": "^18.18.12",
"@types/papaparse": "^5.3.13",
"@types/pdf-parse": "^1.1.4",
"@types/pg": "^8.10.7",
"@types/uuid": "^9.0.7",
"node-stdlib-browser": "^1.2.0",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
"typescript": "^5.3.2"
},
"engines": {
"node": ">=18.0.0"
@@ -44,4 +50,4 @@
"build": "tsup src/index.ts --format esm,cjs --dts",
"dev": "tsup src/index.ts --format esm,cjs --dts --watch"
}
}
}
+41 -20
View File
@@ -30,7 +30,7 @@ export interface ChatEngine {
T extends boolean | undefined = undefined,
R = T extends true ? AsyncGenerator<string, void, unknown> : Response,
>(
message: string,
message: MessageContent,
chatHistory?: ChatMessage[],
streaming?: T,
): Promise<R>;
@@ -56,7 +56,11 @@ export class SimpleChatEngine implements ChatEngine {
async chat<
T extends boolean | undefined = undefined,
R = T extends true ? AsyncGenerator<string, void, unknown> : Response,
>(message: string, chatHistory?: ChatMessage[], streaming?: T): Promise<R> {
>(
message: MessageContent,
chatHistory?: ChatMessage[],
streaming?: T,
): Promise<R> {
//Streaming option
if (streaming) {
return this.streamChat(message, chatHistory) as R;
@@ -72,7 +76,7 @@ export class SimpleChatEngine implements ChatEngine {
}
protected async *streamChat(
message: string,
message: MessageContent,
chatHistory?: ChatMessage[],
): AsyncGenerator<string, void, unknown> {
chatHistory = chatHistory ?? this.chatHistory;
@@ -144,14 +148,14 @@ export class CondenseQuestionChatEngine implements ChatEngine {
T extends boolean | undefined = undefined,
R = T extends true ? AsyncGenerator<string, void, unknown> : Response,
>(
message: string,
message: MessageContent,
chatHistory?: ChatMessage[] | undefined,
streaming?: T,
): Promise<R> {
chatHistory = chatHistory ?? this.chatHistory;
const condensedQuestion = (
await this.condenseQuestion(chatHistory, message)
await this.condenseQuestion(chatHistory, extractText(message))
).message.content;
const response = await this.queryEngine.query(condensedQuestion);
@@ -256,7 +260,7 @@ export class ContextChatEngine implements ChatEngine {
T extends boolean | undefined = undefined,
R = T extends true ? AsyncGenerator<string, void, unknown> : Response,
>(
message: string,
message: MessageContent,
chatHistory?: ChatMessage[] | undefined,
streaming?: T,
): Promise<R> {
@@ -272,7 +276,10 @@ export class ContextChatEngine implements ChatEngine {
type: "wrapper",
tags: ["final"],
};
const context = await this.contextGenerator.generate(message, parentEvent);
const context = await this.contextGenerator.generate(
extractText(message),
parentEvent,
);
chatHistory.push({ content: message, role: "user" });
@@ -291,7 +298,7 @@ export class ContextChatEngine implements ChatEngine {
}
protected async *streamChat(
message: string,
message: MessageContent,
chatHistory?: ChatMessage[] | undefined,
): AsyncGenerator<string, void, unknown> {
chatHistory = chatHistory ?? this.chatHistory;
@@ -301,7 +308,10 @@ export class ContextChatEngine implements ChatEngine {
type: "wrapper",
tags: ["final"],
};
const context = await this.contextGenerator.generate(message, parentEvent);
const context = await this.contextGenerator.generate(
extractText(message),
parentEvent,
);
chatHistory.push({ content: message, role: "user" });
@@ -330,8 +340,8 @@ export class ContextChatEngine implements ChatEngine {
export interface MessageContentDetail {
type: "text" | "image_url";
text: string;
image_url: { url: string };
text?: string;
image_url?: { url: string };
}
/**
@@ -339,6 +349,24 @@ export interface MessageContentDetail {
*/
export type MessageContent = string | MessageContentDetail[];
/**
* Extracts just the text from a multi-modal message or the message itself if it's just text.
*
* @param message The message to extract text from.
* @returns The extracted text
*/
function extractText(message: MessageContent): string {
if (Array.isArray(message)) {
// message is of type MessageContentDetail[] - retrieve just the text parts and concatenate them
// so we can pass them to the context generator
return (message as MessageContentDetail[])
.filter((c) => c.type === "text")
.map((c) => c.text)
.join("\n\n");
}
return message;
}
/**
* HistoryChatEngine is a ChatEngine that uses a `ChatHistory` object
* to keeps track of chat's message history.
@@ -413,15 +441,8 @@ export class HistoryChatEngine {
let requestMessages;
let context;
if (this.contextGenerator) {
if (Array.isArray(message)) {
// message is of type MessageContentDetail[] - retrieve just the text parts and concatenate them
// so we can pass them to the context generator
message = (message as MessageContentDetail[])
.filter((c) => c.type === "text")
.map((c) => c.text)
.join("\n\n");
}
context = await this.contextGenerator.generate(message);
const textOnly = extractText(message);
context = await this.contextGenerator.generate(textOnly);
}
requestMessages = await chatHistory.requestMessages(
context ? [context.message] : undefined,
+8 -7
View File
@@ -1,4 +1,4 @@
import crypto from "crypto"; // TODO Node dependency
import CryptoJS from "crypto-js";
import { v4 as uuidv4 } from "uuid";
export enum NodeRelationship {
@@ -175,13 +175,13 @@ export class TextNode<T extends Metadata = Metadata> extends BaseNode<T> {
* @returns
*/
generateHash() {
const hashFunction = crypto.createHash("sha256");
const hashFunction = CryptoJS.algo.SHA256.create();
hashFunction.update(`type=${this.getType()}`);
hashFunction.update(
`startCharIdx=${this.startCharIdx} endCharIdx=${this.endCharIdx}`,
);
hashFunction.update(this.getContent(MetadataMode.ALL));
return hashFunction.digest("base64");
return hashFunction.finalize().toString(CryptoJS.enc.Base64);
}
getType(): ObjectType {
@@ -272,12 +272,13 @@ export class Document<T extends Metadata = Metadata> extends TextNode<T> {
}
}
export function jsonToNode(json: any) {
if (!json.type) {
export function jsonToNode(json: any, type?: ObjectType) {
if (!json.type && !type) {
throw new Error("Node type not found");
}
const nodeType = type || json.type;
switch (json.type) {
switch (nodeType) {
case ObjectType.TEXT:
return new TextNode(json);
case ObjectType.INDEX:
@@ -285,7 +286,7 @@ export function jsonToNode(json: any) {
case ObjectType.DOCUMENT:
return new Document(json);
default:
throw new Error(`Invalid node type: ${json.type}`);
throw new Error(`Invalid node type: ${nodeType}`);
}
}
+9
View File
@@ -36,6 +36,15 @@ Answer:`;
export type TextQaPrompt = typeof defaultTextQaPrompt;
export const anthropicTextQaPrompt = ({ context = "", query = "" }) => {
return `Context information:
<context>
${context}
</context>
Given the context information and not prior knowledge, answer the query.
Query: ${query}`;
};
/*
DEFAULT_SUMMARY_PROMPT_TMPL = (
"Write a summary of the following. Try to use only the "
+2 -2
View File
@@ -1,4 +1,6 @@
import { v4 as uuidv4 } from "uuid";
import { Event } from "./callbacks/CallbackManager";
import { BaseNodePostprocessor } from "./indices/BaseNodePostprocessor";
import { NodeWithScore, TextNode } from "./Node";
import {
BaseQuestionGenerator,
@@ -10,8 +12,6 @@ import { CompactAndRefine, ResponseSynthesizer } from "./ResponseSynthesizer";
import { BaseRetriever } from "./Retriever";
import { ServiceContext, serviceContextFromDefaults } from "./ServiceContext";
import { QueryEngineTool, ToolMetadata } from "./Tool";
import { Event } from "./callbacks/CallbackManager";
import { BaseNodePostprocessor } from "./indices/BaseNodePostprocessor";
/**
* A query engine is a question answerer that can use one or more steps.
+3 -3
View File
@@ -1,8 +1,8 @@
import { BaseEmbedding, OpenAIEmbedding } from "./Embedding";
import { CallbackManager } from "./callbacks/CallbackManager";
import { BaseEmbedding, OpenAIEmbedding } from "./embeddings";
import { LLM, OpenAI } from "./llm/LLM";
import { NodeParser, SimpleNodeParser } from "./NodeParser";
import { PromptHelper } from "./PromptHelper";
import { CallbackManager } from "./callbacks/CallbackManager";
import { LLM, OpenAI } from "./llm/LLM";
/**
* The ServiceContext is a collection of components that are used in different parts of the application.
@@ -0,0 +1,78 @@
import { MultiModalEmbedding } from "./MultiModalEmbedding";
import { ImageType, readImage } from "./utils";
export enum ClipEmbeddingModelType {
XENOVA_CLIP_VIT_BASE_PATCH32 = "Xenova/clip-vit-base-patch32",
XENOVA_CLIP_VIT_BASE_PATCH16 = "Xenova/clip-vit-base-patch16",
}
export class ClipEmbedding extends MultiModalEmbedding {
modelType: ClipEmbeddingModelType =
ClipEmbeddingModelType.XENOVA_CLIP_VIT_BASE_PATCH16;
private tokenizer: any;
private processor: any;
private visionModel: any;
private textModel: any;
async getTokenizer() {
if (!this.tokenizer) {
const { AutoTokenizer } = await import("@xenova/transformers");
this.tokenizer = await AutoTokenizer.from_pretrained(this.modelType);
}
return this.tokenizer;
}
async getProcessor() {
if (!this.processor) {
const { AutoProcessor } = await import("@xenova/transformers");
this.processor = await AutoProcessor.from_pretrained(this.modelType);
}
return this.processor;
}
async getVisionModel() {
if (!this.visionModel) {
const { CLIPVisionModelWithProjection } = await import(
"@xenova/transformers"
);
this.visionModel = await CLIPVisionModelWithProjection.from_pretrained(
this.modelType,
);
}
return this.visionModel;
}
async getTextModel() {
if (!this.textModel) {
const { CLIPTextModelWithProjection } = await import(
"@xenova/transformers"
);
this.textModel = await CLIPTextModelWithProjection.from_pretrained(
this.modelType,
);
}
return this.textModel;
}
async getImageEmbedding(image: ImageType): Promise<number[]> {
const loadedImage = await readImage(image);
const imageInputs = await (await this.getProcessor())(loadedImage);
const { image_embeds } = await (await this.getVisionModel())(imageInputs);
return image_embeds.data;
}
async getTextEmbedding(text: string): Promise<number[]> {
const textInputs = await (
await this.getTokenizer()
)([text], { padding: true, truncation: true });
const { text_embeds } = await (await this.getTextModel())(textInputs);
return text_embeds.data;
}
async getQueryEmbedding(query: string): Promise<number[]> {
return this.getTextEmbedding(query);
}
}
@@ -0,0 +1,17 @@
import { BaseEmbedding } from "./types";
import { ImageType } from "./utils";
/*
* Base class for Multi Modal embeddings.
*/
export abstract class MultiModalEmbedding extends BaseEmbedding {
abstract getImageEmbedding(images: ImageType): Promise<number[]>;
async getImageEmbeddings(images: ImageType[]): Promise<number[][]> {
// Embed the input sequence of images asynchronously.
return Promise.all(
images.map((imgFilePath) => this.getImageEmbedding(imgFilePath)),
);
}
}
@@ -0,0 +1,92 @@
import { ClientOptions as OpenAIClientOptions } from "openai";
import {
AzureOpenAIConfig,
getAzureBaseUrl,
getAzureConfigFromEnv,
getAzureModel,
shouldUseAzure,
} from "../llm/azure";
import { OpenAISession, getOpenAISession } from "../llm/openai";
import { BaseEmbedding } from "./types";
export enum OpenAIEmbeddingModelType {
TEXT_EMBED_ADA_002 = "text-embedding-ada-002",
}
export class OpenAIEmbedding extends BaseEmbedding {
model: OpenAIEmbeddingModelType;
// OpenAI session params
apiKey?: string = undefined;
maxRetries: number;
timeout?: number;
additionalSessionOptions?: Omit<
Partial<OpenAIClientOptions>,
"apiKey" | "maxRetries" | "timeout"
>;
session: OpenAISession;
constructor(init?: Partial<OpenAIEmbedding> & { azure?: AzureOpenAIConfig }) {
super();
this.model = OpenAIEmbeddingModelType.TEXT_EMBED_ADA_002;
this.maxRetries = init?.maxRetries ?? 10;
this.timeout = init?.timeout ?? 60 * 1000; // Default is 60 seconds
this.additionalSessionOptions = init?.additionalSessionOptions;
if (init?.azure || shouldUseAzure()) {
const azureConfig = getAzureConfigFromEnv({
...init?.azure,
model: getAzureModel(this.model),
});
if (!azureConfig.apiKey) {
throw new Error(
"Azure API key is required for OpenAI Azure models. Please set the AZURE_OPENAI_KEY environment variable.",
);
}
this.apiKey = azureConfig.apiKey;
this.session =
init?.session ??
getOpenAISession({
azure: true,
apiKey: this.apiKey,
baseURL: getAzureBaseUrl(azureConfig),
maxRetries: this.maxRetries,
timeout: this.timeout,
defaultQuery: { "api-version": azureConfig.apiVersion },
...this.additionalSessionOptions,
});
} else {
this.apiKey = init?.apiKey ?? undefined;
this.session =
init?.session ??
getOpenAISession({
apiKey: this.apiKey,
maxRetries: this.maxRetries,
timeout: this.timeout,
...this.additionalSessionOptions,
});
}
}
private async getOpenAIEmbedding(input: string) {
const { data } = await this.session.openai.embeddings.create({
model: this.model,
input,
});
return data[0].embedding;
}
async getTextEmbedding(text: string): Promise<number[]> {
return this.getOpenAIEmbedding(text);
}
async getQueryEmbedding(query: string): Promise<number[]> {
return this.getOpenAIEmbedding(query);
}
}
+5
View File
@@ -0,0 +1,5 @@
export * from "./ClipEmbedding";
export * from "./MultiModalEmbedding";
export * from "./OpenAIEmbedding";
export * from "./types";
export * from "./utils";
+24
View File
@@ -0,0 +1,24 @@
import { similarity } from "./utils";
/**
* Similarity type
* Default is cosine similarity. Dot product and negative Euclidean distance are also supported.
*/
export enum SimilarityType {
DEFAULT = "cosine",
DOT_PRODUCT = "dot_product",
EUCLIDEAN = "euclidean",
}
export abstract class BaseEmbedding {
similarity(
embedding1: number[],
embedding2: number[],
mode: SimilarityType = SimilarityType.DEFAULT,
): number {
return similarity(embedding1, embedding2, mode);
}
abstract getTextEmbedding(text: string): Promise<number[]>;
abstract getQueryEmbedding(query: string): Promise<number[]>;
}
@@ -1,33 +1,16 @@
import { ClientOptions as OpenAIClientOptions } from "openai";
import { DEFAULT_SIMILARITY_TOP_K } from "./constants";
import {
AzureOpenAIConfig,
getAzureBaseUrl,
getAzureConfigFromEnv,
getAzureModel,
shouldUseAzure,
} from "./llm/azure";
import { OpenAISession, getOpenAISession } from "./llm/openai";
import { VectorStoreQueryMode } from "./storage/vectorStore/types";
/**
* Similarity type
* Default is cosine similarity. Dot product and negative Euclidean distance are also supported.
*/
export enum SimilarityType {
DEFAULT = "cosine",
DOT_PRODUCT = "dot_product",
EUCLIDEAN = "euclidean",
}
import _ from "lodash";
import { DEFAULT_SIMILARITY_TOP_K } from "../constants";
import { VectorStoreQueryMode } from "../storage";
import { SimilarityType } from "./types";
/**
* The similarity between two embeddings.
* @param embedding1
* @param embedding2
* @param mode
* @returns similartiy score with higher numbers meaning the two embeddings are more similar
* @returns similarity score with higher numbers meaning the two embeddings are more similar
*/
export function similarity(
embedding1: number[],
embedding2: number[],
@@ -42,7 +25,6 @@ export function similarity(
// will probably cause some avoidable loss of floating point precision
// ml-distance is worth watching although they currently also use the naive
// formulas
function norm(x: number[]): number {
let result = 0;
for (let i = 0; i < x.length; i++) {
@@ -201,98 +183,14 @@ export function getTopKMMREmbeddings(
return [resultSimilarities, resultIds];
}
export abstract class BaseEmbedding {
similarity(
embedding1: number[],
embedding2: number[],
mode: SimilarityType = SimilarityType.DEFAULT,
): number {
return similarity(embedding1, embedding2, mode);
}
abstract getTextEmbedding(text: string): Promise<number[]>;
abstract getQueryEmbedding(query: string): Promise<number[]>;
}
enum OpenAIEmbeddingModelType {
TEXT_EMBED_ADA_002 = "text-embedding-ada-002",
}
export class OpenAIEmbedding extends BaseEmbedding {
model: OpenAIEmbeddingModelType;
// OpenAI session params
apiKey?: string = undefined;
maxRetries: number;
timeout?: number;
additionalSessionOptions?: Omit<
Partial<OpenAIClientOptions>,
"apiKey" | "maxRetries" | "timeout"
>;
session: OpenAISession;
constructor(init?: Partial<OpenAIEmbedding> & { azure?: AzureOpenAIConfig }) {
super();
this.model = OpenAIEmbeddingModelType.TEXT_EMBED_ADA_002;
this.maxRetries = init?.maxRetries ?? 10;
this.timeout = init?.timeout ?? 60 * 1000; // Default is 60 seconds
this.additionalSessionOptions = init?.additionalSessionOptions;
if (init?.azure || shouldUseAzure()) {
const azureConfig = getAzureConfigFromEnv({
...init?.azure,
model: getAzureModel(this.model),
});
if (!azureConfig.apiKey) {
throw new Error(
"Azure API key is required for OpenAI Azure models. Please set the AZURE_OPENAI_KEY environment variable.",
);
}
this.apiKey = azureConfig.apiKey;
this.session =
init?.session ??
getOpenAISession({
azure: true,
apiKey: this.apiKey,
baseURL: getAzureBaseUrl(azureConfig),
maxRetries: this.maxRetries,
timeout: this.timeout,
defaultQuery: { "api-version": azureConfig.apiVersion },
...this.additionalSessionOptions,
});
} else {
this.apiKey = init?.apiKey ?? undefined;
this.session =
init?.session ??
getOpenAISession({
apiKey: this.apiKey,
maxRetries: this.maxRetries,
timeout: this.timeout,
...this.additionalSessionOptions,
});
}
}
private async getOpenAIEmbedding(input: string) {
const { data } = await this.session.openai.embeddings.create({
model: this.model,
input,
});
return data[0].embedding;
}
async getTextEmbedding(text: string): Promise<number[]> {
return this.getOpenAIEmbedding(text);
}
async getQueryEmbedding(query: string): Promise<number[]> {
return this.getOpenAIEmbedding(query);
export async function readImage(input: ImageType) {
const { RawImage } = await import("@xenova/transformers");
if (input instanceof Blob) {
return await RawImage.fromBlob(input);
} else if (_.isString(input) || input instanceof URL) {
return await RawImage.fromURL(input);
} else {
throw new Error(`Unsupported input type: ${typeof input}`);
}
}
export type ImageType = string | Blob | URL;
+2 -1
View File
@@ -1,6 +1,5 @@
export * from "./ChatEngine";
export * from "./ChatHistory";
export * from "./Embedding";
export * from "./GlobalsHelper";
export * from "./Node";
export * from "./NodeParser";
@@ -17,6 +16,7 @@ export * from "./TextSplitter";
export * from "./Tool";
export * from "./callbacks/CallbackManager";
export * from "./constants";
export * from "./embeddings";
export * from "./indices";
export * from "./llm/LLM";
export * from "./readers/CSVReader";
@@ -25,5 +25,6 @@ export * from "./readers/MarkdownReader";
export * from "./readers/NotionReader";
export * from "./readers/PDFReader";
export * from "./readers/SimpleDirectoryReader";
export * from "./readers/SimpleMongoReader";
export * from "./readers/base";
export * from "./storage";
@@ -10,11 +10,11 @@ import {
ServiceContext,
serviceContextFromDefaults,
} from "../../ServiceContext";
import { BaseDocumentStore, RefDocInfo } from "../../storage/docStore/types";
import {
StorageContext,
storageContextFromDefaults,
} from "../../storage/StorageContext";
import { BaseDocumentStore, RefDocInfo } from "../../storage/docStore/types";
import {
BaseIndex,
BaseIndexInit,
+8 -5
View File
@@ -639,7 +639,7 @@ If a question does not make any sense, or is not factually coherent, explain why
export const ALL_AVAILABLE_ANTHROPIC_MODELS = {
// both models have 100k context window, see https://docs.anthropic.com/claude/reference/selecting-a-model
"claude-2": { contextWindow: 100000 },
"claude-2": { contextWindow: 200000 },
"claude-instant-1": { contextWindow: 100000 },
};
@@ -705,10 +705,12 @@ export class Anthropic implements LLM {
return (
acc +
`${
message.role === "assistant"
? ANTHROPIC_AI_PROMPT
: ANTHROPIC_HUMAN_PROMPT
} ${message.content} `
message.role === "system"
? ""
: message.role === "assistant"
? ANTHROPIC_AI_PROMPT + " "
: ANTHROPIC_HUMAN_PROMPT + " "
}${message.content.trim()}`
);
}, "") + ANTHROPIC_AI_PROMPT
);
@@ -729,6 +731,7 @@ export class Anthropic implements LLM {
}
return this.streamChat(messages, parentEvent) as R;
}
//Non-streaming
const response = await this.session.anthropic.completions.create({
model: this.model,
+1 -1
View File
@@ -1,7 +1,7 @@
import mammoth from "mammoth";
import { Document } from "../Node";
import { GenericFileSystem } from "../storage/FileSystem";
import { DEFAULT_FS } from "../storage/constants";
import { GenericFileSystem } from "../storage/FileSystem";
import { BaseReader } from "./base";
export class DocxReader implements BaseReader {
+62 -31
View File
@@ -1,5 +1,5 @@
import { MongoClient } from "mongodb";
import { Document } from "../Node";
import { Document, Metadata } from "../Node";
import { BaseReader } from "./base";
/**
@@ -13,39 +13,70 @@ export class SimpleMongoReader implements BaseReader {
}
/**
* Loads data from MongoDB collection
* @param {string} db_name - The name of the database to load.
* @param {string} collection_name - The name of the collection to load.
* @param {Number} [max_docs = 0] - Maximum number of documents to return. 0 means no limit.
* @param {Record<string, any>} [query_dict={}] - Specific query, as specified by MongoDB NodeJS documentation.
* @param {Record<string, any>} [query_options={}] - Specific query options, as specified by MongoDB NodeJS documentation.
* @param {Record<string, any>} [projection = {}] - Projection options, as specified by MongoDB NodeJS documentation.
* @returns {Promise<Document[]>}
* Flattens an array of strings or string arrays into a single-dimensional array of strings.
* @param texts - The array of strings or string arrays to flatten.
* @returns The flattened array of strings.
*/
async loadData(
db_name: string,
collection_name: string,
max_docs = 0,
//For later: Think about whether we want to pass generic objects in...
query_dict: Record<string, any> = {},
query_options: Record<string, any> = {},
projection: Record<string, any> = {},
): Promise<Document[]> {
//Get items from collection using built-in functions
const cursor: Partial<Document>[] = await this.client
.db(db_name)
.collection(collection_name)
.find(query_dict, query_options)
.limit(max_docs)
.project(projection)
.toArray();
private flatten(texts: Array<string | string[]>): string[] {
return texts.reduce<string[]>(
(result, text) => result.concat(text instanceof Array ? text : [text]),
[],
);
}
/**
* Loads data from MongoDB collection
* @param {string} dbName - The name of the database to load.
* @param {string} collectionName - The name of the collection to load.
* @param {string[]} fieldNames - An array of field names to retrieve from each document. Defaults to ["text"].
* @param {string} separator - The separator to join multiple field values. Defaults to an empty string.
* @param {Record<string, any>} filterQuery - Specific query, as specified by MongoDB NodeJS documentation.
* @param {Number} maxDocs - The maximum number of documents to retrieve. Defaults to 0 (retrieve all documents).
* @param {string[]} metadataNames - An optional array of metadata field names. If specified extracts this information as metadata.
* @returns {Promise<Document[]>}
* @throws If a field specified in fieldNames or metadataNames is not found in a MongoDB document.
*/
public async loadData(
dbName: string,
collectionName: string,
fieldNames: string[] = ["text"],
separator: string = "",
filterQuery: Record<string, any> = {},
maxDocs: number = 0,
metadataNames?: string[],
): Promise<Document[]> {
const db = this.client.db(dbName);
// Get items from collection
const cursor = db
.collection(collectionName)
.find(filterQuery)
.limit(maxDocs);
//Aggregate results and return
const documents: Document[] = [];
cursor.forEach((element: Partial<Document>) => {
//For later: Metadata filtering
documents.push(new Document({ text: JSON.stringify(element) }));
});
for await (const item of cursor) {
try {
const texts: Array<string | string[]> = fieldNames.map(
(name) => item[name],
);
const flattenedTexts = this.flatten(texts);
const text = flattenedTexts.join(separator);
let metadata: Metadata = {};
if (metadataNames) {
// extract metadata if fields are specified
metadata = Object.fromEntries(
metadataNames.map((name) => [name, item[name]]),
);
}
documents.push(new Document({ text, metadata }));
} catch (err) {
throw new Error(
`Field not found in Mongo document: ${(err as Error).message}`,
);
}
}
return documents;
}
}
+1
View File
@@ -7,5 +7,6 @@ export { SimpleIndexStore } from "./indexStore/SimpleIndexStore";
export * from "./indexStore/types";
export { SimpleKVStore } from "./kvStore/SimpleKVStore";
export * from "./kvStore/types";
export { MongoDBAtlasVectorSearch } from "./vectorStore/MongoDBAtlasVectorStore";
export { SimpleVectorStore } from "./vectorStore/SimpleVectorStore";
export * from "./vectorStore/types";
@@ -0,0 +1,164 @@
import { BulkWriteOptions, Collection, MongoClient } from "mongodb";
import { BaseNode, MetadataMode } from "../../Node";
import {
MetadataFilters,
VectorStore,
VectorStoreQuery,
VectorStoreQueryResult,
} from "./types";
import { metadataDictToNode, nodeToMetadata } from "./utils";
// Utility function to convert metadata filters to MongoDB filter
function toMongoDBFilter(
standardFilters: MetadataFilters,
): Record<string, any> {
const filters: Record<string, any> = {};
for (const filter of standardFilters.filters) {
filters[filter.key] = filter.value;
}
return filters;
}
// MongoDB Atlas Vector Store class implementing VectorStore
export class MongoDBAtlasVectorSearch implements VectorStore {
storesText: boolean = true;
flatMetadata: boolean = true;
mongodbClient: MongoClient;
indexName: string;
embeddingKey: string;
idKey: string;
textKey: string;
metadataKey: string;
insertOptions?: BulkWriteOptions;
private collection: Collection;
constructor(
init: Partial<MongoDBAtlasVectorSearch> & {
dbName: string;
collectionName: string;
},
) {
if (init.mongodbClient) {
this.mongodbClient = init.mongodbClient;
} else {
const mongoUri = process.env.MONGODB_URI;
if (!mongoUri) {
throw new Error(
"Must specify MONGODB_URI via env variable if not directly passing in client.",
);
}
this.mongodbClient = new MongoClient(mongoUri);
}
this.collection = this.mongodbClient
.db(init.dbName ?? "default_db")
.collection(init.collectionName ?? "default_collection");
this.indexName = init.indexName ?? "default";
this.embeddingKey = init.embeddingKey ?? "embedding";
this.idKey = init.idKey ?? "id";
this.textKey = init.textKey ?? "text";
this.metadataKey = init.metadataKey ?? "metadata";
this.insertOptions = init.insertOptions;
}
async add(nodes: BaseNode[]): Promise<string[]> {
if (!nodes || nodes.length === 0) {
return [];
}
const dataToInsert = nodes.map((node) => {
const metadata = nodeToMetadata(
node,
true,
this.textKey,
this.flatMetadata,
);
return {
[this.idKey]: node.id_,
[this.embeddingKey]: node.getEmbedding(),
[this.textKey]: node.getContent(MetadataMode.NONE) || "",
[this.metadataKey]: metadata,
};
});
console.debug("Inserting data into MongoDB: ", dataToInsert);
const insertResult = await this.collection.insertMany(
dataToInsert,
this.insertOptions,
);
console.debug("Result of insert: ", insertResult);
return nodes.map((node) => node.id_);
}
async delete(refDocId: string, deleteOptions?: any): Promise<void> {
await this.collection.deleteOne(
{
[`${this.metadataKey}.ref_doc_id`]: refDocId,
},
deleteOptions,
);
}
get client(): any {
return this.mongodbClient;
}
async query(
query: VectorStoreQuery,
options?: any,
): Promise<VectorStoreQueryResult> {
const params: any = {
queryVector: query.queryEmbedding,
path: this.embeddingKey,
numCandidates: query.similarityTopK * 10,
limit: query.similarityTopK,
index: this.indexName,
};
if (query.filters) {
params.filter = toMongoDBFilter(query.filters);
}
const queryField = { $vectorSearch: params };
const pipeline = [
queryField,
{
$project: {
score: { $meta: "vectorSearchScore" },
[this.embeddingKey]: 0,
},
},
];
console.debug("Running query pipeline: ", pipeline);
const cursor = await this.collection.aggregate(pipeline);
const nodes: BaseNode[] = [];
const ids: string[] = [];
const similarities: number[] = [];
for await (const res of await cursor) {
const text = res[this.textKey];
const score = res.score;
const id = res[this.idKey];
const metadata = res[this.metadataKey];
const node = metadataDictToNode(metadata);
node.setContent(text);
ids.push(id);
nodes.push(node);
similarities.push(score);
}
const result = {
nodes,
similarities,
ids,
};
console.debug("Result of query (ids):", ids);
return result;
}
}
@@ -0,0 +1,275 @@
import pg from "pg";
import pgvector from "pgvector/pg";
import { VectorStore, VectorStoreQuery, VectorStoreQueryResult } from "./types";
import { BaseNode, Document, Metadata, MetadataMode } from "../../Node";
import { GenericFileSystem } from "../FileSystem";
export const PGVECTOR_SCHEMA = "public";
export const PGVECTOR_TABLE = "llamaindex_embedding";
/**
* Provides support for writing and querying vector data in Postgres.
*/
export class PGVectorStore implements VectorStore {
storesText: boolean = true;
private collection: string = "";
/*
FROM pg LIBRARY:
type Config = {
user?: string, // default process.env.PGUSER || process.env.USER
password?: string or function, //default process.env.PGPASSWORD
host?: string, // default process.env.PGHOST
database?: string, // default process.env.PGDATABASE || user
port?: number, // default process.env.PGPORT
connectionString?: string, // e.g. postgres://user:password@host:5432/database
ssl?: any, // passed directly to node.TLSSocket, supports all tls.connect options
types?: any, // custom type parsers
statement_timeout?: number, // number of milliseconds before a statement in query will time out, default is no timeout
query_timeout?: number, // number of milliseconds before a query call will timeout, default is no timeout
application_name?: string, // The name of the application that created this Client instance
connectionTimeoutMillis?: number, // number of milliseconds to wait for connection, default is no timeout
idle_in_transaction_session_timeout?: number // number of milliseconds before terminating any session with an open idle transaction, default is no timeout
}
*/
db?: pg.Client;
constructor() {}
/**
* Setter for the collection property.
* Using a collection allows for simple segregation of vector data,
* e.g. by user, source, or access-level.
* Leave/set blank to ignore the collection value when querying.
* @param coll Name for the collection.
*/
setCollection(coll: string) {
this.collection = coll;
}
/**
* Getter for the collection property.
* Using a collection allows for simple segregation of vector data,
* e.g. by user, source, or access-level.
* Leave/set blank to ignore the collection value when querying.
* @returns The currently-set collection value. Default is empty string.
*/
getCollection(): string {
return this.collection;
}
private async getDb(): Promise<pg.Client> {
if (!this.db) {
try {
// Create DB connection
// Read connection params from env - see comment block above
const db = new pg.Client();
await db.connect();
// Check vector extension
db.query("CREATE EXTENSION IF NOT EXISTS vector");
await pgvector.registerType(db);
// Check schema, table(s), index(es)
await this.checkSchema(db);
// All good? Keep the connection reference
this.db = db;
} catch (err: any) {
console.error(err);
return Promise.reject(err);
}
}
return Promise.resolve(this.db);
}
private async checkSchema(db: pg.Client) {
await db.query(`CREATE SCHEMA IF NOT EXISTS ${PGVECTOR_SCHEMA}`);
const tbl = `CREATE TABLE IF NOT EXISTS ${PGVECTOR_SCHEMA}.${PGVECTOR_TABLE}(
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
external_id VARCHAR,
collection VARCHAR,
document TEXT,
metadata JSONB DEFAULT '{}',
embeddings VECTOR(1536)
)`;
await db.query(tbl);
const idxs = `CREATE INDEX IF NOT EXISTS idx_${PGVECTOR_TABLE}_external_id ON ${PGVECTOR_SCHEMA}.${PGVECTOR_TABLE} (external_id);
CREATE INDEX IF NOT EXISTS idx_${PGVECTOR_TABLE}_collection ON ${PGVECTOR_SCHEMA}.${PGVECTOR_TABLE} (collection);`;
await db.query(idxs);
// TODO add IVFFlat or HNSW indexing?
return db;
}
// isEmbeddingQuery?: boolean | undefined;
/**
* Connects to the database specified in environment vars.
* This method also checks and creates the vector extension,
* the destination table and indexes if not found.
* @returns A connection to the database, or the error encountered while connecting/setting up.
*/
client() {
return this.getDb();
}
/**
* Delete all vector records for the specified collection.
* NOTE: Uses the collection property controlled by setCollection/getCollection.
* @returns The result of the delete query.
*/
async clearCollection() {
const sql: string = `DELETE FROM ${PGVECTOR_SCHEMA}.${PGVECTOR_TABLE}
WHERE collection = $1`;
const db = (await this.getDb()) as pg.Client;
const ret = await db.query(sql, [this.collection]);
return ret;
}
/**
* Adds vector record(s) to the table.
* NOTE: Uses the collection property controlled by setCollection/getCollection.
* @param embeddingResults The Nodes to be inserted, optionally including metadata tuples.
* @returns A list of zero or more id values for the created records.
*/
async add(embeddingResults: BaseNode<Metadata>[]): Promise<string[]> {
if (embeddingResults.length == 0) {
console.debug("Empty list sent to PGVectorStore::add");
return Promise.resolve([]);
}
const sql: string = `INSERT INTO ${PGVECTOR_SCHEMA}.${PGVECTOR_TABLE}
(id, external_id, collection, document, metadata, embeddings)
VALUES ($1, $2, $3, $4, $5, $6)`;
const db = (await this.getDb()) as pg.Client;
let ret: string[] = [];
for (let index = 0; index < embeddingResults.length; index++) {
const row = embeddingResults[index];
let id: any = row.id_.length ? row.id_ : null;
let meta = row.metadata || {};
meta.create_date = new Date();
const params = [
id,
"",
this.collection,
row.getContent(MetadataMode.EMBED),
meta,
"[" + row.getEmbedding().join(",") + "]",
];
try {
const result = await db.query(sql, params);
if (result.rows.length) {
id = result.rows[0].id as string;
ret.push(id);
}
} catch (err) {
const msg = `${err}`;
console.log(msg, err);
}
}
return Promise.resolve(ret);
}
/**
* Deletes a single record from the database by id.
* NOTE: Uses the collection property controlled by setCollection/getCollection.
* @param refDocId Unique identifier for the record to delete.
* @param deleteKwargs Required by VectorStore interface. Currently ignored.
* @returns Promise that resolves if the delete query did not throw an error.
*/
async delete(refDocId: string, deleteKwargs?: any): Promise<void> {
const collectionCriteria = this.collection.length
? "AND collection = $2"
: "";
const sql: string = `DELETE FROM ${PGVECTOR_SCHEMA}.${PGVECTOR_TABLE}
WHERE id = $1 ${collectionCriteria}`;
const db = (await this.getDb()) as pg.Client;
const params = this.collection.length
? [refDocId, this.collection]
: [refDocId];
await db.query(sql, params);
return Promise.resolve();
}
/**
* Query the vector store for the closest matching data to the query embeddings
* @param query The VectorStoreQuery to be used
* @param options Required by VectorStore interface. Currently ignored.
* @returns Zero or more Document instances with data from the vector store.
*/
async query(
query: VectorStoreQuery,
options?: any,
): Promise<VectorStoreQueryResult> {
// TODO QUERY TYPES:
// Distance: SELECT embedding <-> $1 AS distance FROM items;
// Inner Product: SELECT (embedding <#> $1) * -1 AS inner_product FROM items;
// Cosine Sim: SELECT 1 - (embedding <=> $1) AS cosine_similarity FROM items;
const embedding = "[" + query.queryEmbedding?.join(",") + "]";
const max = query.similarityTopK ?? 2;
const where = this.collection.length ? "WHERE collection = $2" : "";
// TODO Add collection filter if set
const sql = `SELECT
v.*,
embeddings <-> $1 s
FROM ${PGVECTOR_SCHEMA}.${PGVECTOR_TABLE} v
${where}
ORDER BY s
LIMIT ${max}
`;
const db = (await this.getDb()) as pg.Client;
const params = this.collection.length
? [embedding, this.collection]
: [embedding];
const results = await db.query(sql, params);
const nodes = results.rows.map((row) => {
return new Document({
id_: row.id,
text: row.document,
metadata: row.metadata,
embedding: row.embeddings,
});
});
const ret = {
nodes: nodes,
similarities: results.rows.map((row) => row.s),
ids: results.rows.map((row) => row.id),
};
return Promise.resolve(ret);
}
/**
* Required by VectorStore interface. Currently ignored.
* @param persistPath
* @param fs
* @returns Resolved Promise.
*/
persist(
persistPath: string,
fs?: GenericFileSystem | undefined,
): Promise<void> {
return Promise.resolve();
}
}
@@ -1,11 +1,11 @@
import _ from "lodash";
import * as path from "path";
import { BaseNode } from "../../Node";
import {
getTopKEmbeddings,
getTopKEmbeddingsLearner,
getTopKMMREmbeddings,
} from "../../Embedding";
import { BaseNode } from "../../Node";
} from "../../embeddings";
import { GenericFileSystem, exists } from "../FileSystem";
import { DEFAULT_FS, DEFAULT_PERSIST_DIR } from "../constants";
import {
@@ -1,5 +1,4 @@
import { BaseNode } from "../../Node";
import { GenericFileSystem } from "../FileSystem";
export interface VectorStoreQueryResult {
nodes?: BaseNode[];
@@ -62,10 +61,9 @@ export interface VectorStore {
isEmbeddingQuery?: boolean;
client(): any;
add(embeddingResults: BaseNode[]): Promise<string[]>;
delete(refDocId: string, deleteKwargs?: any): Promise<void>;
delete(refDocId: string, deleteOptions?: any): Promise<void>;
query(
query: VectorStoreQuery,
options?: any,
): Promise<VectorStoreQueryResult>;
persist(persistPath: string, fs?: GenericFileSystem): Promise<void>;
}
@@ -0,0 +1,59 @@
import { BaseNode, jsonToNode, Metadata, ObjectType } from "../../Node";
const DEFAULT_TEXT_KEY = "text";
export function validateIsFlat(obj: { [key: string]: any }): void {
for (let key in obj) {
if (typeof obj[key] === "object" && obj[key] !== null) {
throw new Error(`Value for metadata ${key} must not be another object`);
}
}
}
export function nodeToMetadata(
node: BaseNode,
removeText: boolean = false,
textField: string = DEFAULT_TEXT_KEY,
flatMetadata: boolean = false,
): Metadata {
const nodeObj = node.toJSON();
const metadata = node.metadata;
if (flatMetadata) {
validateIsFlat(node.metadata);
}
if (removeText) {
nodeObj[textField] = "";
}
nodeObj["embedding"] = null;
metadata["_node_content"] = JSON.stringify(nodeObj);
metadata["_node_type"] = node.constructor.name.replace("_", ""); // remove leading underscore to be compatible with Python
metadata["document_id"] = node.sourceNode?.nodeId || "None";
metadata["doc_id"] = node.sourceNode?.nodeId || "None";
metadata["ref_doc_id"] = node.sourceNode?.nodeId || "None";
return metadata;
}
export function metadataDictToNode(metadata: Metadata): BaseNode {
const nodeContent = metadata["_node_content"];
if (!nodeContent) {
throw new Error("Node content not found in metadata.");
}
const nodeObj = JSON.parse(nodeContent);
// Note: we're using the name of the class stored in `_node_type`
// and not the type attribute to reconstruct
// the node. This way we're compatible with LlamaIndex Python
const node_type = metadata["_node_type"];
switch (node_type) {
case "IndexNode":
return jsonToNode(nodeObj, ObjectType.INDEX);
default:
return jsonToNode(nodeObj, ObjectType.TEXT);
}
}
@@ -1,18 +1,18 @@
import { OpenAIEmbedding } from "../Embedding";
import {
CallbackManager,
RetrievalCallbackResponse,
StreamCallbackResponse,
} from "../callbacks/CallbackManager";
import { OpenAIEmbedding } from "../embeddings";
import { SummaryIndex } from "../indices/summary";
import { VectorStoreIndex } from "../indices/vectorStore/VectorStoreIndex";
import { OpenAI } from "../llm/LLM";
import { Document } from "../Node";
import {
ResponseSynthesizer,
SimpleResponseBuilder,
} from "../ResponseSynthesizer";
import { ServiceContext, serviceContextFromDefaults } from "../ServiceContext";
import {
CallbackManager,
RetrievalCallbackResponse,
StreamCallbackResponse,
} from "../callbacks/CallbackManager";
import { SummaryIndex } from "../indices/summary";
import { VectorStoreIndex } from "../indices/vectorStore/VectorStoreIndex";
import { OpenAI } from "../llm/LLM";
import { mockEmbeddingModel, mockLlmGeneration } from "./utility/mockOpenAI";
// Mock the OpenAI getOpenAISession function during testing
+1 -1
View File
@@ -1,4 +1,4 @@
import { SimilarityType, similarity } from "../Embedding";
import { similarity, SimilarityType } from "../embeddings";
describe("similarity", () => {
test("throws error on mismatched lengths", () => {
+15
View File
@@ -0,0 +1,15 @@
import { TextNode } from "../Node";
describe("TextNode", () => {
let node: TextNode;
beforeEach(() => {
node = new TextNode({ text: "Hello World" });
});
describe("generateHash", () => {
it("should generate a hash", () => {
expect(node.hash).toBe("nTSKdUTYqR52MPv/brvb4RTGeqedTEqG9QN8KSAj2Do=");
});
});
});
@@ -1,6 +1,6 @@
import { OpenAIEmbedding } from "../../Embedding";
import { globalsHelper } from "../../GlobalsHelper";
import { CallbackManager, Event } from "../../callbacks/CallbackManager";
import { OpenAIEmbedding } from "../../embeddings";
import { globalsHelper } from "../../GlobalsHelper";
import { ChatMessage, OpenAI } from "../../llm/LLM";
export function mockLlmGeneration({
-1
View File
@@ -1 +0,0 @@
+28 -4
View File
@@ -1,10 +1,34 @@
# create-llama
## 0.0.10
### Patch Changes
- Bugfixes (thanks @marcusschiesser)
## 0.0.9
### Patch Changes
- acfe232: Deployment fixes (thanks @seldo)
## 0.0.8
### Patch Changes
- 8cdb07f: Fix Next deployment (thanks @seldo and @marcusschiesser)
## 0.0.7
### Patch Changes
- 9f9f293: Added more to README and made it easier to switch models (thanks @seldo)
## 0.0.6
### Patch Changes
- 4431ec7: Label bug fix
- 4431ec7: Label bug fix (thanks @marcusschiesser)
## 0.0.5
@@ -16,16 +40,16 @@
### Patch Changes
- 031e926: Update create-llama readme (thanks Logan)
- 031e926: Update create-llama readme (thanks @logan-markewich)
## 0.0.3
### Patch Changes
- 91b42a3: change version (thanks Marcus)
- 91b42a3: change version (thanks @marcusschiesser)
## 0.0.2
### Patch Changes
- e2a6805: Hello Create Llama (thanks Marcus!)
- e2a6805: Hello Create Llama (thanks @marcusschiesser)
+6 -22
View File
@@ -67,7 +67,13 @@ You can also replace OpenAI with one of our [dozens of other supported LLMs](htt
The simplest thing to do is run `create-llama` in interactive mode:
```bash
npx create-llama@latest
# or
npm create llama@latest
# or
yarn create llama
# or
pnpm create llama@latest
```
You will be asked for the name of your project, along with other configuration options, something like this:
@@ -80,32 +86,10 @@ Ok to proceed? (y) y
✔ What is your project named? … my-app
✔ Which template would you like to use? Chat with streaming
✔ Which framework would you like to use? NextJS
✔ Which UI would you like to use? Shadcn
✔ Which chat engine would you like to use? SimpleChatEngine
✔ **Please provide your llm of choice (leave blank to skip): …**
✔ Please select a model Model1 / Model2 / Model3
✔ Please provide your API key (leave blank to skip): …
✔ Would you like to use ESLint? … No / Yes
✔ Which chat engine would you like to use? ContextChatEngine
✔ Please provide your OpenAI API key (leave blank to skip): …
✔ Would you like to use ESLint? … No / Yes
Creating a new LlamaIndex app in /home/my-app.
```
Here is an example:
```bash
>> npm create llama
Need to install the following packages:
create-llama@latest
Ok to proceed? (y) y
✔ What is your project named? … my-app
✔ Which template would you like to use? Chat with streaming
✔ Which framework would you like to use? NextJS
✔ Which UI would you like to use? Just HTML
✔ Which chat engine would you like to use? ContextChatEngine
✔ Please provide your OpenAI API key (leave blank to skip): …
✔ Would you like to use ESLint? … No / Yes
✔ Please select a model Model1 / Model2 / Model3
Creating a new LlamaIndex app in /home/my-app.
```
+12 -8
View File
@@ -12,6 +12,14 @@ import terminalLink from "terminal-link";
import type { InstallTemplateArgs } from "./templates";
import { installTemplate } from "./templates";
export type InstallAppArgs = Omit<
InstallTemplateArgs,
"appName" | "root" | "isOnline" | "customApiPath"
> & {
appPath: string;
frontend: boolean;
};
export async function createApp({
template,
framework,
@@ -22,13 +30,8 @@ export async function createApp({
eslint,
frontend,
openAIKey,
}: Omit<
InstallTemplateArgs,
"appName" | "root" | "isOnline" | "customApiPath"
> & {
appPath: string;
frontend: boolean;
}): Promise<void> {
model,
}: InstallAppArgs): Promise<void> {
const root = path.resolve(appPath);
if (!(await isWriteable(path.dirname(root)))) {
@@ -65,6 +68,7 @@ export async function createApp({
isOnline,
eslint,
openAIKey,
model,
};
if (frontend) {
@@ -88,7 +92,7 @@ export async function createApp({
path.join(root, "README.md"),
);
} else {
await installTemplate({ ...args, backend: true });
await installTemplate({ ...args, backend: true, forBackend: framework });
}
process.chdir(root);
+61 -30
View File
@@ -8,7 +8,7 @@ import path from "path";
import { blue, bold, cyan, green, red, yellow } from "picocolors";
import prompts from "prompts";
import checkForUpdate from "update-check";
import { createApp } from "./create-app";
import { InstallAppArgs, createApp } from "./create-app";
import { getPkgManager } from "./helpers/get-pkg-manager";
import { isFolderEmpty } from "./helpers/is-folder-empty";
import { validateNpmName } from "./helpers/validate-pkg";
@@ -155,21 +155,22 @@ async function run(): Promise<void> {
process.exit(1);
}
const preferences = (conf.get("preferences") || {}) as Record<
string,
boolean | string
>;
// TODO: use Args also for program
type Args = Omit<InstallAppArgs, "appPath" | "packageManager">;
const defaults: typeof preferences = {
template: "simple",
const preferences = (conf.get("preferences") || {}) as Args;
const defaults: Args = {
template: "streaming",
framework: "nextjs",
engine: "simple",
ui: "html",
eslint: true,
frontend: false,
openAIKey: "",
model: "gpt-3.5-turbo",
};
const getPrefOrDefault = (field: string) =>
const getPrefOrDefault = (field: keyof Args) =>
preferences[field] ?? defaults[field];
const handlers = {
@@ -179,28 +180,6 @@ async function run(): Promise<void> {
},
};
if (!program.template) {
if (ciInfo.isCI) {
program.template = getPrefOrDefault("template");
} else {
const { template } = await prompts(
{
type: "select",
name: "template",
message: "Which template would you like to use?",
choices: [
{ title: "Chat without streaming", value: "simple" },
{ title: "Chat with streaming", value: "streaming" },
],
initial: 1,
},
handlers,
);
program.template = template;
preferences.template = template;
}
}
if (!program.framework) {
if (ciInfo.isCI) {
program.framework = getPrefOrDefault("framework");
@@ -224,6 +203,31 @@ async function run(): Promise<void> {
}
}
if (program.framework === "nextjs") {
program.template = "streaming";
}
if (!program.template) {
if (ciInfo.isCI) {
program.template = getPrefOrDefault("template");
} else {
const { template } = await prompts(
{
type: "select",
name: "template",
message: "Which template would you like to use?",
choices: [
{ title: "Chat without streaming", value: "simple" },
{ title: "Chat with streaming", value: "streaming" },
],
initial: 1,
},
handlers,
);
program.template = template;
preferences.template = template;
}
}
if (program.framework === "express" || program.framework === "fastapi") {
// if a backend-only framework is selected, ask whether we should create a frontend
if (!program.frontend) {
@@ -277,6 +281,32 @@ async function run(): Promise<void> {
}
}
if (program.framework === "nextjs") {
if (!program.model) {
if (ciInfo.isCI) {
program.model = getPrefOrDefault("model");
} else {
const { model } = await prompts(
{
type: "select",
name: "model",
message: "Which model would you like to use?",
choices: [
{ title: "gpt-3.5-turbo", value: "gpt-3.5-turbo" },
{ title: "gpt-4", value: "gpt-4" },
{ title: "gpt-4-1106-preview", value: "gpt-4-1106-preview" },
{ title: "gpt-4-vision-preview", value: "gpt-4-vision-preview" },
],
initial: 0,
},
handlers,
);
program.model = model;
preferences.model = model;
}
}
}
if (program.framework === "express" || program.framework === "nextjs") {
if (!program.engine) {
if (ciInfo.isCI) {
@@ -350,6 +380,7 @@ async function run(): Promise<void> {
eslint: program.eslint,
frontend: program.frontend,
openAIKey: program.openAIKey,
model: program.model,
});
conf.set("preferences", preferences);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "create-llama",
"version": "0.0.6",
"version": "0.0.10",
"keywords": [
"rag",
"llamaindex",
@@ -16,8 +16,3 @@ To learn more about LlamaIndex, take a look at the following resources:
- [LlamaIndexTS Documentation](https://ts.llamaindex.ai) - learn about LlamaIndex (Typescript features).
You can check out [the LlamaIndexTS GitHub repository](https://github.com/run-llama/LlamaIndexTS) - your feedback and contributions are welcome!
+
+ ### Model Selection
+
+ When creating a new LlamaIndex app, you can select a model to use. The available models are Model1, Model2, and Model3. The selected model will be used in the generated code.
@@ -5,6 +5,8 @@ import {
VectorStoreIndex,
} from "llamaindex";
import * as dotenv from "dotenv";
import {
CHUNK_OVERLAP,
CHUNK_SIZE,
@@ -12,6 +14,9 @@ import {
STORAGE_DIR,
} from "./constants.mjs";
// Load environment variables from local .env file
dotenv.config();
async function getRuntime(func) {
const start = Date.now();
await func();
@@ -1,29 +1,84 @@
import { useState } from "react";
import { Button } from "../button";
import FileUploader from "../file-uploader";
import { Input } from "../input";
import UploadImagePreview from "../upload-image-preview";
import { ChatHandler } from "./chat.interface";
export default function ChatInput(
props: Pick<
ChatHandler,
"isLoading" | "handleSubmit" | "handleInputChange" | "input"
>,
| "isLoading"
| "input"
| "onFileUpload"
| "onFileError"
| "handleSubmit"
| "handleInputChange"
> & {
multiModal?: boolean;
},
) {
const [imageUrl, setImageUrl] = useState<string | null>(null);
const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {
if (imageUrl) {
props.handleSubmit(e, {
data: { imageUrl: imageUrl },
});
setImageUrl(null);
return;
}
props.handleSubmit(e);
};
const onRemovePreviewImage = () => setImageUrl(null);
const handleUploadImageFile = async (file: File) => {
const base64 = await new Promise<string>((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result as string);
reader.onerror = (error) => reject(error);
});
setImageUrl(base64);
};
const handleUploadFile = async (file: File) => {
try {
if (props.multiModal && file.type.startsWith("image/")) {
return await handleUploadImageFile(file);
}
props.onFileUpload?.(file);
} catch (error: any) {
props.onFileError?.(error.message);
}
};
return (
<form
onSubmit={props.handleSubmit}
className="flex w-full items-start justify-between gap-4 rounded-xl bg-white p-4 shadow-xl"
onSubmit={onSubmit}
className="rounded-xl bg-white p-4 shadow-xl space-y-4"
>
<Input
autoFocus
name="message"
placeholder="Type a message"
className="flex-1"
value={props.input}
onChange={props.handleInputChange}
/>
<Button type="submit" disabled={props.isLoading}>
Send message
</Button>
{imageUrl && (
<UploadImagePreview url={imageUrl} onRemove={onRemovePreviewImage} />
)}
<div className="flex w-full items-start justify-between gap-4 ">
<Input
autoFocus
name="message"
placeholder="Type a message"
className="flex-1"
value={props.input}
onChange={props.handleInputChange}
/>
<FileUploader
onFileUpload={handleUploadFile}
onFileError={props.onFileError}
/>
<Button type="submit" disabled={props.isLoading}>
Send message
</Button>
</div>
</form>
);
}
@@ -1,4 +1,5 @@
import { useEffect, useRef } from "react";
import { Loader2 } from "lucide-react";
import ChatActions from "./chat-actions";
import ChatMessage from "./chat-message";
@@ -24,6 +25,11 @@ export default function ChatMessages(
props.reload && !props.isLoading && isLastMessageFromAssistant;
const showStop = props.stop && props.isLoading;
// `isPending` indicate
// that stream response is not yet received from the server,
// so we show a loading indicator to give a better UX.
const isPending = props.isLoading && !isLastMessageFromAssistant;
useEffect(() => {
scrollToBottom();
}, [messageLength, lastMessage]);
@@ -37,6 +43,13 @@ export default function ChatMessages(
{props.messages.map((m) => (
<ChatMessage key={m.id} {...m} />
))}
{isPending && (
<div
className='flex justify-center items-center pt-10'
>
<Loader2 className="h-4 w-4 animate-spin"/>
</div>
)}
</div>
<div className="flex justify-end py-4">
<ChatActions
@@ -8,8 +8,15 @@ export interface ChatHandler {
messages: Message[];
input: string;
isLoading: boolean;
handleSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
handleSubmit: (
e: React.FormEvent<HTMLFormElement>,
ops?: {
data?: any;
},
) => void;
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
reload?: () => void;
stop?: () => void;
onFileUpload?: (file: File) => Promise<void>;
onFileError?: (errMsg: string) => void;
}

Some files were not shown because too many files have changed in this diff Show More