Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dependencies in package.json and docs improvement #14

Merged
merged 3 commits into from
Oct 27, 2024
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
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ template.
For example:

```ts
import { nv, template } from 'ts-llmt';

const thingVar = nv('thing');
const thing2Var = nv('thing2');
const whatIsAtoB = template`what is a ${thingVar} to ${thing2Var}?`;
// The type of `whatIsAtoB` is inferred to be `Template<"thing" | "thing2">`
const whatIsAtoB = template`what is a ${thingVar} to a ${thing2Var}?`;

// Replacing the thing variable give type: `Template<"thing2">`
const whatIsTabletoB = whatIsAtoB.vars.thing.substStr('table');

expect(whatIsTabletoB.escaped).toEqual('what is a table to {{thing2}}?');
// The escaped raw form of this template is as so:
expect(whatIsTabletoB.escaped).toEqual('what is a table to a {{thing2}}?');
```

A nice feature of this is that you get as "as-you-type" error checking, and
Expand All @@ -30,7 +35,7 @@ type-checking like so:

```ts
whatIsAtoB.substs({ thing: 'table', thing2: 'chair' });
expect(whatIsTabletoB.escaped).toEqual('what is a table to chair?');
expect(whatIsTabletoB.escaped).toEqual('what is a table to a chair?');
```

## Environment
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-llmt",
"version": "0.0.2",
"version": "0.0.0",
"description": "Experimental TypeScript library for Large Language Model Templates",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -53,10 +53,10 @@
"ts-jest": "^29.1.3",
"ts-node": "^10.9.2",
"typescript-eslint": "^7.10.0",
"yargs": "^17.7.2"
"yargs": "^17.7.2",
"typescript": "^5.4.5"
},
"dependencies": {
"underscore": "^1.13.6",
"typescript": "^5.4.5"
"underscore": "^1.13.6"
}
}