Skip to content

Commit f57564e

Browse files
include public api docs in nugets (#4)
1 parent 0b7ea10 commit f57564e

17 files changed

+70
-19
lines changed

src/LLMSharp.Google.Palm/Common/PalmClientException.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ namespace LLMSharp.Google.Palm.Common
99
/// </summary>
1010
public class PalmClientException : Exception
1111
{
12+
/// <summary>
13+
/// Grpc response status
14+
/// </summary>
1215
public Status Status { get; private set; }
1316

17+
/// <summary>
18+
/// Palm Client Exception constructor
19+
/// </summary>
20+
/// <param name="status">Grpc response status</param>
21+
/// <param name="innerException">Any inner exception included</param>
1422
public PalmClientException(
1523
Status status, Exception? innerException = null)
1624
: base(string.Format(CultureInfo.CurrentCulture, Constants.RpcExceptionMessage, status.StatusCode, status.Detail), innerException)

src/LLMSharp.Google.Palm/Common/PalmContentFilter.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
namespace LLMSharp.Google.Palm.Common
55
{
66
/// <summary>
7-
/// Content filtering metadata associated with processing a single request.
8-
///
7+
/// Content filtering metadata associated with processing a single request.
98
/// ContentFilter contains a reason and an optional supporting string. The reason
109
/// may be unspecified.
1110
/// </summary>
1211
public class PalmContentFilter
1312
{
14-
public PalmContentFilter(gav::ContentFilter f)
13+
/// <summary>
14+
/// Palm Content Filter constructor
15+
/// </summary>
16+
/// <param name="f">proto generated content filter type</param>
17+
internal PalmContentFilter(gav::ContentFilter f)
1518
{
1619
this.Reason = f.Reason;
1720
this.Message = f.Message;

src/LLMSharp.Google.Palm/Common/PalmSafetyRating.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ public class PalmSafetyRating
1818
/// </summary>
1919
public HarmProbability Probability { get; private set; }
2020

21-
public PalmSafetyRating(gav::HarmCategory category, HarmProbability probability)
21+
/// <summary>
22+
/// Palm Safety Rating constructor
23+
/// </summary>
24+
/// <param name="category"> HarmCategory for the rating </param>
25+
/// <param name="probability"> HarmProbability for the rating </param>
26+
internal PalmSafetyRating(gav::HarmCategory category, HarmProbability probability)
2227
{
2328
Category = category;
2429
Probability = probability;

src/LLMSharp.Google.Palm/Common/PalmSafetySetting.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ public class PalmSafetySetting
1818
/// </summary>
1919
public HarmBlockThreshold Threshold { get; private set; }
2020

21+
/// <summary>
22+
/// Safety Setting constructor
23+
/// </summary>
24+
/// <param name="category">HarmCategory</param>
25+
/// <param name="threshold">BlockThreshold</param>
2126
public PalmSafetySetting(gav::HarmCategory category, HarmBlockThreshold threshold)
2227
{
2328
Category = category;

src/LLMSharp.Google.Palm/DiscussService/IPalmDiscussService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ public interface IPalmDiscussService
3030
/// <param name="examples">Optional examples included as part of the message</param>
3131
/// <param name="context">Optional context included in the message</param>
3232
/// <param name="model">Model used for counting tokens. Default: models/chat-bison-001</param>
33-
/// <param name="options">Options for customizing the request</param>
33+
/// <param name="reqOptions">Options for customizing the request</param>
3434
/// <param name="cancellationToken">token used for cancelling the async request</param>
3535
/// <returns>message token count</returns>
3636
public Task<int> CountMessageTokensAsync(
3737
IEnumerable<PalmChatMessage> messages,
3838
IEnumerable<PalmChatExample>? examples,
3939
string? context,
4040
string model,
41-
RequestOptions? options,
41+
RequestOptions? reqOptions,
4242
CancellationToken cancellationToken);
4343
}
4444
}

src/LLMSharp.Google.Palm/DiscussService/PalmChatCompletionRequest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace LLMSharp.Google.Palm.DiscussService
55
{
6+
/// <summary>
7+
/// Class representation of the Chat Completion Request input
8+
/// </summary>
69
public class PalmChatCompletionRequest
710
{
811
/// <summary>
@@ -14,7 +17,7 @@ public class PalmChatCompletionRequest
1417
/// <summary>
1518
/// Text that should be provided to the model first, to ground the response.
1619
/// If not empty, this context will be given to the model first before the examples and messages.
17-
//// This field can be a description of your prompt to the model to help provide context and guide the responses.
20+
/// This field can be a description of your prompt to the model to help provide context and guide the responses.
1821
/// </summary>
1922
public string Context { get; set; } = string.Empty;
2023

src/LLMSharp.Google.Palm/DiscussService/PalmChatCompletionResponse.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
namespace LLMSharp.Google.Palm.DiscussService
77
{
8+
/// <summary>
9+
/// Class representing the response from a Palm Chat Completion Request
10+
/// </summary>
811
public class PalmChatCompletionResponse
912
{
1013
internal PalmChatCompletionResponse(gav::GenerateMessageResponse response)

src/LLMSharp.Google.Palm/DiscussService/PalmChatExample.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace LLMSharp.Google.Palm
66
{
7+
/// <summary>
8+
/// Class to represent examples to include in the Palm Completion Request
9+
/// </summary>
710
public class PalmChatExample
811
{
912
/// <summary>

src/LLMSharp.Google.Palm/DiscussService/PalmChatMessage.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace LLMSharp.Google.Palm
55
{
6+
/// <summary>
7+
/// Class representing a chat message to be used in the Palm Completion Request
8+
/// </summary>
69
public class PalmChatMessage
710
{
811
internal PalmChatMessage(gav::Message c)
@@ -12,6 +15,11 @@ internal PalmChatMessage(gav::Message c)
1215
this.CitationMetadata = new PalmCitationMetadata(c.CitationMetadata);
1316
}
1417

18+
/// <summary>
19+
/// ChatMessage constructor
20+
/// </summary>
21+
/// <param name="content">content of the chat message</param>
22+
/// <param name="author">author of the chat message generally "0" for the user and "1" for the AI</param>
1523
public PalmChatMessage(string content, string? author)
1624
{
1725
this.Author = author;

src/LLMSharp.Google.Palm/DiscussService/PalmDiscussService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal sealed class PalmDiscussService : IPalmDiscussService
5050
/// <param name="examples">Optional examples included as part of the message</param>
5151
/// <param name="context">Optional context included in the message</param>
5252
/// <param name="model">Model used for counting tokens. Default: models/chat-bison-001</param>
53-
/// <param name="options">Options for customizing the request</param>
53+
/// <param name="reqOptions">Options for customizing the request</param>
5454
/// <param name="cancellationToken">token used for cancelling the async request</param>
5555
/// <returns>message token count</returns>
5656
public async Task<int> CountMessageTokensAsync(

src/LLMSharp.Google.Palm/GooglePalmClient.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ namespace LLMSharp.Google.Palm
1212
/// </summary>
1313
public class GooglePalmClient : IGooglePalmClient
1414
{
15-
private readonly IPalmModelService _palmModelService;
16-
private readonly IPalmTextService _palmTextService;
17-
private readonly IPalmDiscussService _palmDiscussService;
15+
private readonly PalmModelService _palmModelService;
16+
private readonly PalmTextService _palmTextService;
17+
private readonly PalmDiscussService _palmDiscussService;
1818

1919
/// <summary>
2020
/// Constructor for GooglePalmClient with ApiKey
@@ -85,23 +85,23 @@ public GooglePalmClient(ClientOptions options)
8585
/// <param name="examples">Optional examples included as part of the message</param>
8686
/// <param name="context">Optional context included in the message</param>
8787
/// <param name="model">Model used for counting tokens. Default: models/chat-bison-001</param>
88-
/// <param name="options">Options for customizing the request</param>
88+
/// <param name="reqOptions">Options for customizing the request</param>
8989
/// <param name="cancellationToken">token used for cancelling the async request</param>
9090
/// <returns>message token count</returns>
9191
public async Task<int> CountMessageTokensAsync(
9292
IEnumerable<PalmChatMessage> messages,
9393
IEnumerable<PalmChatExample>? examples = null,
9494
string? context = null,
9595
string model = Constants.DefaultPalmChatCompletionModel,
96-
RequestOptions? options = null,
96+
RequestOptions? reqOptions = null,
9797
CancellationToken cancellationToken = default)
9898
{
9999
return await this._palmDiscussService.CountMessageTokensAsync(
100100
messages,
101101
examples ?? Enumerable.Empty<PalmChatExample>(),
102102
context,
103103
model,
104-
options,
104+
reqOptions,
105105
cancellationToken
106106
).ConfigureAwait(false);
107107
}

src/LLMSharp.Google.Palm/LLMSharp.Google.Palm.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<SignAssembly>True</SignAssembly>
2020
<AssemblyOriginatorKeyFile>..\..\google-palm-sdk.snk</AssemblyOriginatorKeyFile>
2121
<DelaySign>True</DelaySign>
22+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
2223
</PropertyGroup>
2324

2425
<ItemGroup>

src/LLMSharp.Google.Palm/ModelService/IPalmModelService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace LLMSharp.Google.Palm
66
{
7+
/// <summary>
8+
/// Palm2 Model Info, Model list and Model fetch service contract
9+
/// </summary>
710
public interface IPalmModelService
811
{
912
/// <summary>

src/LLMSharp.Google.Palm/TextService/IPalmTextService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace LLMSharp.Google.Palm
66
{
7+
/// <summary>
8+
/// Palm2 Text Completion Service contract
9+
/// </summary>
710
public interface IPalmTextService
811
{
912
/// <summary>

src/LLMSharp.Google.Palm/TextService/PalmCompletionCandidate.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
namespace LLMSharp.Google.Palm
77
{
8+
/// <summary>
9+
/// Class representing one of the candidate response from the TextCompletion model.
10+
/// </summary>
811
public class PalmCompletionCandidate
912
{
1013
internal PalmCompletionCandidate(gav::TextCompletion c)

src/LLMSharp.Google.Palm/TextService/PalmTextCompletionRequest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace LLMSharp.Google.Palm
55
{
6+
/// <summary>
7+
/// Class representing a request to the Palm Text Completion API
8+
/// </summary>
69
public class PalmTextCompletionRequest
710
{
811
/// <summary>

src/LLMSharp.Google.Palm/TextService/PalmTextService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ internal sealed class PalmTextService : IPalmTextService
1919
/// <summary>
2020
/// Calls the text completion model and returns the response
2121
/// </summary>
22-
/// <param name="request">Request parameters like 'prompt', 'model' and other model response customization options</param>
22+
/// <param name="text">text to embed</param>
23+
/// <param name="model">embedding model to use</param>
2324
/// <param name="options">Options for the specific Grpc call</param>
2425
/// <param name="token">token for cancelling the request</param>
2526
/// <returns>TextCompletion response from the Palm Model</returns>
@@ -39,10 +40,9 @@ public async Task<IEnumerable<float>> GenerateEmbeddingsAsync(
3940
}
4041

4142
/// <summary>
42-
/// Calls the Palm Embedding Model to create an embedding for the text passed in.
43-
/// </summary>
44-
/// <param name="text">text to embed</param>
45-
/// <param name="model">embedding model to use</param>
43+
/// Calls the Palm Text Generation Model to create text completions for the prompt.
44+
/// </summary>
45+
/// <param name="request">Request parameters like 'prompt', 'model' and other model response customization options</param>
4646
/// <param name="options">Options for the specific Grpc call</param>
4747
/// <param name="token">token for cancelling the request</param>
4848
/// <returns>list of float values (embeddings) for the text.</returns>

0 commit comments

Comments
 (0)