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

Request: Export Types for API Parameters and Responses #32

Open
mldangelo opened this issue Sep 21, 2024 · 2 comments
Open

Request: Export Types for API Parameters and Responses #32

mldangelo opened this issue Sep 21, 2024 · 2 comments

Comments

@mldangelo
Copy link

mldangelo commented Sep 21, 2024

Hi Mistral SDK team (@GaspardBT)! 👋

Would you consider exporting the internal types used in the SDK, such as those for API parameters and responses, in a future release?

I’m trying to improve support for Mistral in promptfoo. Currently, we’re making API calls via HTTP (you can see our setup here), but I'd love to use your SDK, especially for models like Pixtral.

Thanks for your consideration, and keep up the great work! 🚀

@GaspardBT
Copy link
Collaborator

Hey 👋

Would you mind sharing a code snippet of what you are looking to do? To make sure we fully understand 👍

Currently (with the latest version), you can import the types with:

import { ChatCompletionResponse } from "@mistralai/mistralai/models/components";

A full example can be found here.

Would this work for you?

@thoukydides
Copy link

thoukydides commented Sep 23, 2024

The UsageInfo type (PascalCase properties) does not appear to match the REST API response (snake_case):

export type CompletionChunk = {
  ...
  usage?: UsageInfo | undefined;
  ...
};
export type UsageInfo = {
  promptTokens: number;
  completionTokens: number;
  totalTokens: number;
};

vs:

"usage":{"prompt_tokens":7477,"total_tokens":7613,"completion_tokens":136}

CompletionResponseStreamChoice is also missing "logprobs":null.

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

No branches or pull requests

3 participants