Skip to content

Latest commit

 

History

History
84 lines (55 loc) · 3.92 KB

deepinfra.md

File metadata and controls

84 lines (55 loc) · 3.92 KB

DeepInfra

DeepInfra is a platform that allows users to deploy machine learning models. They offer a variety of models, including text-generation, text-to-image, and automatic speech recognition. Users can pay per use for the models they deploy. DeepInfra offers both custom models and pre-trained models. Pre-trained models include openchat/openchat-3.6-8b, nvidia/Nemotron-4-340B-Instruct, and microsoft/WizardLM-2-7B.

Interface Name

  • deepinfra

Example Usage

const { LLMInterface } = require('llm-interface');

LLMInterface.setApiKey({'deepinfra': process.env.DEEPINFRA_API_KEY});

async function main() {
  try {
    const response = await LLMInterface.sendMessage('deepinfra', 'Explain the importance of low latency LLMs.');
    console.log(response.results);
  } catch (error) {
    console.error(error);
    throw error;
  }
}

main();

Model Aliases

The following model aliases are provided for this provider.

  • default: openchat/openchat-3.6-8b
  • large: nvidia/Nemotron-4-340B-Instruct
  • small: microsoft/WizardLM-2-7B
  • agent: Qwen/Qwen2-7B-Instruct

Embeddings Model Aliases

  • default: BAAI/bge-base-en-v1.5
  • large: BAAI/bge-large-en-v1.5
  • small: BAAI/bge-base-en-v1.5

Options

The following parameters can be passed through options.

  • echo: If set to true, the input prompt is echoed back in the output.
  • frequency_penalty: Penalizes new tokens based on their existing frequency in the text so far, reducing the likelihood of repeating the same line. Positive values reduce the frequency of tokens appearing in the generated text.
  • max_tokens: The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length.
  • n: Specifies the number of responses to generate for each input message. Note that costs are based on the number of generated tokens across all choices. Keeping n as 1 minimizes costs.
  • presence_penalty: Penalizes new tokens based on whether they appear in the text so far, encouraging the model to talk about new topics. Positive values increase the likelihood of new tokens appearing in the generated text.
  • response_format: Defines the format of the AI's response. Setting this to { "type": "json_object" } enables JSON mode, ensuring the message generated by the model is valid JSON.
  • stop: Up to 4 sequences where the API will stop generating further tokens.
  • stream: If set, partial message deltas will be sent, similar to ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
  • temperature: Controls the randomness of the AI's responses. A higher temperature results in more random outputs, while a lower temperature makes the output more focused and deterministic. Generally, it is recommended to alter this or top_p, but not both.
  • tool_choice: Specifies which external tools the AI can use to assist in generating its response.
  • tools: A list of external tools available for the AI to use in generating responses.
  • top_p: Controls the cumulative probability of token selections for nucleus sampling. It limits the tokens to the smallest set whose cumulative probability exceeds the threshold. It is recommended to alter this or temperature, but not both.

Features

  • Native JSON Mode
  • Streaming
  • Tools
  • Embeddings

Getting an API Key

Commercial with Free Trial: The DeepInfra API is a commercial product, but new accounts start with a $1.80 credit.

To get an API key, first create a DeepInfra account, then visit the link below.

DeepInfra documentation is available here.