From 0c9fae6ceeceaa07dd57f345f6fa492bb1ddbff4 Mon Sep 17 00:00:00 2001 From: HavenDV Date: Sun, 15 Sep 2024 07:17:54 +0400 Subject: [PATCH] docs: Added ReaderLm case. --- .../Ollama.IntegrationTests/Tests.ReaderLm.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 src/tests/Ollama.IntegrationTests/Tests.ReaderLm.cs diff --git a/src/tests/Ollama.IntegrationTests/Tests.ReaderLm.cs b/src/tests/Ollama.IntegrationTests/Tests.ReaderLm.cs new file mode 100755 index 0000000..402ce83 --- /dev/null +++ b/src/tests/Ollama.IntegrationTests/Tests.ReaderLm.cs @@ -0,0 +1,34 @@ +namespace Ollama.IntegrationTests; + +public partial class Tests +{ + [TestMethod] + public async Task ReaderLm() + { +#if DEBUG + await using var container = await PrepareEnvironmentAsync(EnvironmentType.Local, "reader-lm:latest"); +#else + await using var container = await PrepareEnvironmentAsync(EnvironmentType.Container, "reader-lm:latest"); +#endif + + var enumerable = container.ApiClient.Completions.GenerateCompletionAsync( + "reader-lm:latest", + """ + + +

Why is the sky blue?

+

The sky appears blue because of the way light from the sun is reflected by the atmosphere. The atmosphere is made up of gases, including nitrogen and oxygen, which scatter light in all directions. This scattering causes the sunlight to appear as a rainbow of colors, with red light scattered more than other colors. +

+ + + """); + await foreach (var response in enumerable) + { + Console.Write(response.Response); + } + + // ### Why is the sky blue? + // + // The sky appears blue because of the way light from the sun is reflected by the atmosphere. The atmosphere is made up of gases, including nitrogen and oxygen, which scatter light in all directions. This scattering causes the sunlight to appear as a rainbow of colors, with red light scattered more than other colors. + } +} \ No newline at end of file