OpenAI Library MT5
- Bibliotecas
- VitalDefender Inc.
- Versión: 1.0
- Activaciones: 5
La siguiente biblioteca se ofrece como un medio para utilizar las API de OpenAI directamente en MetaTrader de la manera más sencilla posible.
Para obtener más detalles sobre las capacidades de la biblioteca, lea el siguiente artículo:
https://www.mql5.com/en/blogs/post/756098
The files needed to use the library can be found here:
Para utilizar la biblioteca es necesario incluir el siguiente Encabezado que puedes encontrar en el siguiente enlace:
https://www.mql5.com/en/blogs/post/756108
#import "StormWaveOpenAI.ex5"
COpenAI *iOpenAI(string);
CMessages *iMessages(void);
CTools *iTools(void);
#import
Esto es todo lo que necesitas para usar la biblioteca fácilmente.
A continuación, un ejemplo de cómo usar fácilmente la biblioteca y operar con las API de OpenAI
#include <StormWaveOpenAI.mqh> //--- Incluye el archivo de cabecera personalizado de OpenAI para la integración de la API COpenAI *client; //--- Declara un puntero al cliente de OpenAI CMessages *_message_; //--- Declara un puntero para manejar mensajes //--- La función OnStart es el punto de entrada del script OnStart() { client = iOpenAI("TU_CLAVE_API"); //--- Inicializa el cliente de OpenAI con tu clave API client.start_thread(); //--- Inicia un nuevo hilo para que el cliente de OpenAI opere string completion; //--- Variable para almacenar la respuesta de la API _message_ = iMessages(); //--- Inicializa el manejador de mensajes string user_content = "Hola, ¿cómo estás?"; //--- Define el contenido del mensaje _message_.AddMessage(user_content, user); //--- Añade el mensaje al manejador con un identificador de usuario //--- Llama a la API para generar una completación basada en los mensajes proporcionados completion = client.completions_create( /*modelo = */ "gpt-3.5-turbo-0125", //--- Especifica el modelo a usar para la completación /*mensajes = */ _message_, //--- Pasa los mensajes a la API /*max_tokens = */ 300, //--- Establece el número máximo de tokens a generar /*temperatura = */ 1.0 //--- Establece el nivel de creatividad de la respuesta ); client.PrintResultMessage(); //--- Imprime el resultado de la llamada a la API delete _message_; //--- Limpia el manejador de mensajes delete client; //--- Limpia el cliente de OpenAI }Para obtener más detalles, no dude en contactarme. Le agradezco de antemano si decide comprar esta biblioteca. Si encuentra algún bug, le agradecería que contribuyera a mejorar la biblioteca enviándome los problemas que encuentre de forma privada, para que pueda realizar las mejoras necesarias.