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

Turns anonymous functions into class methods #89

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

flore2003
Copy link
Contributor

Currently most methods on the MistralClient are implemented as anonymous functions/class fields (myMethod = function() {...}). This makes it hard to inherit, overwrite, and monkeypatch these methods.

Example:

import * as MistralAI from "@mistralai/mistralai";

const originalChat = MistralAI.prototype.chat;
MistralAI.prototype.chat = function(...) {...};
// originalChat is undefined

This PR changes all of these functions to real class methods, which allows for easier monkeypatching etc.

Closes #58

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.

Refactor arrow function class methods for better inheritance support
1 participant