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

Support custom context type with generic Ctx #34

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

rileytomasek
Copy link
Contributor

This allows a Ctx type to be specified when creating a Model
instance so that the context values are type safe.

I used any instead of typing the Datastore types because we aren't
using them an they will either be deprecated or revamped in a future
release.

This allows a `Ctx` type to be specified when creating a `Model`
instance so that the context values are type safe.

I used `any` instead of typing the `Datastore` types because we aren't
using them an they will either be deprecated or revamped in a future
release.
Copy link

vercel bot commented Apr 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dexter ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 23, 2024 9:29pm

Copy link
Collaborator

@transitive-bullshit transitive-bullshit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; always nice to be able to specify a more concrete type than any for something inherently app-dependent like ctx

@@ -40,7 +39,7 @@ export abstract class AbstractDatastore<
>;

public readonly contentKey: keyof DocMeta;
public readonly embeddingModel: Model.Embedding.Model;
public readonly embeddingModel: any;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the any creep begins 👀 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha any time i use any, it's a clear sign i'm about to delete that code and couldn't be bothered to fix it 😅

src/model/chat.test.ts Outdated Show resolved Hide resolved
This shows a more realistic and clear way to specify the context generic
for a model.
@rileytomasek rileytomasek merged commit 87174eb into master Apr 24, 2024
6 checks passed
@rileytomasek rileytomasek deleted the support-custom-context-type branch April 25, 2024 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants