Skip to content

Commit

Permalink
Nightly Build, fix other examples
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoDotIO committed Oct 27, 2023
1 parent a13440e commit 75f4984
Show file tree
Hide file tree
Showing 22 changed files with 555 additions and 188 deletions.
16 changes: 7 additions & 9 deletions Examples/iOS_Example/iOS_Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
761C24FD2940346B005066C2 /* EditExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761C24FC2940346B005066C2 /* EditExample.swift */; };
761C250429403883005066C2 /* EditImageExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761C250329403883005066C2 /* EditImageExample.swift */; };
761C250B2940392F005066C2 /* GenerateCompletionExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761C250A2940392F005066C2 /* GenerateCompletionExample.swift */; };
761C250D294039A8005066C2 /* GenerateImageVariationsExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761C250C294039A8005066C2 /* GenerateImageVariationsExample.swift */; };
Expand Down Expand Up @@ -41,12 +40,11 @@
7D4A910A2A87E110000A138A /* audio_translation.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 7D4A91092A87E110000A138A /* audio_translation.mp3 */; };
7D76E4F82AD46B7500E2F4C3 /* CreateChatFunctionCallExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D76E4F72AD46B7500E2F4C3 /* CreateChatFunctionCallExample.swift */; };
7DC0E9082A87CF97005C8763 /* CreateTranscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DC0E9072A87CF97005C8763 /* CreateTranscription.swift */; };
7DC0E90A2A87D046005C8763 /* audio.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 7DC0E9092A87D046005C8763 /* audio.mp3 */; };
7DDE422E29AFE567000BBB01 /* CreateChatCompletion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DDE422D29AFE567000BBB01 /* CreateChatCompletion.swift */; };
7DDF5CF62AD77AAC00A72E6B /* audio.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 7DDF5CF52AD77AAC00A72E6B /* audio.mp3 */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
761C24FC2940346B005066C2 /* EditExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditExample.swift; sourceTree = "<group>"; };
761C250329403883005066C2 /* EditImageExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditImageExample.swift; sourceTree = "<group>"; };
761C250A2940392F005066C2 /* GenerateCompletionExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerateCompletionExample.swift; sourceTree = "<group>"; };
761C250C294039A8005066C2 /* GenerateImageVariationsExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerateImageVariationsExample.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -81,8 +79,8 @@
7D4A91092A87E110000A138A /* audio_translation.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = audio_translation.mp3; sourceTree = "<group>"; };
7D76E4F72AD46B7500E2F4C3 /* CreateChatFunctionCallExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateChatFunctionCallExample.swift; sourceTree = "<group>"; };
7DC0E9072A87CF97005C8763 /* CreateTranscription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateTranscription.swift; sourceTree = "<group>"; };
7DC0E9092A87D046005C8763 /* audio.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = audio.mp3; path = ../audio.mp3; sourceTree = "<group>"; };
7DDE422D29AFE567000BBB01 /* CreateChatCompletion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateChatCompletion.swift; sourceTree = "<group>"; };
7DDF5CF52AD77AAC00A72E6B /* audio.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = audio.mp3; path = ../../../../../../../Downloads/audio.mp3; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -101,7 +99,6 @@
isa = PBXGroup;
children = (
761C250A2940392F005066C2 /* GenerateCompletionExample.swift */,
761C24FC2940346B005066C2 /* EditExample.swift */,
765BB1D829404D52000BF124 /* CompletionMainView.swift */,
);
path = Completion;
Expand Down Expand Up @@ -243,8 +240,8 @@
7DC0E90B2A87D04D005C8763 /* Sound */ = {
isa = PBXGroup;
children = (
7DDF5CF52AD77AAC00A72E6B /* audio.mp3 */,
7D4A91092A87E110000A138A /* audio_translation.mp3 */,
7DC0E9092A87D046005C8763 /* audio.mp3 */,
);
path = Sound;
sourceTree = "<group>";
Expand Down Expand Up @@ -291,7 +288,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1410;
LastUpgradeCheck = 1410;
LastUpgradeCheck = 1500;
TargetAttributes = {
76C0C24F293FB7CC003075D2 = {
CreatedOnToolsVersion = 14.1;
Expand Down Expand Up @@ -322,11 +319,11 @@
buildActionMask = 2147483647;
files = (
76C0C25B293FB7CE003075D2 /* Preview Assets.xcassets in Resources */,
7DDF5CF62AD77AAC00A72E6B /* audio.mp3 in Resources */,
765BB20229405723000BF124 /* mask.png in Resources */,
765BB20129405723000BF124 /* variation.png in Resources */,
7D4A910A2A87E110000A138A /* audio_translation.mp3 in Resources */,
76C0C258293FB7CE003075D2 /* Assets.xcassets in Resources */,
7DC0E90A2A87D046005C8763 /* audio.mp3 in Resources */,
761C253129404086005066C2 /* SampleData.jsonl in Resources */,
765BB20329405723000BF124 /* image.png in Resources */,
);
Expand All @@ -351,7 +348,6 @@
765BB1D929404D52000BF124 /* CompletionMainView.swift in Sources */,
76C0C256293FB7CC003075D2 /* ContentView.swift in Sources */,
761C251329403AC7005066C2 /* GenerateImageExample.swift in Sources */,
761C24FD2940346B005066C2 /* EditExample.swift in Sources */,
761C251B29403CD2005066C2 /* FileDetailsView.swift in Sources */,
761C252C2940400B005066C2 /* RetrieveModelExample.swift in Sources */,
761C251729403CA0005066C2 /* ListFilesExample.swift in Sources */,
Expand Down Expand Up @@ -408,6 +404,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -468,6 +465,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ struct CreateTranscriptionExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(
organizationId: "INSERT-ORGANIZATION-ID",
apiKey: "INSERT-API-KEY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct CreateChatCompletionExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(
organizationId: "INSERT-ORGANIZATION-ID",
apiKey: "INSERT-API-KEY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct CreateChatCompletionStreamingExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(
organizationId: "INSERT-ORGANIZATION-ID",
apiKey: "INSERT-API-KEY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct CreateChatFunctionCallExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(
organizationId: "INSERT-ORGANIZATION-ID",
apiKey: "INSERT-API-KEY"
Expand All @@ -82,6 +83,7 @@ struct CreateChatFunctionCallExample: View {
functionCall: "auto",
functions: functions
)

let chatCompletion = try await openAI.generateChatCompletion(
parameters: chatParameters
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ struct CompletionMainView: View {
NavigationLink(destination: GenerateCompletionExample()) {
Text("Generate Completion Example")
}

NavigationLink(destination: EditExample()) {
Text("Edit Example")
}
}
.listStyle(.plain)
.navigationTitle("Completion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct GenerateCompletionExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(
organizationId: "INSERT-ORGANIZATION-ID",
apiKey: "INSERT-API-KEY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct ContentPolicyExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let openAI = OpenAI(Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY"))
let contentParameter = ContentPolicyParameters(input: input)
let contentResult = try await openAI.checkContentPolicy(parameters: contentParameter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ struct CreateEmbeddingsExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY")
let openAI = OpenAI(config)
let embeddingsParam = EmbeddingsParameters(model: "text-similarity-babbage-001", input: input)
let embeddingsParam = EmbeddingsParameters(model: "text-similarity-ada-002", input: input)

self.embeddingsResponse = try await openAI.createEmbeddings(parameters: embeddingsParam)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct DeleteFileExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY")
let openAI = OpenAI(config)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct ListFilesExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY")
let openAI = OpenAI(config)
let filesResponse = try await openAI.listFiles()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct RetrieveFileContentsExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY")
let openAI = OpenAI(config)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct RetrieveFileExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY")
let openAI = OpenAI(config)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct UploadFileExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY")
let openAI = OpenAI(config)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct EditImageExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(
organizationId: "INSERT-ORGANIZATION-ID",
apiKey: "INSERT-API-KEY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ struct GenerateImageExample: View {
VStack {
Button {
isGenerating = true

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(
organizationId: "INSERT-ORGANIZATION-ID",
apiKey: "INSERT-API-KEY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct GenerateImageVariationExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(
organizationId: "INSERT-ORGANIZATION-ID",
apiKey: "INSERT-API-KEY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct ListModelsExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(
organizationId: "INSERT-ORGANIZATION-ID",
apiKey: "INSERT-API-KEY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct RetrieveModelExample: View {

Task {
do {
// ⚠️🔑 NEVER store OpenAI API keys directly in code. Use environment variables or secrets management. Avoid git commits of keys! 🔑⚠️
let config = Configuration(organizationId: "INSERT-ORGANIZATION-ID", apiKey: "INSERT-API-KEY")
let openAI = OpenAI(config)

Expand Down
Loading

0 comments on commit 75f4984

Please sign in to comment.