two methods
- randomly choose k obj from data and use a inital means
- randomly assign bucket to each obs
centroid becomes the new mean
- find mean location within cluster
- centroid algo
{ | |
"schema_version": "v1", | |
"name_for_human": "Commands API", | |
"name_for_model": "Commands API", | |
"description_for_human": "An API for managing and executing user commands in a chat-based social app.", | |
"description_for_model": "This API allows users to list and run commands.", | |
"auth": { | |
"type": "none" | |
}, | |
"api": { |
import fs from "fs"; | |
import axios from "axios"; | |
import { | |
CharacterTextSplitter, | |
Document, | |
EmbeddedDocument, | |
Embeddings, | |
HTMLLoader, | |
JSONParser, | |
OpenAI, |
import { injectVariables } from "@utils/inject-variables"; | |
import { NoopParser, Parser } from "@prompts/Parser"; | |
import { ExtractFormatObject } from "@utils/type-utils"; | |
import { ModelProviderType } from "dist"; | |
export type PromptVariables<T extends string> = ExtractFormatObject<T>; | |
export interface PromptConfiguration { | |
stop?: string[] | string | undefined; | |
temperature?: number | undefined; | |
maxTokens?: number | undefined; |
import axios from "axios"; | |
import { NextApiRequest, NextApiResponse } from "next"; | |
export default async function handler( | |
req: NextApiRequest, | |
res: NextApiResponse | |
) { | |
const oaiRes = await axios.post( | |
"https://api.openai.com/v1/completions", | |
{ |
const config = new Configuration({ | |
apiKey, | |
}); | |
const openai = new OpenAIApi(config); | |
const res: any = await openai.createCompletion( | |
{ | |
prompt: "Write a poem about dogs", | |
model: "text-davinci-003", |
// Load the file | |
const filepath = "./data/startup-mistakes.txt"; | |
let doc = fs.readFileSync(filepath, "utf8"); | |
// Split the doc by the separator | |
const separator = "\n\n"; | |
const texts = doc.split(separator); | |
const chunkSize = 1000; | |
const chunkOverlap = 100; |
two methods
centroid becomes the new mean
Implement an algorithm that validates XML tags and returns a boolean indicating if they're valid.
Here are the features we'd like to implement (in order of importance):
<x>
) and close (</x>
)<x/>
)<x special></x>
)<x number="10"></x>
)/** | |
* write | |
* | |
* A world snapshot consists of the following bits in order: | |
* 1. server world timestamp (ms) | |
* 2. server frame | |
* 3. all network entity snapshots | |
* a) network id | |
* b) entity was removed bit | |
* b) all network component snapshots |
class Provider(): | |
_client_attribute_names = ['get_data', 'update_data'] | |
def __init__(self): | |
self._client = Client() # assumes some client exists | |
self._factories = { | |
'get_data': factory_method #Add your factory method here | |
} |