Mistral AI
Zintegruj modele Mistral AI z aplikacjami Delphi, C++ Builder i .NET. Uzupełnianie czatu, wizja, strumieniowanie i embeddingi przez Mistral REST API.
Zintegruj modele Mistral AI z aplikacjami Delphi, C++ Builder i .NET. Uzupełnianie czatu, wizja, strumieniowanie i embeddingi przez Mistral REST API.
Klient Mistral REST API do uzupełniania czatu, wizji, strumieniowania, embeddingów i listowania modeli.
TsgcHTTP_API_Mistral
Mistral REST API przez HTTPS
Windows, macOS, Linux, iOS, Android
Enterprise (dodatek AI)
Ustaw klucz API w MistralOptions, a następnie wywołaj typowane metody pomocnicze, takie jak _CreateMessage, albo zbuduj TsgcMistralClass_Request_ChatCompletion i wywołaj CreateMessage.
uses
sgcHTTP_API_Mistral;
var
Mistral: TsgcHTTP_API_Mistral;
begin
Mistral := TsgcHTTP_API_Mistral.Create(nil);
Mistral.MistralOptions.ApiKey := 'YOUR_API_KEY';
// Simple one-shot message
Memo1.Lines.Text := Mistral._CreateMessage(
'mistral-large-latest',
'What are the benefits of WebSockets?',
4096);
// Streaming — handle OnHTTPAPISSE per delta
Mistral.OnHTTPAPISSE := HandleSSE;
Mistral._CreateMessageStream(
'mistral-large-latest',
'Summarise RFC 6455');
end;
procedure TForm1.HandleSSE(Sender: TObject;
const aEvent, aData: string;
var Cancel: Boolean);
begin
Memo1.Lines.Add(aEvent + ': ' + aData);
end;
// uses: sgcHTTP_API_Mistral
TsgcHTTP_API_Mistral *Mistral = new TsgcHTTP_API_Mistral(this);
Mistral->MistralOptions->ApiKey = "YOUR_API_KEY";
// Simple one-shot message
Memo1->Lines->Text = Mistral->_CreateMessage(
"mistral-large-latest",
"What are the benefits of WebSockets?",
4096);
// Streaming — OnHTTPAPISSE fires per delta
Mistral->OnHTTPAPISSE = HandleSSE;
Mistral->_CreateMessageStream(
"mistral-large-latest",
"Summarise RFC 6455");
using esegece.sgcWebSockets;
var mistral = new TsgcHTTPAPI_Mistral();
mistral.MistralOptions.ApiKey = "YOUR_API_KEY";
// Simple one-shot message
Console.WriteLine(mistral._CreateMessage(
"mistral-large-latest",
"What are the benefits of WebSockets?",
4096));
// Streaming via Server-Sent Events
mistral.OnHTTPAPISSE += (sender, ev, data, cancel) => Console.Write(data);
mistral._CreateMessageStream(
"mistral-large-latest",
"Summarise RFC 6455");
Typowane klasy żądania / odpowiedzi dla uzupełniania czatu i embeddingów, a także skróty na łańcuchach JSON, wizja, strumieniowanie i sterowanie niezawodnością.
CreateMessage wysyła typowane TsgcMistralClass_Request_ChatCompletion i zwraca sparsowaną odpowiedź. _CreateMessage, _CreateMessageWithSystem i _CreateMessageStream to skróty operujące na łańcuchach JSON, a _CreateMessageJSON włącza tryb JSON dla poprawnego wyjścia JSON.
_CreateVisionMessage wysyła obraz zakodowany w base64 z promptem tekstowym. Typ mediów przyjmuje image/jpeg, image/png, image/gif i image/webp, dzięki czemu model może zrozumieć obraz.
_GetModels wymienia wszystkie dostępne modele Mistral, dzięki czemu możesz wykryć i wybrać właściwy model w czasie działania, zamiast wpisywać identyfikatory na sztywno.
_CreateEmbeddings zwraca reprezentację wektorową tekstu wejściowego przy użyciu modelu takiego jak mistral-embed, gotową do wyszukiwania semantycznego, klasteryzacji i innych zadań uczenia maszynowego.
CircuitBreaker krótkozwiera żądania, gdy API jest niesprawne; ReadTimeout i TLSOptions dostrajają warstwę HTTPS; OnHTTPAPIException ujawnia błędy; OnHTTPAPISSE strumieniuje zdarzenia Server-Sent Events.
Autorytatywne źródła protokołów implementowanych przez ten komponent.
Deep-link do dokumentacji komponentu, gotowy do uruchomienia projekt demonstracyjny i pobranie wersji próbnej.
| Pomoc online — Mistral Pełna dokumentacja właściwości, metod i zdarzeń tego komponentu. | Otwórz | |
| Projekt demonstracyjny — Demos\AI\Mistral Gotowy do uruchomienia projekt przykładowy. Dostarczany wewnątrz pakietu sgcWebSockets — pobierz wersję próbną poniżej. | Otwórz | |
| Podręcznik użytkownika (PDF) Kompleksowy podręcznik obejmujący każdy komponent biblioteki. | Otwórz |