Skip to content

Commit

Permalink
Merge pull request #52 from tryAGI/bot/update-openapi_202410010157
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Oct 1, 2024
2 parents 323bb23 + 54c8b47 commit 050f0b8
Show file tree
Hide file tree
Showing 10 changed files with 242 additions and 14 deletions.
48 changes: 48 additions & 0 deletions src/libs/Ollama/Generated/AnyOf.2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,54 @@ public bool Validate()
return IsValue1 || IsValue2;
}

/// <summary>
///
/// </summary>
public TResult? Match<TResult>(
global::System.Func<T1, TResult>? value1 = null,
global::System.Func<T2, TResult>? value2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1 && value1 != null)
{
return value1(Value1!);
}
else if (IsValue2 && value2 != null)
{
return value2(Value2!);
}

return default(TResult);
}

/// <summary>
///
/// </summary>
public void Match(
global::System.Action<T1>? value1 = null,
global::System.Action<T2>? value2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1)
{
value1?.Invoke(Value1!);
}
else if (IsValue2)
{
value2?.Invoke(Value2!);
}
}

/// <summary>
///
/// </summary>
Expand Down
8 changes: 6 additions & 2 deletions src/libs/Ollama/Generated/Ollama.ChatClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public sealed partial class ChatClient : global::Ollama.IChatClient, global::Sys
public const string BaseUrl = "http://localhost:11434/api";

private readonly global::System.Net.Http.HttpClient _httpClient;
private global::Ollama.EndPointAuthorization? _authorization;

/// <summary>
///
Expand All @@ -29,13 +30,16 @@ public sealed partial class ChatClient : global::Ollama.IChatClient, global::Sys
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
/// <param name="httpClient"></param>
/// <param name="baseUri"></param>
/// <param name="baseUri"></param>
/// <param name="authorization"></param>
public ChatClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null)
global::System.Uri? baseUri = null,
global::Ollama.EndPointAuthorization? authorization = null)
{
_httpClient = httpClient ?? new global::System.Net.Http.HttpClient();
_httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl);
_authorization = authorization;

Initialized(_httpClient);
}
Expand Down
8 changes: 6 additions & 2 deletions src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public sealed partial class CompletionsClient : global::Ollama.ICompletionsClien
public const string BaseUrl = "http://localhost:11434/api";

private readonly global::System.Net.Http.HttpClient _httpClient;
private global::Ollama.EndPointAuthorization? _authorization;

/// <summary>
///
Expand All @@ -29,13 +30,16 @@ public sealed partial class CompletionsClient : global::Ollama.ICompletionsClien
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
/// <param name="httpClient"></param>
/// <param name="baseUri"></param>
/// <param name="baseUri"></param>
/// <param name="authorization"></param>
public CompletionsClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null)
global::System.Uri? baseUri = null,
global::Ollama.EndPointAuthorization? authorization = null)
{
_httpClient = httpClient ?? new global::System.Net.Http.HttpClient();
_httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl);
_authorization = authorization;

Initialized(_httpClient);
}
Expand Down
8 changes: 6 additions & 2 deletions src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public sealed partial class EmbeddingsClient : global::Ollama.IEmbeddingsClient,
public const string BaseUrl = "http://localhost:11434/api";

private readonly global::System.Net.Http.HttpClient _httpClient;
private global::Ollama.EndPointAuthorization? _authorization;

/// <summary>
///
Expand All @@ -29,13 +30,16 @@ public sealed partial class EmbeddingsClient : global::Ollama.IEmbeddingsClient,
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
/// <param name="httpClient"></param>
/// <param name="baseUri"></param>
/// <param name="baseUri"></param>
/// <param name="authorization"></param>
public EmbeddingsClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null)
global::System.Uri? baseUri = null,
global::Ollama.EndPointAuthorization? authorization = null)
{
_httpClient = httpClient ?? new global::System.Net.Http.HttpClient();
_httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl);
_authorization = authorization;

Initialized(_httpClient);
}
Expand Down
48 changes: 48 additions & 0 deletions src/libs/Ollama/Generated/Ollama.Models.CreateModelStatus.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,54 @@ public bool Validate()
return IsValue1 || IsValue2;
}

/// <summary>
///
/// </summary>
public TResult? Match<TResult>(
global::System.Func<string?, TResult>? value1 = null,
global::System.Func<global::Ollama.CreateModelStatusEnum?, TResult>? value2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1 && value1 != null)
{
return value1(Value1!);
}
else if (IsValue2 && value2 != null)
{
return value2(Value2!);
}

return default(TResult);
}

/// <summary>
///
/// </summary>
public void Match(
global::System.Action<string?>? value1 = null,
global::System.Action<global::Ollama.CreateModelStatusEnum?>? value2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1)
{
value1?.Invoke(Value1!);
}
else if (IsValue2)
{
value2?.Invoke(Value2!);
}
}

/// <summary>
///
/// </summary>
Expand Down
48 changes: 48 additions & 0 deletions src/libs/Ollama/Generated/Ollama.Models.DoneReason.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,54 @@ public bool Validate()
return IsValue1 || IsValue2;
}

/// <summary>
///
/// </summary>
public TResult? Match<TResult>(
global::System.Func<string?, TResult>? value1 = null,
global::System.Func<global::Ollama.DoneReasonEnum?, TResult>? value2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1 && value1 != null)
{
return value1(Value1!);
}
else if (IsValue2 && value2 != null)
{
return value2(Value2!);
}

return default(TResult);
}

/// <summary>
///
/// </summary>
public void Match(
global::System.Action<string?>? value1 = null,
global::System.Action<global::Ollama.DoneReasonEnum?>? value2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1)
{
value1?.Invoke(Value1!);
}
else if (IsValue2)
{
value2?.Invoke(Value2!);
}
}

/// <summary>
///
/// </summary>
Expand Down
48 changes: 48 additions & 0 deletions src/libs/Ollama/Generated/Ollama.Models.PullModelStatus.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,54 @@ public bool Validate()
return IsValue1 || IsValue2;
}

/// <summary>
///
/// </summary>
public TResult? Match<TResult>(
global::System.Func<string?, TResult>? value1 = null,
global::System.Func<global::Ollama.PullModelStatusEnum?, TResult>? value2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1 && value1 != null)
{
return value1(Value1!);
}
else if (IsValue2 && value2 != null)
{
return value2(Value2!);
}

return default(TResult);
}

/// <summary>
///
/// </summary>
public void Match(
global::System.Action<string?>? value1 = null,
global::System.Action<global::Ollama.PullModelStatusEnum?>? value2 = null,
bool validate = true)
{
if (validate)
{
Validate();
}

if (IsValue1)
{
value1?.Invoke(Value1!);
}
else if (IsValue2)
{
value2?.Invoke(Value2!);
}
}

/// <summary>
///
/// </summary>
Expand Down
8 changes: 6 additions & 2 deletions src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public sealed partial class ModelsClient : global::Ollama.IModelsClient, global:
public const string BaseUrl = "http://localhost:11434/api";

private readonly global::System.Net.Http.HttpClient _httpClient;
private global::Ollama.EndPointAuthorization? _authorization;

/// <summary>
///
Expand All @@ -29,13 +30,16 @@ public sealed partial class ModelsClient : global::Ollama.IModelsClient, global:
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
/// <param name="httpClient"></param>
/// <param name="baseUri"></param>
/// <param name="baseUri"></param>
/// <param name="authorization"></param>
public ModelsClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null)
global::System.Uri? baseUri = null,
global::Ollama.EndPointAuthorization? authorization = null)
{
_httpClient = httpClient ?? new global::System.Net.Http.HttpClient();
_httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl);
_authorization = authorization;

Initialized(_httpClient);
}
Expand Down
16 changes: 10 additions & 6 deletions src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g
public const string BaseUrl = "http://localhost:11434/api";

private readonly global::System.Net.Http.HttpClient _httpClient;
private global::Ollama.EndPointAuthorization? _authorization;

/// <summary>
///
Expand All @@ -26,31 +27,31 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g
/// <summary>
/// Given a prompt, the model will generate a completion.
/// </summary>
public CompletionsClient Completions => new CompletionsClient(_httpClient)
public CompletionsClient Completions => new CompletionsClient(_httpClient, authorization: _authorization)
{
JsonSerializerContext = JsonSerializerContext,
};

/// <summary>
/// Given a list of messages comprising a conversation, the model will return a response.
/// </summary>
public ChatClient Chat => new ChatClient(_httpClient)
public ChatClient Chat => new ChatClient(_httpClient, authorization: _authorization)
{
JsonSerializerContext = JsonSerializerContext,
};

/// <summary>
/// Get a vector representation of a given input.
/// </summary>
public EmbeddingsClient Embeddings => new EmbeddingsClient(_httpClient)
public EmbeddingsClient Embeddings => new EmbeddingsClient(_httpClient, authorization: _authorization)
{
JsonSerializerContext = JsonSerializerContext,
};

/// <summary>
/// List and describe the various models available.
/// </summary>
public ModelsClient Models => new ModelsClient(_httpClient)
public ModelsClient Models => new ModelsClient(_httpClient, authorization: _authorization)
{
JsonSerializerContext = JsonSerializerContext,
};
Expand All @@ -61,13 +62,16 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
/// <param name="httpClient"></param>
/// <param name="baseUri"></param>
/// <param name="baseUri"></param>
/// <param name="authorization"></param>
public OllamaApiClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null)
global::System.Uri? baseUri = null,
global::Ollama.EndPointAuthorization? authorization = null)
{
_httpClient = httpClient ?? new global::System.Net.Http.HttpClient();
_httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl);
_authorization = authorization;

Initialized(_httpClient);
}
Expand Down
Loading

0 comments on commit 050f0b8

Please sign in to comment.