Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/coqa-small.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"messages":[{"content":"Read the story and extract answers for the questions.\nStory: The Vatican Apostolic Library (), more commonly called the Vatican Library or simply the Vat, is the library of the Holy See, located in Vatican City. Formally established in 1475, although it is much older, it is one of the oldest libraries in the world and contains one of the most significant collections of historical texts. It has 75,000 codices from throughout history, as well as 1.1 million printed books, which include some 8,500 incunabula. \n\nThe Vatican Library is a research library for history, law, philosophy, science and theology. The Vatican Library is open to anyone who can document their qualifications and research needs. Photocopies for private study of pages from books published between 1801 and 1990 can be requested in person or by mail. \n\nIn March 2014, the Vatican Library began an initial four-year project of digitising its collection of manuscripts, to be made available online. \n\nThe Vatican Secret Archives were separated from the library at the beginning of the 17th century; they contain another 150,000 items. \n\nScholars have traditionally divided the history of the library into five periods, Pre-Lateran, Lateran, Avignon, Pre-Vatican and Vatican. \n\nThe Pre-Lateran period, comprising the initial days of the library, dated from the earliest days of the Church. Only a handful of volumes survive from this period, though some are very significant.","role":"system"},{"content":"When was the Vat formally opened?","role":"user"},{"content":"It was formally established in 1475","role":"assistant"},{"content":"what is the library for?","role":"user"},{"content":"research","role":"assistant"},{"content":"for what subjects?","role":"user"},{"content":"history, and law","role":"assistant"},{"content":"and?","role":"user"},{"content":"philosophy, science and theology","role":"assistant"},{"content":"what was started in 2014?","role":"user"},{"content":"a project","role":"assistant"},{"content":"how do scholars divide the library?","role":"user"},{"content":"into periods","role":"assistant"},{"content":"how many?","role":"user"},{"content":"five","role":"assistant"},{"content":"what is the official name of the Vat?","role":"user"},{"content":"The Vatican Apostolic Library","role":"assistant"},{"content":"where is it?","role":"user"},{"content":"in Vatican City","role":"assistant"},{"content":"how many printed books does it contain?","role":"user"},{"content":"1.1 million","role":"assistant"},{"content":"when were the Secret Archives moved from the rest of the library?","role":"user"},{"content":"at the beginning of the 17th century;","role":"assistant"},{"content":"how many items are in this secret collection?","role":"user"},{"content":"150,000","role":"assistant"},{"content":"Can anyone use this library?","role":"user"},{"content":"anyone who can document their qualifications and research needs.","role":"assistant"},{"content":"what must be requested to view?","role":"user"},{"content":"unknown","role":"assistant"},{"content":"what must be requested in person or by mail?","role":"user"},{"content":"Photocopies","role":"assistant"},{"content":"of what books?","role":"user"},{"content":"only books published between 1801 and 1990","role":"assistant"},{"content":"What is the Vat the library of?","role":"user"},{"content":"the Holy See","role":"assistant"},{"content":"How many books survived the Pre Lateran period?","role":"user"},{"content":"a handful of volumes","role":"assistant"},{"content":"what is the point of the project started in 2014?","role":"user"},{"content":"digitising manuscripts","role":"assistant"},{"content":"what will this allow?","role":"user"},{"content":"them to be viewed online.","role":"assistant"}]}
20 changes: 5 additions & 15 deletions examples/uploading-files.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env -S npm run tsn -T

// Example of uploading a file
import { upload, ErrorResponse, FileResponse } from 'together-ai/lib/upload';
import { readEnv } from 'together-ai/internal/utils/env';
import Together from 'together-ai';

const together = new Together();

async function main() {
// Upload a file
const file: ErrorResponse | FileResponse = await upload('./examples/coqa.jsonl');
const file = await together.files.upload('./examples/coqa-small.jsonl', 'fine-tune');
console.log('Uploaded file');
console.log(file);

Expand All @@ -16,18 +17,7 @@ async function main() {
}

// Check if the file has any contents (https://docs.together.ai/reference/get_files-id-content)
// @ts-ignore
const baseUrl = readEnv('TOGETHER_API_BASE_URL') || 'https://api.together.ai/v1';
const url = `${baseUrl}/files/${file.id}/content`;
const options = {
method: 'GET',
headers: {
accept: 'application/json',
authorization: `Bearer ${process.env['TOGETHER_API_KEY']}`,
},
};

const res = await fetch(url, options);
const res = await together.files.content(file.id);
console.log(await res.text());
}

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"fix": "./scripts/format"
},
"dependencies": {
"parquetjs": "^0.11.2",
"progress-stream": "^2.0.0"
"parquetjs": "^0.11.2"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.0",
Expand All @@ -37,7 +36,6 @@
"@types/jest": "^29.4.0",
"@types/node": "^20.17.6",
"@types/parquetjs": "^0.10.6",
"@types/progress-stream": "^2.0.5",
"@typescript-eslint/eslint-plugin": "8.31.1",
"@typescript-eslint/parser": "8.31.1",
"eslint": "^9.20.1",
Expand Down
Loading