What's New in Version 1.0.1
Released
Added missing Assistant_ListAssistants method.
[HookMethod("Assistant_ListAssistants")] public void Assistant_ListAssistants(int limit = 20, string order = "desc", string after = null, string before = null, Action<JObject> callback = null) { var url = "https://api.openai.com/v1/assistants"; var queryParameters = new List<string>(); if (limit != 20) queryParameters.Add($"limit={limit}"); if (order != "desc") queryParameters.Add($"order={order}"); if (!string.IsNullOrEmpty(after)) queryParameters.Add($"after={after}"); if (!string.IsNullOrEmpty(before)) queryParameters.Add($"before={before}"); if (queryParameters.Count > 0) { url += "?" + string.Join("&", queryParameters); } try { var webClient = new WebClient(); webClient.Headers.Add("Content-Type", "application/json"); webClient.Headers.Add("Authorization", $"Bearer {ApiKey}"); webClient.Headers.Add("OpenAI-Beta", "assistants=v2"); webClient.DownloadStringCompleted += (sender, e) => { if (e.Error != null) { HandleWebClientError(e.Error); callback?.Invoke(null); return; } try { var response = JObject.Parse(e.Result); callback?.Invoke(response); } catch (Exception parseEx) { PrintError($"Error parsing API response: {parseEx.Message}"); callback?.Invoke(null); } }; if (!_uriCache.TryGetValue(url, out Uri uri)) { uri = new Uri(url); _uriCache.Add(url, uri); } webClient.DownloadStringAsync(uri); } catch (Exception ex) { PrintError($"Error initiating API request: {ex.Message}"); callback?.Invoke(null); } }