From 9dd14907234bbba4215378adb03a4045614a1aab Mon Sep 17 00:00:00 2001 From: Bruno Garcia de Oliveira Date: Fri, 11 Oct 2024 14:41:25 -0300 Subject: [PATCH] docs: README update --- README.md | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 20b2c48..246142e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +[![npm version](https://img.shields.io/npm/v/openai-enhanced-sdk.svg)](https://www.npmjs.com/package/openai-enhanced-sdk) +[![Build Status](https://github.com/bgarciaoliveira/openai-enhanced-sdk/actions/workflows/deploy-docs.yml/badge.svg)](https://github.com/bgarciaoliveira/openai-enhanced-sdk/actions) +[![License](https://img.shields.io/npm/l/openai-enhanced-sdk.svg)](LICENSE) + # OpenAI TypeScript Enhanced SDK OpenAI Enhanced SDK is a **fully typed** TypeScript SDK that facilitates integration with the OpenAI API. It offers features that the official SDK does not have, such as context management for conversations, proxy support, automatic request retry mechanism, detailed logging system, among others. @@ -50,14 +54,34 @@ npm install openai-enhanced-sdk ## Getting Started ### Initialization +```typescript +import OpenAIClient from '../src/openai-client'; +import { HttpsProxyAgent } from 'https-proxy-agent'; -Import and instantiate the `OpenAIClient`: +const apiKey = process.env.OPENAI_API_KEY; -```typescript -import OpenAIClient from 'openai-enhanced-sdk'; +// Proxy agent configuration +const proxyAgent = new HttpsProxyAgent('http://proxy.example.com:8080'); -const apiKey = process.env.OPENAI_API_KEY || ''; -const client = new OpenAIClient(apiKey); +const client = new OpenAIClient(apiKey, { + baseURL: 'https://api.openai.com/v1', + timeout: 10000, + proxyConfig: proxyAgent, + axiosConfig: { + headers: { + 'Custom-Header': 'custom-value', + }, + }, + axiosRetryConfig: { + retries: 5, + retryDelay: 2000, + }, + loggingOptions: { + logLevel: 'info', + logToFile: true, + logFilePath: 'logs/openai-client.log', + }, +}); ``` ### Authentication