Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Turns anonymous functions into class methods #89

Closed
wants to merge 2 commits into from
Closed
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
18 changes: 9 additions & 9 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class MistralClient {
* @param {*} formData
* @return {Promise<*>}
*/
_request = async function(method, path, request, signal, formData = null) {
async _request(method, path, request, signal, formData = null) {
const url = `${this.endpoint}/${path}`;
const options = {
method: method,
Expand Down Expand Up @@ -207,7 +207,7 @@ class MistralClient {
* @param {*} responseFormat
* @return {Promise<Object>}
*/
_makeChatCompletionRequest = function(
_makeChatCompletionRequest(
model,
messages,
tools,
Expand Down Expand Up @@ -253,7 +253,7 @@ class MistralClient {
* @param {*} stream
* @return {Promise<Object>}
*/
_makeCompletionRequest = function(
_makeCompletionRequest(
model,
prompt,
suffix,
Expand Down Expand Up @@ -285,7 +285,7 @@ class MistralClient {
* Returns a list of the available models
* @return {Promise<Object>}
*/
listModels = async function() {
async listModels() {
const response = await this._request('get', 'v1/models');
return response;
};
Expand Down Expand Up @@ -317,7 +317,7 @@ class MistralClient {
* default timeout signal
* @return {Promise<Object>}
*/
chat = async function(
async chat(
{
model,
messages,
Expand Down Expand Up @@ -383,7 +383,7 @@ class MistralClient {
* default timeout signal
* @return {Promise<Object>}
*/
chatStream = async function* (
async* chatStream(
{
model,
messages,
Expand Down Expand Up @@ -446,7 +446,7 @@ class MistralClient {
* e.g. ['What is the best French cheese?']
* @return {Promise<Object>}
*/
embeddings = async function({model, input}) {
async embeddings({model, input}) {
const request = {
model: model,
input: input,
Expand Down Expand Up @@ -478,7 +478,7 @@ class MistralClient {
* default timeout signal
* @return {Promise<Object>}
*/
completion = async function(
async completion(
{model, prompt, suffix, temperature, maxTokens, topP, randomSeed, stop},
{signal} = {},
) {
Expand Down Expand Up @@ -525,7 +525,7 @@ class MistralClient {
* default timeout signal
* @return {Promise<Object>}
*/
completionStream = async function* (
async* completionStream(
{model, prompt, suffix, temperature, maxTokens, topP, randomSeed, stop},
{signal} = {},
) {
Expand Down