Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit initial project structure of the OpenAI library for .NET #1

Merged
merged 8 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix example output format
  • Loading branch information
joseharriaga committed Jun 3, 2024
commit 665fb0623a80ffb5203b5ee6456b01b29e95c363
20 changes: 12 additions & 8 deletions examples/Audio/Example03_VerboseTranscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@ public void Example03_VerboseTranscription()

AudioTranscription transcription = client.TranscribeAudio(audioFilePath, options);

Console.WriteLine($"[TRANSCRIPTION]: {transcription.Text}");
Console.WriteLine($"[WORDS]:");
foreach (TranscribedWord wordItem in transcription.Words)
Console.WriteLine("Transcription:");
Console.WriteLine($"{transcription.Text}");

Console.WriteLine();
Console.WriteLine($"Words:");
foreach (TranscribedWord word in transcription.Words)
{
Console.WriteLine($" {wordItem.Word,10}: {wordItem.Start.TotalMilliseconds,4:0} - {wordItem.End.TotalMilliseconds,4:0}");
Console.WriteLine($" {word.Word,15} : {word.Start.TotalMilliseconds,5:0} - {word.End.TotalMilliseconds,5:0}");
}
Console.WriteLine($"[SEGMENTS]:");
foreach (TranscribedSegment segmentItem in transcription.Segments)

Console.WriteLine();
Console.WriteLine($"Segments:");
foreach (TranscribedSegment segment in transcription.Segments)
{
Console.WriteLine($" {segmentItem.Id,10}: {segmentItem.Text}: "
+ $"{segmentItem.Start.TotalMilliseconds,4:0} - {segmentItem.End.TotalMilliseconds,4:0}");
Console.WriteLine($" {segment.Text,90} : {segment.Start.TotalMilliseconds,5:0} - {segment.End.TotalMilliseconds,5:0}");
}
}
}
20 changes: 12 additions & 8 deletions examples/Audio/Example03_VerboseTrascriptionAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ public async Task Example03_VerboseTranscriptionAsync()

AudioTranscription transcription = await client.TranscribeAudioAsync(audioFilePath, options);

Console.WriteLine($"[TRANSCRIPTION]: {transcription.Text}");
Console.WriteLine($"[WORDS]:");
foreach (TranscribedWord wordItem in transcription.Words)
Console.WriteLine("Transcription:");
Console.WriteLine($"{transcription.Text}");

Console.WriteLine();
Console.WriteLine($"Words:");
foreach (TranscribedWord word in transcription.Words)
{
Console.WriteLine($" {wordItem.Word,10}: {wordItem.Start.TotalMilliseconds,4:0} - {wordItem.End.TotalMilliseconds,4:0}");
Console.WriteLine($" {word.Word,15} : {word.Start.TotalMilliseconds,5:0} - {word.End.TotalMilliseconds,5:0}");
}
Console.WriteLine($"[SEGMENTS]:");
foreach (TranscribedSegment segmentItem in transcription.Segments)

Console.WriteLine();
Console.WriteLine($"Segments:");
foreach (TranscribedSegment segment in transcription.Segments)
{
Console.WriteLine($" {segmentItem.Id,10}: {segmentItem.Text}: "
+ $"{segmentItem.Start.TotalMilliseconds,4:0} - {segmentItem.End.TotalMilliseconds,4:0}");
Console.WriteLine($" {segment.Text,90} : {segment.Start.TotalMilliseconds,5:0} - {segment.End.TotalMilliseconds,5:0}");
}
}
}
2 changes: 1 addition & 1 deletion examples/Embeddings/Example01_SimpleEmbedding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void Example01_SimpleEmbedding()
Console.WriteLine($"Floats: ");
for (int i = 0; i < vector.Length; i++)
{
Console.WriteLine($" [{i}] = {vector.Span[i]}");
Console.WriteLine($" [{i,4}] = {vector.Span[i]}");
}
}
}
2 changes: 1 addition & 1 deletion examples/Embeddings/Example01_SimpleEmbeddingAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task Example01_SimpleEmbeddingAsync()
Console.WriteLine($"Floats: ");
for (int i = 0; i < vector.Length; i++)
{
Console.WriteLine($" [{i}] = {vector.Span[i]}");
Console.WriteLine($" [{i,4}] = {vector.Span[i]}");
}
}
}
2 changes: 1 addition & 1 deletion examples/Embeddings/Example02_EmbeddingWithOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void Example02_EmbeddingWithOptions()
Console.WriteLine($"Floats: ");
for (int i = 0; i < vector.Length; i++)
{
Console.WriteLine($" [{i}] = {vector.Span[i]}");
Console.WriteLine($" [{i,3}] = {vector.Span[i]}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task Example02_EmbeddingWithOptionsAsync()
Console.WriteLine($"Floats: ");
for (int i = 0; i < vector.Length; i++)
{
Console.WriteLine($" [{i}] = {vector.Span[i]}");
Console.WriteLine($" [{i,3}] = {vector.Span[i]}");
}
}
}
2 changes: 1 addition & 1 deletion examples/Embeddings/Example03_MultipleEmbeddings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void Example03_MultipleEmbeddings()
Console.WriteLine($"Floats: ");
for (int i = 0; i < vector.Length; i++)
{
Console.WriteLine($" [{i}] = {vector.Span[i]}");
Console.WriteLine($" [{i,4}] = {vector.Span[i]}");
}

Console.WriteLine();
Expand Down
2 changes: 1 addition & 1 deletion examples/Embeddings/Example03_MultipleEmbeddingsAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task Example03_MultipleEmbeddingsAsync()
Console.WriteLine($"Floats: ");
for (int i = 0; i < vector.Length; i++)
{
Console.WriteLine($" [{i}] = {vector.Span[i]}");
Console.WriteLine($" [{i,4}] = {vector.Span[i]}");
}

Console.WriteLine();
Expand Down