Repository: hexthedev/OpenAi-Api-Unity Branch: main Commit: 67658d9694f6 Files: 252 Total size: 358.7 KB Directory structure: gitextract_1dt47_oh/ ├── .github/ │ ├── scripts/ │ │ ├── prChangelog_NoAuth.py │ │ └── versionUpdater.py │ └── workflows/ │ └── unitypackage.yml ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── Documentation/ │ ├── 1_Overview.md │ ├── 1_Overview.md.meta │ ├── 2_Authentication.md │ ├── 2_Authentication.md.meta │ ├── 3_ApiCalls.md │ ├── 3_ApiCalls.md.meta │ ├── 4_JsonSerialization.md │ └── 4_JsonSerialization.md.meta ├── Documentation.meta ├── Editor/ │ ├── Scripts/ │ │ ├── Examples/ │ │ │ ├── EMExampleChatRuntimeScene.cs │ │ │ ├── EMExampleChatRuntimeScene.cs.meta │ │ │ ├── EMExampleOpenAiApiRuntimeScene.cs │ │ │ ├── EMExampleOpenAiApiRuntimeScene.cs.meta │ │ │ ├── ExampleOpenAiApiUnityEditor.cs │ │ │ └── ExampleOpenAiApiUnityEditor.cs.meta │ │ ├── Examples.meta │ │ ├── Unity/ │ │ │ ├── V1/ │ │ │ │ ├── Auth/ │ │ │ │ │ ├── SOAuthArgsV1Editor.cs │ │ │ │ │ └── SOAuthArgsV1Editor.cs.meta │ │ │ │ ├── Auth.meta │ │ │ │ ├── EMPrefabs.cs │ │ │ │ └── EMPrefabs.cs.meta │ │ │ └── V1.meta │ │ └── Unity.meta │ ├── Scripts.meta │ ├── openai.api.unity.editor.asmdef │ └── openai.api.unity.editor.asmdef.meta ├── Editor.meta ├── License.md ├── License.md.meta ├── README.md ├── README.md.meta ├── Runtime/ │ ├── Config/ │ │ ├── DefaultAuthArgsV1.asset │ │ ├── DefaultAuthArgsV1.asset.meta │ │ ├── DefaultChatCompletionArgs.asset │ │ ├── DefaultChatCompletionArgs.asset.meta │ │ ├── DefaultCompletionArgs.asset │ │ └── DefaultCompletionArgs.asset.meta │ ├── Config.meta │ ├── Prefabs/ │ │ ├── OpenAiApiGatewayV1.prefab │ │ ├── OpenAiApiGatewayV1.prefab.meta │ │ ├── OpenAiChatCompleterV1.prefab │ │ ├── OpenAiChatCompleterV1.prefab.meta │ │ ├── OpenAiCompleterV1.prefab │ │ └── OpenAiCompleterV1.prefab.meta │ ├── Prefabs.meta │ ├── Scenes/ │ │ ├── ExampleChatRuntimeScene.unity │ │ ├── ExampleChatRuntimeScene.unity.meta │ │ ├── ExampleOpenAiApiRuntimeScene.unity │ │ └── ExampleOpenAiApiRuntimeScene.unity.meta │ ├── Scenes.meta │ ├── Scripts/ │ │ ├── Api/ │ │ │ ├── Base/ │ │ │ │ ├── AApiResource.cs │ │ │ │ ├── AApiResource.cs.meta │ │ │ │ ├── ApiResult.cs │ │ │ │ ├── ApiResult.cs.meta │ │ │ │ ├── IApiResource.cs │ │ │ │ ├── IApiResource.cs.meta │ │ │ │ ├── OpenAiApiException.cs │ │ │ │ └── OpenAiApiException.cs.meta │ │ │ ├── Base.meta │ │ │ ├── Utility/ │ │ │ │ ├── EChatModelNames/ │ │ │ │ │ ├── EChatModelName.cs │ │ │ │ │ └── EChatModelName.cs.meta │ │ │ │ ├── EChatModelNames.meta │ │ │ │ ├── EngineNames/ │ │ │ │ │ ├── EEngineName.cs │ │ │ │ │ ├── EEngineName.cs.meta │ │ │ │ │ ├── UTEngineNames.cs │ │ │ │ │ └── UTEngineNames.cs.meta │ │ │ │ ├── EngineNames.meta │ │ │ │ ├── StringOrArray.cs │ │ │ │ ├── StringOrArray.cs.meta │ │ │ │ ├── UnityWebRequestAsync/ │ │ │ │ │ ├── UnityWebRequestAwaiter.cs │ │ │ │ │ ├── UnityWebRequestAwaiter.cs.meta │ │ │ │ │ ├── UnityWebRequestExtensions.cs │ │ │ │ │ └── UnityWebRequestExtensions.cs.meta │ │ │ │ └── UnityWebRequestAsync.meta │ │ │ ├── Utility.meta │ │ │ ├── V1/ │ │ │ │ ├── Api/ │ │ │ │ │ ├── Chat/ │ │ │ │ │ │ ├── ChatResourceV1.cs │ │ │ │ │ │ ├── ChatResourceV1.cs.meta │ │ │ │ │ │ ├── Completions/ │ │ │ │ │ │ │ ├── ChatCompletionRequestV1.cs │ │ │ │ │ │ │ ├── ChatCompletionRequestV1.cs.meta │ │ │ │ │ │ │ ├── ChatCompletionsResourceV1.cs │ │ │ │ │ │ │ └── ChatCompletionsResourceV1.cs.meta │ │ │ │ │ │ └── Completions.meta │ │ │ │ │ ├── Chat.meta │ │ │ │ │ ├── Engines/ │ │ │ │ │ │ ├── Engine/ │ │ │ │ │ │ │ ├── Completions/ │ │ │ │ │ │ │ │ ├── CompletionRequestV1.cs │ │ │ │ │ │ │ │ ├── CompletionRequestV1.cs.meta │ │ │ │ │ │ │ │ ├── CompletionsResourceV1.cs │ │ │ │ │ │ │ │ └── CompletionsResourceV1.cs.meta │ │ │ │ │ │ │ ├── Completions.meta │ │ │ │ │ │ │ ├── EngineResourceV1.cs │ │ │ │ │ │ │ └── EngineResourceV1.cs.meta │ │ │ │ │ │ ├── Engine.meta │ │ │ │ │ │ ├── EnginesResourceV1.cs │ │ │ │ │ │ └── EnginesResourceV1.cs.meta │ │ │ │ │ ├── Engines.meta │ │ │ │ │ ├── Files/ │ │ │ │ │ │ ├── File/ │ │ │ │ │ │ │ ├── FileResourceV1.cs │ │ │ │ │ │ │ └── FileResourceV1.cs.meta │ │ │ │ │ │ ├── File.meta │ │ │ │ │ │ ├── FilesResourceV1.cs │ │ │ │ │ │ └── FilesResourceV1.cs.meta │ │ │ │ │ └── Files.meta │ │ │ │ ├── Api.meta │ │ │ │ ├── Models/ │ │ │ │ │ ├── AnswerV1.cs │ │ │ │ │ ├── AnswerV1.cs.meta │ │ │ │ │ ├── ChatChoiceV1.cs │ │ │ │ │ ├── ChatChoiceV1.cs.meta │ │ │ │ │ ├── ChatCompletionV1.cs │ │ │ │ │ ├── ChatCompletionV1.cs.meta │ │ │ │ │ ├── ChoiceV1.cs │ │ │ │ │ ├── ChoiceV1.cs.meta │ │ │ │ │ ├── ClassificationV1.cs │ │ │ │ │ ├── ClassificationV1.cs.meta │ │ │ │ │ ├── CompletionV1.cs │ │ │ │ │ ├── CompletionV1.cs.meta │ │ │ │ │ ├── DeltaV1.cs │ │ │ │ │ ├── DeltaV1.cs.meta │ │ │ │ │ ├── EngineV1.cs │ │ │ │ │ ├── EngineV1.cs.meta │ │ │ │ │ ├── EnginesListV1.cs │ │ │ │ │ ├── EnginesListV1.cs.meta │ │ │ │ │ ├── FileV1.cs │ │ │ │ │ ├── FileV1.cs.meta │ │ │ │ │ ├── FilesListV1.cs │ │ │ │ │ ├── FilesListV1.cs.meta │ │ │ │ │ ├── LabeledExampleV1.cs │ │ │ │ │ ├── LabeledExampleV1.cs.meta │ │ │ │ │ ├── MessageV1.cs │ │ │ │ │ ├── MessageV1.cs.meta │ │ │ │ │ ├── QuestionAnswerPairV1.cs │ │ │ │ │ ├── QuestionAnswerPairV1.cs.meta │ │ │ │ │ ├── SearchListV1.cs │ │ │ │ │ ├── SearchListV1.cs.meta │ │ │ │ │ ├── SearchV1.cs │ │ │ │ │ ├── SearchV1.cs.meta │ │ │ │ │ ├── SelectedDocumentV1.cs │ │ │ │ │ ├── SelectedDocumentV1.cs.meta │ │ │ │ │ ├── SelectedExampleV1.cs │ │ │ │ │ ├── SelectedExampleV1.cs.meta │ │ │ │ │ ├── UsageV1.cs │ │ │ │ │ └── UsageV1.cs.meta │ │ │ │ ├── Models.meta │ │ │ │ ├── OpenAiApiV1.cs │ │ │ │ ├── OpenAiApiV1.cs.meta │ │ │ │ ├── SAuthArgsV1.cs │ │ │ │ ├── SAuthArgsV1.cs.meta │ │ │ │ ├── _abstract/ │ │ │ │ │ ├── AModelV1.cs │ │ │ │ │ └── AModelV1.cs.meta │ │ │ │ └── _abstract.meta │ │ │ └── V1.meta │ │ ├── Api.meta │ │ ├── Examples/ │ │ │ ├── ExampleChatRuntime.cs │ │ │ ├── ExampleChatRuntime.cs.meta │ │ │ ├── ExampleOpenAiApiRuntime.cs │ │ │ └── ExampleOpenAiApiRuntime.cs.meta │ │ ├── Examples.meta │ │ ├── Json/ │ │ │ ├── Deserialization/ │ │ │ │ ├── JsonDeserializer.cs │ │ │ │ ├── JsonDeserializer.cs.meta │ │ │ │ ├── JsonObject.cs │ │ │ │ ├── JsonObject.cs.meta │ │ │ │ ├── LexicalAnalysis/ │ │ │ │ │ ├── CharacterAnalyzer/ │ │ │ │ │ │ ├── BaseAnalyzer.cs │ │ │ │ │ │ ├── BaseAnalyzer.cs.meta │ │ │ │ │ │ ├── ECharacterAnalyzerResponse.cs │ │ │ │ │ │ ├── ECharacterAnalyzerResponse.cs.meta │ │ │ │ │ │ ├── ICharacterAnalyzer.cs │ │ │ │ │ │ ├── ICharacterAnalyzer.cs.meta │ │ │ │ │ │ ├── StringAnalyzer.cs │ │ │ │ │ │ └── StringAnalyzer.cs.meta │ │ │ │ │ ├── CharacterAnalyzer.meta │ │ │ │ │ ├── JsonLexer.cs │ │ │ │ │ └── JsonLexer.cs.meta │ │ │ │ ├── LexicalAnalysis.meta │ │ │ │ ├── SyntacticAnalysis/ │ │ │ │ │ ├── EJsonType.cs │ │ │ │ │ ├── EJsonType.cs.meta │ │ │ │ │ ├── JsonSyntaxAnalyzer.cs │ │ │ │ │ └── JsonSyntaxAnalyzer.cs.meta │ │ │ │ ├── SyntacticAnalysis.meta │ │ │ │ ├── UTJsonDeserialization.cs │ │ │ │ └── UTJsonDeserialization.cs.meta │ │ │ ├── Deserialization.meta │ │ │ ├── IJsonable.cs │ │ │ ├── IJsonable.cs.meta │ │ │ ├── OpenAiJsonException.cs │ │ │ ├── OpenAiJsonException.cs.meta │ │ │ ├── Serialization/ │ │ │ │ ├── JsonBuilder.cs │ │ │ │ └── JsonBuilder.cs.meta │ │ │ └── Serialization.meta │ │ ├── Json.meta │ │ ├── Unity/ │ │ │ ├── Util/ │ │ │ │ ├── AMonoSingleton.cs │ │ │ │ └── AMonoSingleton.cs.meta │ │ │ ├── Util.meta │ │ │ ├── V1/ │ │ │ │ ├── Auth/ │ │ │ │ │ ├── SOAuthArgsV1.cs │ │ │ │ │ └── SOAuthArgsV1.cs.meta │ │ │ │ ├── Auth.meta │ │ │ │ ├── ChatCompleter/ │ │ │ │ │ ├── OpenAiChatCompleterV1.cs │ │ │ │ │ ├── OpenAiChatCompleterV1.cs.meta │ │ │ │ │ ├── SOChatCompletionArgsV1.cs │ │ │ │ │ └── SOChatCompletionArgsV1.cs.meta │ │ │ │ ├── ChatCompleter.meta │ │ │ │ ├── Completer/ │ │ │ │ │ ├── OpenAiCompleterV1.cs │ │ │ │ │ ├── OpenAiCompleterV1.cs.meta │ │ │ │ │ ├── SOCompletionArgsV1.cs │ │ │ │ │ └── SOCompletionArgsV1.cs.meta │ │ │ │ ├── Completer.meta │ │ │ │ ├── Gateway/ │ │ │ │ │ ├── OpenAiApiGatewayV1.cs │ │ │ │ │ └── OpenAiApiGatewayV1.cs.meta │ │ │ │ └── Gateway.meta │ │ │ └── V1.meta │ │ └── Unity.meta │ ├── Scripts.meta │ ├── openai.api.unity.asmdef │ └── openai.api.unity.asmdef.meta ├── Runtime.meta ├── Tests/ │ ├── Editor/ │ │ ├── Scripts/ │ │ │ ├── Core/ │ │ │ │ ├── V1/ │ │ │ │ │ ├── Models/ │ │ │ │ │ │ ├── CompletionRequestModelTests.cs │ │ │ │ │ │ └── CompletionRequestModelTests.cs.meta │ │ │ │ │ └── Models.meta │ │ │ │ └── V1.meta │ │ │ ├── Core.meta │ │ │ ├── Json/ │ │ │ │ ├── JsonDeserializerTests.cs │ │ │ │ ├── JsonDeserializerTests.cs.meta │ │ │ │ ├── LexicalAnalysis/ │ │ │ │ │ ├── JsonLexerTests.cs │ │ │ │ │ └── JsonLexerTests.cs.meta │ │ │ │ ├── LexicalAnalysis.meta │ │ │ │ ├── SyntacticAnalysis/ │ │ │ │ │ ├── JsonSyntaxAnalyzerTests.cs │ │ │ │ │ └── JsonSyntaxAnalyzerTests.cs.meta │ │ │ │ ├── SyntacticAnalysis.meta │ │ │ │ ├── UTJsonObjectTests.cs │ │ │ │ └── UTJsonObjectTests.cs.meta │ │ │ └── Json.meta │ │ ├── Scripts.meta │ │ ├── openai.api.unity.editor.tests.asmdef │ │ └── openai.api.unity.editor.tests.asmdef.meta │ ├── Editor.meta │ ├── Runtime/ │ │ ├── Scripts/ │ │ │ ├── Core/ │ │ │ │ ├── V1/ │ │ │ │ │ ├── V1BugTests.cs │ │ │ │ │ ├── V1BugTests.cs.meta │ │ │ │ │ ├── V1PlayTests.cs │ │ │ │ │ └── V1PlayTests.cs.meta │ │ │ │ └── V1.meta │ │ │ ├── Core.meta │ │ │ ├── Utility/ │ │ │ │ ├── TestManager.cs │ │ │ │ └── TestManager.cs.meta │ │ │ └── Utility.meta │ │ ├── Scripts.meta │ │ ├── openai.api.unity.tests.asmdef │ │ └── openai.api.unity.tests.asmdef.meta │ └── Runtime.meta ├── Tests.meta ├── package.json └── package.json.meta ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/scripts/prChangelog_NoAuth.py ================================================ # Gets the PR associated with a commit and then writes all of the commit messages to a changelog # sys.argv[1] = reponame # sys.argv[2] = SHA key of commit to test # sys.argv[3] = path to change log import json import sys import requests repo = sys.argv[1] sha = sys.argv[2] changelogPath = sys.argv[3] # Get the pull request that's related to the commit pulls_url = f"https://api.github.com/repos/hexthedev/{repo}/commits/{sha}/pulls" pulls_headers = { 'User-Agent' : 'hexthedev', 'Accept' : 'application/vnd.github.groot-preview+json' } pulls_req = requests.get(pulls_url, headers = pulls_headers) if pulls_req.status_code != 200: # If status fails, stop changelog creation raise Exception(f'Cannot retrieve pulls from commit:{sha} in repo:{repo}') pulls_json = json.loads(pulls_req.text) # Follow the commits link and get the commit messages in order commits_url = pulls_json[0]["_links"]["commits"]["href"] commits_headers = { 'User-Agent' : 'hexthedev' } commits_req = requests.get(commits_url, headers = commits_headers) if commits_req.status_code != 200: raise Exception(f'Cannot get commit messages from {commits_url}') commits_json = json.loads(commits_req.text) # Write the changelog commits_list = [] for commit in commits_json: commits_list.append(commit["commit"]["message"]) with open(changelogPath, 'w') as f: f.truncate(0) for com in commits_list: f.write(f'* {com}\n') ================================================ FILE: .github/scripts/versionUpdater.py ================================================ import json import sys import os path = sys.argv[1] outjson = {} newVersion = "" with open(path, 'r') as f: j = json.load(f) s = j["version"] spl = s.split(".") spl[2] = str(int(spl[2])+1) newVersion = ".".join(spl) j["version"] = newVersion outjson = j with open(path, 'w') as f: json.dump(outjson, f) # Output print(newVersion) ================================================ FILE: .github/workflows/unitypackage.yml ================================================ name: unitypackage on: push: branches: - main paths-ignore: - './CHANGELOG.md' - './package.json' env: VAR_NAME: value jobs: build_job: name: Build Job runs-on: ubuntu-20.04 steps: # ----- DEPENDENCIES ----- # Install the pip dependencies - name: Install Dependencies run: pip install requests # ----- CHECKOUT ----- # Checks out a copy of your repository on the ubuntu-latest - name: Checkout code uses: actions/checkout@v2 # ----- WORK ----- # Update a version in some json - name: Run a test python script version update run: | export BUMPED_VERSION=`python ./.github/scripts/versionUpdater.py ./package.json` echo "::set-output name=version::$BUMPED_VERSION" id: versioner # Get the SHA of the current git head - name: Output SHA Head # Note: You can pass command sup through stdout run: | export CUR_SHA=`git rev-parse HEAD` echo "::set-output name=sha::$CUR_SHA" id: head_sha # Create the changleog using the commit sha and grabbing the commit messages - name: Run a changelog creator run: python ./.github/scripts/prChangelog_NoAuth.py ${{ github.event.repository.name }} ${{steps.head_sha.outputs.sha}} ./CHANGELOG.md # Commit the changes to the repo - name: Do git commit run: | git config user.name hexthedev git config user.email jamesmccafferty@live.ca git add . git commit -m "Github Actions Commit" git push # ----- RELEASE ----- # Get the SHA of the current HEAD (after the commit) - name: Output SHA Head # Note: You can pass command sup through stdout run: | export CUR_SHA=`git rev-parse HEAD` echo "::set-output name=sha::$CUR_SHA" id: head_sha_new # Make a Release at the commit - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token with: tag_name: v${{ steps.versioner.outputs.version }} release_name: Release v${{ steps.versioner.outputs.version }} body_path: CHANGELOG.md draft: false prerelease: true commitish : ${{steps.head_sha_new.outputs.sha}} ================================================ FILE: CHANGELOG.md ================================================ * version specific UnityWebRequest.Post | UnityWebRequest.PostWwwForm * Merge branch 'hexthedev:main' into uwr_2022 ================================================ FILE: CHANGELOG.md.meta ================================================ fileFormatVersion: 2 guid: 79adca46a4928e1469b0b75ab7f94ae6 TextScriptImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Documentation/1_Overview.md ================================================ # Context The `OpenAi Api Unity` library is a wrapper for the OpenAI Api. The following technical decisions were made during development: * All json serialization and deserialization is performed with a custom serializer so that the library has no dependencies * Classes and objects were created to make the libraries api call syntax as close to the api calls shown in the [OpenAi Api Reference](https://beta.openai.com/docs/api-reference) * All Api calls are implemented in two ways, as async functions and as Coroutines. ## Getting Started All api calls are accessible through the `OpenAiApiV1` object. When created, it requires initialization with a `SAuthArgsV1` which provides the authentication keys. For details [See Authentication](https://github.com/hexthedev/OpenAi-Api-Unity/blob/main/Documentation/2_Authentication.md) `OpenAiApiV1` is not a `MonoBehaviour`, so it needs to be initalized somewhere to be used in a scene. The `OpenAiApiGatewayV1` prefab is a singleton that handles the initalization of the `OpenAiApiV1` automatically during the `Start()` method. This can be added via the menu `OpenAi > V1 > CreateGateway`. You can also disable the automatic initalization on `Start()`, and instead initalize the `OpenAiApiV1` manually. The `OpenAiApiV1` object is accessed through `OpenAiApiGatewayV1.Instance.Api`. For details [See ApiCalls](https://github.com/hexthedev/OpenAi-Api-Unity/blob/main/Documentation/3_ApiCalls.md) Once you're able to access the `OpenAiApiV1` object, all api calls follow the [OpenAi Api Reference](https://beta.openai.com/docs/api-reference) as closely as possible. For example, the api call `https://api.openai.com/v1/engines/{engine_id}/completions` called Create Completions in the docs is called using the pattern `OpenAiApiV1Instance.Engines.Engine("").Completions.CreateCompletion`. For details [See ApiCalls](https://github.com/hexthedev/OpenAi-Api-Unity/blob/main/Documentation/3_ApiCalls.md) ## Serialization A custom json serializer/deserializer was implemented to remove a dependency on Newtonsoft. This was the make the library more lightweight and to avoid some problems compiling Newtonsoft on some platforms. For details [See JsonSerialization](https://github.com/hexthedev/OpenAi-Api-Unity/blob/main/Documentation/4_JsonSerialization.md) ================================================ FILE: Documentation/1_Overview.md.meta ================================================ fileFormatVersion: 2 guid: 68aabfede4eeba444abc34db5c63b1e7 TextScriptImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Documentation/2_Authentication.md ================================================ # Context The `OpenAi Api` is currently in beta. In order to get access you need a private api key which is aquired by signing up for the beta at the [OpenAi Api Website](https://beta.openai.com/). When accepted you'll be able to access your api key on the [Developer QuickStart Page](https://beta.openai.com/docs/developer-quickstart) Individuals that are part of an organization can also use an organization key. I'm not sure where this is found, as I do not have one. The organization key is used when individuals are using api quotas from multiple organizations, and they want to specify which quota to use. # Authenticating in OpenAi Api Unity Authentication info is entered in the `SOAuthArgsV1` object. This Scriptble Object is a required input for all API prefabs. The `SOAuthArgsV1` has two modes. * Local File * String ### Local File Local file mode pulls a json from a the local file path `~/.openai/auth.json` (Linux/Mac) or `%USERPROFILE%/.openai/auth.json` (Windows). The json should be formatted as follows: ```json // auth.json { "private_api_key":"", (optional) "organization":"" } ``` The file is read and deserailized when the `OpenAiApiGatewayV1` is initialized ### String String mode lets user input their OpenAI Api credentials as plain text strings. This is a bad idea in most cases though, because commiting this to a public repo reveals your key. ================================================ FILE: Documentation/2_Authentication.md.meta ================================================ fileFormatVersion: 2 guid: 6af7f80e91631e244887f81043fc5a06 TextScriptImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Documentation/3_ApiCalls.md ================================================ # Context The `OpenAi Api Unity` library is a wrapper for REST API calls made to the OpenAi Api. REST API calls are HTTP requests sent directly to the OpenAI Api resource endpoints with some simple authentication. An example of an actual api call looks something like this: ``` https://api.openai.com/v1/engines/davinci/completions ``` You can read more about the details of these api calls using the [OpenAi Api Reference](https://beta.openai.com/docs/api-reference) The `OpenAi Api Unity` library implements these Api calls using Unity's built-in [UnityWebRequest](https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.html) class and a custom Json Serailizer/Deserializer. HTTP requests cannot occur syncronously without causing the thread to pause. This is not ideal, so all api calls are implemented as `async` functions and as Coroutines. # MonoBehaviours The `OpenAiApiGatewayV1` is a prefab and `MonoBehaviour` singleton that allows any script in a Unity scene to access the api. This Monobehaviour simply controls the initalization of an `OpenAiApiV1` object, which actually houses the api logic. You can add an `OpenAiApiGatewayV1` to the current scene using the menu item `OpenAi > V1 > CreateGateway` You don't have to use the `OpenAiApiGatewayV1` prefab to access the api. This is simply one way that the `OpenAiApiV1` can be initialized. A custom `MonoBehaviour` can be written easily, it just needs to create the `OpenAiApiV1` object with valid authentication args. ## Completer The `OpenAiApiCompleterV1` is a simpler class that automatically initalizes the `OpenAiApiV1` object with use for a single engine, and provides the `Complete()` method to allow simple completions. You can add an `OpenAiApiCompleterV1` to the current scene using the menu item `OpenAi > V1 > CreateCompleter` # API Implementation As much as possible, the syntax for performing a call using `OpenAi Api Unity` follows the same structure as the api calls found in the [OpenAi Api Reference](https://beta.openai.com/docs/api-reference). All Api calls start with an `OpenAiApiV1` object. For example: ```csharp # this api call (In the Create Completion Section of the docs) POST https://api.openai.com/v1/engines/davinci/completions { "prompt" : "hey", "max_tokens" : 8 } # is called using the following structure class ApiExample : MonoBehaviour { public OpenAiApiV1 api; void LogCompletion() { api.Engines.Engine("davinci").Completions.CreateCompletionCoroutine( this, new CompletionRequestV1() { prompt = "hey", max_tokens = 8}, (result) => { Debug.Log(result.Result.choices[0].text);} ); } } ``` Lets break this down. Each step in an api call is called a resource. `api.Engines` returns the `EnginesResource` which allows us to use any resource call related to engines. For example, the [OpenAi Api List Engines Reference](https://beta.openai.com/docs/api-reference/list-engines) shows the list engines api call. `GET https://api.openai.com/v1/engines` which is called using `api.Engines.ListEnginesCoroutine` function. In some cases, resources are parameters. Like in the [OpenAi Api Retrieve Engine Reference](https://beta.openai.com/docs/api-reference/retrieve-engine). In this case `GET https://api.openai.com/v1/engines/{engine_id}` the engine is a parameter. To get an Engine resource, we provide an argument: `api.Engines.Engine("")` Making an api call from a resource is always implemented as an `async` function and as a Coroutine. So the api call `POST https://api.openai.com/v1/engines/{engine_id}/completions` has two functions, `api.Engines.Engine("{engine_id}").Completions.CreateCompletionCoroutine` and `api.Engines.Engine("").Completions.CreateCompletionAsync`. ## Async vs Coroutine functions Async functions use `async/await` syntax to return an `ApiResult`. The signature looks like this `async Task> {ApiCall}Async({RequestType} request)` Coroutine functions require a MonoBehaviour and callbacks. The basic signature looks like this `Coroutine {ApiCall}Coroutine(MonoBehaviour mono, {RequestType} request, Action> onResult)`. ### Coroutine Scripting The Coroutine implementations run the API request as a task, and check the tasks completion every frame. ```csharp # ExampleMono.cs using OpenAi.Unity.V1; using UnityEngine; public class Example : MonoBehaviour { public void DoApiCompletion() { Debug.Log("Performing Completion in Play Mode"); OpenAiCompleterV1.Instance.Complete( "prompt", s => Debug.Log(s), e => Debug.LogError(e.StatusCode) ); } } ``` ### Async scripts Async implementations let you use the `async/await` style syntax to perform api calls. ```csharp // MyEditor.cs using OpenAi.Api.V1; using OpenAi.Unity.V1; using UnityEditor; using UnityEngine; public class MyEditor : EditorWindow { [MenuItem("MyMenu/MyEditor")] public static void ShowWindow() { EditorWindow.GetWindow(typeof(MyEditor)); } async void OnGUI() { SOAuthArgsV1 auth = ScriptableObject.CreateInstance(); OpenAiApiV1 api = new OpenAiApiV1(auth.ResolveAuth()); if (api != null && GUILayout.Button("Do Completion")) { Debug.Log("Performing Completion in Editor Time"); ApiResult comp = await api.Engines.Engine("davinci").Completions.CreateCompletionAsync( new CompletionRequestV1() { prompt = "test", max_tokens = 8 } ); Debug.Log(comp.IsSuccess); Debug.Log(comp.Result.choices[0].text); } } } ``` ## ApiResult The `ApiResult` class is returned to encapsulate any exception that occurs during the request. There are many reasons api requests might fail, so the `ApiResult` exists so that any error can be handled, or at the very least a successful request can be verified. ## Extra Notes * The [Create Completion](https://beta.openai.com/docs/api-reference/create-completion) has a `stream` parameters that changes the way the completion result is received. This required a different implementation for stream and non-stream calls. As such, there are separate functions for the stream and non-stream version of completion. Calling `api.Engines.Engine("{engine_id}").Completions.CreateCompletionCoroutine` will automatically set `stream=false` and `api.Engines.Engine("{engine_id}").Completions.CreateCompletionCoroutine_EventStream` will automatically set `stream=true` no matter the input. ================================================ FILE: Documentation/3_ApiCalls.md.meta ================================================ fileFormatVersion: 2 guid: bc00ea052f096d8409eb252f4855e8ba TextScriptImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Documentation/4_JsonSerialization.md ================================================ # Context To keep `OpenAi Api Unity` portable, it was important to reduce dependencies as much as possible. Making the library easy to use and light weight was a priority. As such, a simple, bare-minimum custom Json Serailizer/Deserializer was written. The serailizer shipped with `OpenAi Api Unity` is not intended for use outside of the library, and has only been tested and developed to handle JSON syntax present in OpenAi Api HTTP request/responses. As more api calls are introduced, the Json Serailizer will be updated as needed. All custom Json code can be found in the `OpenAi.Json` namespace ================================================ FILE: Documentation/4_JsonSerialization.md.meta ================================================ fileFormatVersion: 2 guid: fe8e132778ca03748b12aab30ca10cfe TextScriptImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Documentation.meta ================================================ fileFormatVersion: 2 guid: 8bc73d1c9ca97e54cbe2c98a632c400a folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/Scripts/Examples/EMExampleChatRuntimeScene.cs ================================================ using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; public static class ExampleChatRuntimeScene { private const string cSceneName = "ExampleChatRuntimeScene"; [MenuItem("OpenAi/Examples/Chat at Runtime")] public static void OpenScene() { string[] assets = AssetDatabase.FindAssets(cSceneName); string path = null; foreach (string guid in assets) { path = AssetDatabase.GUIDToAssetPath(guid); } if (string.IsNullOrEmpty(path)) { Debug.LogError($"Cannot find the scene: {cSceneName}"); return; } string newScenePath = $"Assets/{cSceneName}.unity"; AssetDatabase.CopyAsset(path, newScenePath); EditorSceneManager.OpenScene(newScenePath); AssetDatabase.Refresh(); Selection.activeObject = AssetDatabase.LoadAssetAtPath(newScenePath, typeof(Object)); } } ================================================ FILE: Editor/Scripts/Examples/EMExampleChatRuntimeScene.cs.meta ================================================ fileFormatVersion: 2 guid: e0a27e5aef073284da820f4ce2ced1f4 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/Scripts/Examples/EMExampleOpenAiApiRuntimeScene.cs ================================================ using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; public static class ExampleOpenAiApiRuntimeScene { private const string cSceneName = "ExampleOpenAiApiRuntimeScene"; [MenuItem("OpenAi/Examples/Completion at Runtime")] public static void OpenScene() { string[] assets = AssetDatabase.FindAssets(cSceneName); string path = null; foreach (string guid in assets) { path = AssetDatabase.GUIDToAssetPath(guid); } if (string.IsNullOrEmpty(path)) { Debug.LogError($"Cannot find the scene: {cSceneName}"); return; } string newScenePath = $"Assets/{cSceneName}.unity"; AssetDatabase.CopyAsset(path, newScenePath); EditorSceneManager.OpenScene(newScenePath); AssetDatabase.Refresh(); Selection.activeObject = AssetDatabase.LoadAssetAtPath(newScenePath, typeof(Object)); } } ================================================ FILE: Editor/Scripts/Examples/EMExampleOpenAiApiRuntimeScene.cs.meta ================================================ fileFormatVersion: 2 guid: 93f30114c6062d94695cfb919c9faebd MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/Scripts/Examples/ExampleOpenAiApiUnityEditor.cs ================================================ // MyEditor.cs using OpenAi.Api.V1; using OpenAi.Unity.V1; using System.Threading.Tasks; using UnityEditor; using UnityEngine; namespace OpenAi.Examples { public class ExampleOpenAiApiUnityEditor : EditorWindow { private string _input = "Enter Prompt here"; private string _output; [MenuItem("OpenAi/Examples/Completion In Editor Window")] public static void ShowWindow() { EditorWindow.GetWindow(typeof(ExampleOpenAiApiUnityEditor)); } void OnGUI() { GUI.enabled = false; EditorGUILayout.ObjectField("Code:", MonoScript.FromScriptableObject(this), typeof(ScriptableObject), false); GUI.enabled = true; SOAuthArgsV1 auth = ScriptableObject.CreateInstance(); OpenAiApiV1 api = new OpenAiApiV1(auth.ResolveAuth()); _input = EditorGUILayout.TextField(_input); if (api != null && GUILayout.Button("Do Completion")) { Debug.Log("Performing Completion in Editor Time"); DoEditorTask(api); } if (!string.IsNullOrEmpty(_output)) { GUI.enabled = false; EditorGUILayout.TextField(_output); GUI.enabled = true; } } private async Task DoEditorTask(OpenAiApiV1 api) { _output = "Performing completion..."; ApiResult comp = await api.Engines.Engine("davinci").Completions.CreateCompletionAsync( new CompletionRequestV1() { prompt = "test", max_tokens = 8 } ); if (comp.IsSuccess) { _output = $"{comp.Result.choices[0].text}"; } else { _output = $"ERROR: StatusCode={comp.HttpResponse.responseCode} - {comp.HttpResponse.error}"; } } } } ================================================ FILE: Editor/Scripts/Examples/ExampleOpenAiApiUnityEditor.cs.meta ================================================ fileFormatVersion: 2 guid: cbe89ff476c953f4990fab5f5bf4c640 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/Scripts/Examples.meta ================================================ fileFormatVersion: 2 guid: 02674ce6ed1d7ed4a84d3c6d31346b72 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/Scripts/Unity/V1/Auth/SOAuthArgsV1Editor.cs ================================================ using OpenAi.Unity.V1; using UnityEditor; using UnityEngine; using static OpenAi.Unity.V1.SOAuthArgsV1; namespace OpenAi.Api.Unity.V1 { [CustomEditor(typeof(SOAuthArgsV1))] public class OpenAiApiAuthArgsEditor : Editor { SerializedProperty AuthType; SerializedProperty PrivateApiKey; SerializedProperty Organization; void OnEnable() { AuthType = serializedObject.FindProperty("AuthType"); PrivateApiKey = serializedObject.FindProperty("PrivateApiKey"); Organization = serializedObject.FindProperty("Organization"); } public override void OnInspectorGUI() { serializedObject.Update(); GUI.enabled = false; EditorGUILayout.ObjectField("Script", MonoScript.FromScriptableObject((SOAuthArgsV1)target), typeof(SOAuthArgsV1), false); GUI.enabled = true; EditorGUILayout.Space(); EditorGUILayout.PropertyField(AuthType); switch((EAuthProvisionMethod)AuthType.enumValueIndex) { case EAuthProvisionMethod.LocalFile: EditorGUILayout.HelpBox("This auth method will attempt to find the private key at `~/.openai/auth.json` (Linux/Mac) or `%USERPROFILE%/.openai/auth.json` (Windows). If this file does not exist or the key is not present, api calls will fail", MessageType.Warning); break; case EAuthProvisionMethod.String: EditorGUILayout.PropertyField(PrivateApiKey); EditorGUILayout.PropertyField(Organization); break; } serializedObject.ApplyModifiedProperties(); } } } ================================================ FILE: Editor/Scripts/Unity/V1/Auth/SOAuthArgsV1Editor.cs.meta ================================================ fileFormatVersion: 2 guid: 3f6e6a6d360308d42817d969ae55bd3f MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/Scripts/Unity/V1/Auth.meta ================================================ fileFormatVersion: 2 guid: 5805db06a168eba4a9d18cd186ee00d8 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/Scripts/Unity/V1/EMPrefabs.cs ================================================ using UnityEditor; using UnityEngine; using UnityEngine.SceneManagement; namespace OpenAi.Unity.V1 { public static class EMPrefabsV1 { [MenuItem("OpenAi/V1/CreateGateway")] public static void CreateGateway() => SpawnPrefab("OpenAiApiGatewayV1"); [MenuItem("OpenAi/V1/CreateCompleter")] public static void CreateCompleter() => SpawnPrefab("OpenAiCompleterV1"); [MenuItem("OpenAi/V1/CreateChatCompleter")] public static void CreateChatCompleter() => SpawnPrefab("OpenAiChatCompleterV1"); private static void SpawnPrefab(string name) { string[] assets = AssetDatabase.FindAssets(name); GameObject obj = null; foreach (string guid in assets) { string apath = AssetDatabase.GUIDToAssetPath(guid); obj = AssetDatabase.LoadAssetAtPath(apath); if (obj != null) break; } if (obj == null) { Debug.LogError($"Cannot find the prefab: {name}"); return; } Object inst = PrefabUtility.InstantiatePrefab(obj); Selection.activeObject = inst; return; } } } ================================================ FILE: Editor/Scripts/Unity/V1/EMPrefabs.cs.meta ================================================ fileFormatVersion: 2 guid: 50dc49b27bd81d54aadcda8893587046 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/Scripts/Unity/V1.meta ================================================ fileFormatVersion: 2 guid: 305f7cea76954a5418ef8d00bf990e9e folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/Scripts/Unity.meta ================================================ fileFormatVersion: 2 guid: e7082c633e69c3e40a25864f088e5f39 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/Scripts.meta ================================================ fileFormatVersion: 2 guid: d0e98a06002e536468e9c41eca65239c folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor/openai.api.unity.editor.asmdef ================================================ { "name": "openai.api.unity.editor", "references": [ "GUID:762faf06f60fab647b9b71ae958fdf20" ], "includePlatforms": [ "Editor" ], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], "versionDefines": [], "noEngineReferences": false } ================================================ FILE: Editor/openai.api.unity.editor.asmdef.meta ================================================ fileFormatVersion: 2 guid: 58a743fc042d1cc4bacc5a05c82a03f9 AssemblyDefinitionImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Editor.meta ================================================ fileFormatVersion: 2 guid: b899e02a35d43fb478005ecddced2557 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: License.md ================================================ MIT License Copyright (c) 2020 James McCafferty Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: License.md.meta ================================================ fileFormatVersion: 2 guid: 46c8397f0ceee1d459015910980c4a2e TextScriptImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: README.md ================================================ **WARNING**: This project is officially dead. No updates will come, and as such I moved it to the archived state. If more complete implementation of the current API come to my awareness I will post here. Sadly, I do not have time to take PRs or manage this repo. # OpenAi Api Unity A simple OpenAI API wrapper for Unity This is a community library. I am not officially affiliated with OpenAi. Big shout out to: * [@OkGoDoIt](https://github.com/OkGoDoIt): This code base is heavily based on the [OpenAI-API-dotnet Repo](https://github.com/OkGoDoIt/OpenAI-API-dotnet), which is a dotnet wrapper for the OpenAI Api * [@ivomarel](https://github.com/ivomarel): For the [OpenAI_Unity Repo](https://github.com/hexthedev/OpenAI_Unity) To report bugs, problems, suggestions please submit [Github Issues](https://github.com/hexthedev/OpenAi-Api-Unity/issues) If anyone wants to contribute, [Pull Requests](https://github.com/hexthedev/OpenAi-Api-Unity/pulls) are welcome ## Status | Api Call | Implemented | Bare-Minimum Tests | Thourough Tests | | --- | --- | --- | --- | | `GET /engines` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | `GET /engines/{engine_id}` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | `POST /engines/{engine_id}/completions` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | `GET /engines/{engine_id}/completions/browser_stream` | :x: | :heavy_minus_sign: | :heavy_minus_sign: | | `GET /files` | :heavy_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: | | `POST /files/{file_id}` | :x: | :heavy_minus_sign: | :heavy_minus_sign: | | `GET /files/{file_id}` | :heavy_check_mark: | :heavy_minus_sign: | :heavy_minus_sign: | | `POST /chat/completions` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | ## Overview This is a simple OpenAI API wrapper that implements the API calls found in the [OpenAI Api Reference](https://beta.openai.com/docs/api-reference) as Coroutines and Async functions. The syntax follows the docs as closely as possible. For example, the API call Create Completion at the endpoint `https://api.openai.com/v1/engines/{engine_id}/completions` is called using `OpenAiApiV1.Engines.Engine("").Completions.CreateCompletionCoroutine`. The API call Chat Completion at the endpoint `https://api.openai.com/v1/chat/completions` is called using `OpenAiApiV1.Chat.Completions.CreateChatCompletionCoroutine`. To learn more: 1. Read the Quick Start section below to see a basic example of how to use the wrapper 2. Refer to the [Documentation](https://github.com/hexthedev/OpenAi-Api-Unity/tree/main/Documentation) for a more detailed explanation of the library ### What is and isn't tested I've tested the list below. Testing for all other use cases will come with time * Editor scripts and editor windows using async versions of API calls * Coroutine api calls in Play Mode * I have not tested builds, but should work since it's really just Native C#. Any issues will likely be platform related. * Unit Tested basic use cases and any issue I found along the way, to ensure stability * Only tested on a Windows machine. If Linux/Mac authentication doesn't work as expected, please let me know. * I do not have an organization, I have not been able to test the organization key functionality during authentication # Quick Start See video: https://youtu.be/Ju-i0sxsX7E ## Install **Unity Package Manager (Recommended):** Go to the Unity Package Manager (`Window > Package Manager`), and click the `+` icon in the top left hand corner. Choose `Add package from git URL...` and provide the url `https://github.com/hexthedev/OpenAi-Api-Unity.git`. **Unity Package:** Go to https://github.com/hexthedev/OpenAi-Api-Unity/releases and download the desired release. Once downloaded, open the file and follow the instructions to import it into Unity. **Git Submodule**: For more advanced git users, you can simply add this repo as a submodule in your assets folder. This is especially useful if you want to edit, change and version the `OpenAi Api Unity` code. ## Authenticate Add a file to the path `~/.openai/auth.json` (Linux/Mac) or `%USERPROFILE%/.openai/auth.json` (Windows) if you only have an API key, the `auth.json` should look like this ```json { "private_api_key":"" } ``` If you have an organization key, the `auth.json` should look like this ```json { "private_api_key":"", "organization":"" } ``` ## Editor Script To see an example of a completion in an editor script: * From the top bar to to `OpenAi > Examples > Completion In Editor Window`. * To see the code, Click the `Code` reference at the top of the window. ## Play Script To see an example of a completion at Runtime: * If you're working on a scene, save the scene you are working on * From the top bar click `OpenAi > Examples > Completion At Runtime` * Look at the `CompletionExample` object in the hierarchy and check out the code in `ExampleOpenAiApiRuntime` * Press play and run the scene To see an example of chat completion at Runtime: * If you're working on a scene, save the scene you are working on * From the top bar click `OpenAi > Examples > Chat At Runtime` * Look at the `ChatCompletionExample` object in the hierarchy and check out the code in `ExampleChatRuntime` * Press play and run the scene # What Next The above quick start is an extremely simple way to use the `OpenAi Api Unity` library. For more advanced use cases, refer to the [OpenAi Api Unity Documentation](https://github.com/hexthedev/OpenAi-Api-Unity/tree/main/Documentation) ================================================ FILE: README.md.meta ================================================ fileFormatVersion: 2 guid: c0d42e9c4461c4b40ae3b624a4de9661 TextScriptImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Config/DefaultAuthArgsV1.asset ================================================ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!114 &11400000 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 82cfa4d983a7d91419ea8999b972a333, type: 3} m_Name: DefaultAuthArgsV1 m_EditorClassIdentifier: AuthType: 0 PrivateApiKey: Organization: ================================================ FILE: Runtime/Config/DefaultAuthArgsV1.asset.meta ================================================ fileFormatVersion: 2 guid: 6d0ce71886a13d44a9693a5e31c0a754 NativeFormatImporter: externalObjects: {} mainObjectFileID: 0 userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Config/DefaultChatCompletionArgs.asset ================================================ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!114 &11400000 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 080e53b2b28b9684d819081e4e9b9de6, type: 3} m_Name: DefaultChatCompletionArgs m_EditorClassIdentifier: temperature: 1 top_p: 1 n: 1 stop: - - - - max_tokens: 2048 presence_penalty: 0 frequency_penalty: 0 user: ================================================ FILE: Runtime/Config/DefaultChatCompletionArgs.asset.meta ================================================ fileFormatVersion: 2 guid: 3064ae573dfd1aa45bfc201f2bc5f0ed NativeFormatImporter: externalObjects: {} mainObjectFileID: 0 userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Config/DefaultCompletionArgs.asset ================================================ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!114 &11400000 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 6fd689c40e44326488e8c75b58e63175, type: 3} m_Name: DefaultCompletionArgs m_EditorClassIdentifier: max_tokens: 32 temperature: 0.7 top_p: 1 stop: - - - - presences_penalty: 0 frequency_penalty: 0 ================================================ FILE: Runtime/Config/DefaultCompletionArgs.asset.meta ================================================ fileFormatVersion: 2 guid: 672d04ddb1f852449bbdd712933b43f8 NativeFormatImporter: externalObjects: {} mainObjectFileID: 0 userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Config.meta ================================================ fileFormatVersion: 2 guid: fac516003fa24e448a19637f26126859 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Prefabs/OpenAiApiGatewayV1.prefab ================================================ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!1 &2965647775477036486 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1041637925907717537} - component: {fileID: 6326357910860361850} m_Layer: 0 m_Name: OpenAiApiGatewayV1 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!4 &1041637925907717537 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2965647775477036486} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &6326357910860361850 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2965647775477036486} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 2368cfe602a61dc47b9fceb48ea4dae0, type: 3} m_Name: m_EditorClassIdentifier: InitializeOnStart: 1 Auth: {fileID: 11400000, guid: 6d0ce71886a13d44a9693a5e31c0a754, type: 2} ================================================ FILE: Runtime/Prefabs/OpenAiApiGatewayV1.prefab.meta ================================================ fileFormatVersion: 2 guid: 15d84929ed54ded40904bb85c13f5b87 PrefabImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Prefabs/OpenAiChatCompleterV1.prefab ================================================ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!1 &2692144715385115183 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 2458975999970266705} - component: {fileID: 2692144715385115182} m_Layer: 0 m_Name: OpenAiChatCompleterV1 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!4 &2458975999970266705 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2692144715385115183} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &2692144715385115182 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2692144715385115183} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 582650b353200ef458d8ce61588f26dc, type: 3} m_Name: m_EditorClassIdentifier: Auth: {fileID: 11400000, guid: 6d0ce71886a13d44a9693a5e31c0a754, type: 2} Args: {fileID: 11400000, guid: 3064ae573dfd1aa45bfc201f2bc5f0ed, type: 2} Model: 9 dialogue: [] ================================================ FILE: Runtime/Prefabs/OpenAiChatCompleterV1.prefab.meta ================================================ fileFormatVersion: 2 guid: 4e6ec076fabc0494db4fa5402d517a9f PrefabImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Prefabs/OpenAiCompleterV1.prefab ================================================ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!1 &8905070302076984395 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 9000805303073374261} - component: {fileID: 5490449287616113856} m_Layer: 0 m_Name: OpenAiCompleterV1 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!4 &9000805303073374261 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8905070302076984395} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &5490449287616113856 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8905070302076984395} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 00b92053656ca0643ab0d4d86e1387fa, type: 3} m_Name: m_EditorClassIdentifier: Auth: {fileID: 11400000, guid: 6d0ce71886a13d44a9693a5e31c0a754, type: 2} Args: {fileID: 11400000, guid: 672d04ddb1f852449bbdd712933b43f8, type: 2} Engine: 6 ================================================ FILE: Runtime/Prefabs/OpenAiCompleterV1.prefab.meta ================================================ fileFormatVersion: 2 guid: f28446e696573d2418d2a68633c4a3b3 PrefabImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Prefabs.meta ================================================ fileFormatVersion: 2 guid: 286c91b0d5867e144a3e5bca108536f0 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scenes/ExampleChatRuntimeScene.unity ================================================ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!29 &1 OcclusionCullingSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_OcclusionBakeSettings: smallestOccluder: 5 smallestHole: 0.25 backfaceThreshold: 100 m_SceneGUID: 00000000000000000000000000000000 m_OcclusionCullingData: {fileID: 0} --- !u!104 &2 RenderSettings: m_ObjectHideFlags: 0 serializedVersion: 9 m_Fog: 0 m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_FogMode: 3 m_FogDensity: 0.01 m_LinearFogStart: 0 m_LinearFogEnd: 300 m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} m_AmbientIntensity: 1 m_AmbientMode: 0 m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} m_HaloStrength: 0.5 m_FlareStrength: 1 m_FlareFadeSpeed: 3 m_HaloTexture: {fileID: 0} m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} m_DefaultReflectionMode: 0 m_DefaultReflectionResolution: 128 m_ReflectionBounces: 1 m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} m_IndirectSpecularColor: {r: 0.37311992, g: 0.38074034, b: 0.35872713, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 serializedVersion: 12 m_GIWorkflowMode: 1 m_GISettings: serializedVersion: 2 m_BounceScale: 1 m_IndirectOutputScale: 1 m_AlbedoBoost: 1 m_EnvironmentLightingMode: 0 m_EnableBakedLightmaps: 1 m_EnableRealtimeLightmaps: 0 m_LightmapEditorSettings: serializedVersion: 12 m_Resolution: 2 m_BakeResolution: 40 m_AtlasSize: 1024 m_AO: 0 m_AOMaxDistance: 1 m_CompAOExponent: 1 m_CompAOExponentDirect: 0 m_ExtractAmbientOcclusion: 0 m_Padding: 2 m_LightmapParameters: {fileID: 0} m_LightmapsBakeMode: 1 m_TextureCompression: 1 m_FinalGather: 0 m_FinalGatherFiltering: 1 m_FinalGatherRayCount: 256 m_ReflectionCompression: 2 m_MixedBakeMode: 2 m_BakeBackend: 1 m_PVRSampling: 1 m_PVRDirectSampleCount: 32 m_PVRSampleCount: 512 m_PVRBounces: 2 m_PVREnvironmentSampleCount: 256 m_PVREnvironmentReferencePointCount: 2048 m_PVRFilteringMode: 1 m_PVRDenoiserTypeDirect: 1 m_PVRDenoiserTypeIndirect: 1 m_PVRDenoiserTypeAO: 1 m_PVRFilterTypeDirect: 0 m_PVRFilterTypeIndirect: 0 m_PVRFilterTypeAO: 0 m_PVREnvironmentMIS: 1 m_PVRCulling: 1 m_PVRFilteringGaussRadiusDirect: 1 m_PVRFilteringGaussRadiusIndirect: 5 m_PVRFilteringGaussRadiusAO: 2 m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 m_ExportTrainingData: 0 m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} m_LightingSettings: {fileID: 0} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 m_ObjectHideFlags: 0 m_BuildSettings: serializedVersion: 2 agentTypeID: 0 agentRadius: 0.5 agentHeight: 2 agentSlope: 45 agentClimb: 0.4 ledgeDropHeight: 0 maxJumpAcrossDistance: 0 minRegionArea: 2 manualCellSize: 0 cellSize: 0.16666667 manualTileSize: 0 tileSize: 256 accuratePlacement: 0 maxJobWorkers: 0 preserveTilesOutsideBounds: 0 debug: m_Flags: 0 m_NavMeshData: {fileID: 0} --- !u!1 &3530426 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 3530427} - component: {fileID: 3530429} - component: {fileID: 3530428} m_Layer: 5 m_Name: Label m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &3530427 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3530426} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 895809921} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: -7.5, y: -0.5} m_SizeDelta: {x: -35, y: -13} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &3530428 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3530426} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 32 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 3 m_MaxSize: 40 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: user --- !u!222 &3530429 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3530426} m_CullTransparentMesh: 1 --- !u!1 &21594508 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 21594509} - component: {fileID: 21594511} - component: {fileID: 21594510} m_Layer: 5 m_Name: Placeholder m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &21594509 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 21594508} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1908724337} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: -0.5} m_SizeDelta: {x: -20, y: -13} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &21594510 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 21594508} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 32 m_FontStyle: 2 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 48 m_Alignment: 0 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Enter Prompt Here --- !u!222 &21594511 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 21594508} m_CullTransparentMesh: 0 --- !u!1 &24186520 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 24186521} - component: {fileID: 24186523} - component: {fileID: 24186522} m_Layer: 5 m_Name: Item Label m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &24186521 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 24186520} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 342422714} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 5, y: -0.5} m_SizeDelta: {x: -30, y: -3} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &24186522 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 24186520} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 14 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 10 m_MaxSize: 40 m_Alignment: 3 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Option A --- !u!222 &24186523 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 24186520} m_CullTransparentMesh: 1 --- !u!1 &143266664 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 143266665} - component: {fileID: 143266668} - component: {fileID: 143266667} - component: {fileID: 143266666} m_Layer: 5 m_Name: Add m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &143266665 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 143266664} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0.44114578, y: 0.44114578, z: 0.44114578} m_Children: - {fileID: 289601564} m_Father: {fileID: 734231673} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &143266666 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 143266664} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 143266667} m_OnClick: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1144405788} m_TargetAssemblyTypeName: OpenAi.Examples.ExampleChatRuntime, openai.api.unity m_MethodName: DoAddToDialogue m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 m_StringArgument: m_BoolArgument: 0 m_CallState: 2 --- !u!114 &143266667 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 143266664} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &143266668 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 143266664} m_CullTransparentMesh: 0 --- !u!1 &280116129 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 280116130} - component: {fileID: 280116133} - component: {fileID: 280116132} - component: {fileID: 280116131} m_Layer: 5 m_Name: Quit m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &280116130 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 280116129} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0.44114578, y: 0.44114578, z: 0.44114578} m_Children: - {fileID: 865087086} m_Father: {fileID: 734231673} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &280116131 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 280116129} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 280116132} m_OnClick: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1144405788} m_TargetAssemblyTypeName: OpenAi.Examples.ExampleChatRuntime, openai.api.unity m_MethodName: QuitApp m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 m_StringArgument: m_BoolArgument: 0 m_CallState: 2 --- !u!114 &280116132 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 280116129} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &280116133 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 280116129} m_CullTransparentMesh: 0 --- !u!1 &285536669 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 285536670} - component: {fileID: 285536672} - component: {fileID: 285536671} m_Layer: 5 m_Name: Output m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &285536670 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 285536669} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1512394315} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &285536671 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 285536669} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 32 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 48 m_Alignment: 3 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Output --- !u!222 &285536672 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 285536669} m_CullTransparentMesh: 0 --- !u!1 &289601563 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 289601564} - component: {fileID: 289601566} - component: {fileID: 289601565} m_Layer: 5 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &289601564 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 289601563} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 143266665} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &289601565 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 289601563} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 40 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Add to Dialogue --- !u!222 &289601566 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 289601563} m_CullTransparentMesh: 0 --- !u!1 &290938305 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 290938306} - component: {fileID: 290938308} - component: {fileID: 290938307} m_Layer: 5 m_Name: Handle m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &290938306 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 290938305} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1191005547} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0.2} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 20, y: 20} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &290938307 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 290938305} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &290938308 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 290938305} m_CullTransparentMesh: 1 --- !u!1 &342422713 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 342422714} - component: {fileID: 342422715} m_Layer: 5 m_Name: Item m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &342422714 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 342422713} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1158409480} - {fileID: 1027592577} - {fileID: 24186521} m_Father: {fileID: 2073891501} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 20} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &342422715 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 342422713} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 1158409481} toggleTransition: 1 graphic: {fileID: 1027592578} m_Group: {fileID: 0} onValueChanged: m_PersistentCalls: m_Calls: [] m_IsOn: 1 --- !u!1 &358800524 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 358800527} - component: {fileID: 358800526} - component: {fileID: 358800525} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!81 &358800525 AudioListener: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 358800524} m_Enabled: 1 --- !u!20 &358800526 Camera: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 358800524} m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 2 m_BackGroundColor: {r: 0, g: 0.21792704, b: 0.2830189, a: 0} m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} m_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 x: 0 y: 0 width: 1 height: 1 near clip plane: 0.3 far clip plane: 1000 field of view: 60 orthographic: 0 orthographic size: 5 m_Depth: -1 m_CullingMask: serializedVersion: 2 m_Bits: 4294967295 m_RenderingPath: -1 m_TargetTexture: {fileID: 0} m_TargetDisplay: 0 m_TargetEye: 3 m_HDR: 1 m_AllowMSAA: 1 m_AllowDynamicResolution: 0 m_ForceIntoRT: 0 m_OcclusionCulling: 1 m_StereoConvergence: 10 m_StereoSeparation: 0.022 --- !u!4 &358800527 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 358800524} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &630972316 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 630972317} - component: {fileID: 630972319} - component: {fileID: 630972318} m_Layer: 5 m_Name: Label m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &630972317 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 630972316} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1984789198} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &630972318 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 630972316} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 32 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 3 m_MaxSize: 40 m_Alignment: 5 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: 'Role:' --- !u!222 &630972319 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 630972316} m_CullTransparentMesh: 1 --- !u!1 &638305103 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 638305107} - component: {fileID: 638305106} - component: {fileID: 638305105} - component: {fileID: 638305104} m_Layer: 5 m_Name: UI m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &638305104 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 638305103} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} m_Name: m_EditorClassIdentifier: m_IgnoreReversedGraphics: 1 m_BlockingObjects: 0 m_BlockingMask: serializedVersion: 2 m_Bits: 4294967295 --- !u!114 &638305105 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 638305103} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} m_Name: m_EditorClassIdentifier: m_UiScaleMode: 1 m_ReferencePixelsPerUnit: 100 m_ScaleFactor: 1 m_ReferenceResolution: {x: 1920, y: 1080} m_ScreenMatchMode: 0 m_MatchWidthOrHeight: 0 m_PhysicalUnit: 3 m_FallbackScreenDPI: 96 m_DefaultSpriteDPI: 96 m_DynamicPixelsPerUnit: 1 m_PresetInfoIsWorld: 0 --- !u!223 &638305106 Canvas: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 638305103} m_Enabled: 1 serializedVersion: 3 m_RenderMode: 0 m_Camera: {fileID: 0} m_PlaneDistance: 100 m_PixelPerfect: 0 m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_AdditionalShaderChannelsFlag: 25 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 --- !u!224 &638305107 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 638305103} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} m_Children: - {fileID: 1984789198} - {fileID: 1512394315} - {fileID: 734231673} - {fileID: 2056935217} m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} --- !u!1 &734231672 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 734231673} - component: {fileID: 734231674} m_Layer: 0 m_Name: Actions m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &734231673 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 734231672} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 2.2668242, y: 2.2668242, z: 2.2668242} m_Children: - {fileID: 280116130} - {fileID: 1075851854} - {fileID: 143266665} m_Father: {fileID: 638305107} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} m_AnchoredPosition: {x: 0, y: 89} m_SizeDelta: {x: 750, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &734231674 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 734231672} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: m_Left: 0 m_Right: 0 m_Top: 0 m_Bottom: 0 m_ChildAlignment: 0 m_StartCorner: 0 m_StartAxis: 0 m_CellSize: {x: 250, y: 100} m_Spacing: {x: 0, y: 0} m_Constraint: 0 m_ConstraintCount: 2 --- !u!1 &803458504 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 803458505} - component: {fileID: 803458508} - component: {fileID: 803458507} - component: {fileID: 803458506} m_Layer: 5 m_Name: Scrollbar m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &803458505 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 803458504} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1191005547} m_Father: {fileID: 1813061924} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 20, y: 0} m_Pivot: {x: 1, y: 1} --- !u!114 &803458506 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 803458504} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 290938307} m_HandleRect: {fileID: 290938306} m_Direction: 2 m_Value: 0 m_Size: 0.2 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: m_Calls: [] --- !u!114 &803458507 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 803458504} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &803458508 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 803458504} m_CullTransparentMesh: 1 --- !u!1 &865087085 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 865087086} - component: {fileID: 865087088} - component: {fileID: 865087087} m_Layer: 5 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &865087086 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 865087085} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 280116130} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &865087087 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 865087085} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 40 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Quit Application --- !u!222 &865087088 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 865087085} m_CullTransparentMesh: 0 --- !u!1 &895809920 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 895809921} - component: {fileID: 895809924} - component: {fileID: 895809923} - component: {fileID: 895809922} m_Layer: 5 m_Name: Role m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &895809921 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 895809920} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 3530427} - {fileID: 1213195449} - {fileID: 1813061924} m_Father: {fileID: 1984789198} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &895809922 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 895809920} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 0d0b652f32a2cc243917e4028fa0f046, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 895809923} m_Template: {fileID: 1813061924} m_CaptionText: {fileID: 3530428} m_CaptionImage: {fileID: 0} m_ItemText: {fileID: 24186522} m_ItemImage: {fileID: 0} m_Value: 0 m_Options: m_Options: - m_Text: user m_Image: {fileID: 0} - m_Text: system m_Image: {fileID: 0} - m_Text: assistant m_Image: {fileID: 0} m_OnValueChanged: m_PersistentCalls: m_Calls: [] m_AlphaFadeSpeed: 0.15 --- !u!114 &895809923 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 895809920} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &895809924 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 895809920} m_CullTransparentMesh: 1 --- !u!1 &996691227 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 996691228} - component: {fileID: 996691231} - component: {fileID: 996691230} - component: {fileID: 996691229} m_Layer: 5 m_Name: Viewport m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &996691228 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 996691227} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 2073891501} m_Father: {fileID: 1813061924} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: -18, y: 0} m_Pivot: {x: 0, y: 1} --- !u!114 &996691229 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 996691227} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} m_Name: m_EditorClassIdentifier: m_ShowMaskGraphic: 0 --- !u!114 &996691230 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 996691227} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &996691231 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 996691227} m_CullTransparentMesh: 1 --- !u!1 &1027592576 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1027592577} - component: {fileID: 1027592579} - component: {fileID: 1027592578} m_Layer: 5 m_Name: Item Checkmark m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1027592577 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1027592576} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 342422714} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} m_AnchoredPosition: {x: 10, y: 0} m_SizeDelta: {x: 20, y: 20} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1027592578 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1027592576} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &1027592579 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1027592576} m_CullTransparentMesh: 1 --- !u!1 &1075851853 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1075851854} - component: {fileID: 1075851857} - component: {fileID: 1075851856} - component: {fileID: 1075851855} m_Layer: 5 m_Name: Complete m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1075851854 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1075851853} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0.44114578, y: 0.44114578, z: 0.44114578} m_Children: - {fileID: 1986469218} m_Father: {fileID: 734231673} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1075851855 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1075851853} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 1075851856} m_OnClick: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1144405788} m_TargetAssemblyTypeName: OpenAi.Examples.ExampleChatRuntime, openai.api.unity m_MethodName: DoApiCompletion m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 m_StringArgument: m_BoolArgument: 0 m_CallState: 2 --- !u!114 &1075851856 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1075851853} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &1075851857 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1075851853} m_CullTransparentMesh: 0 --- !u!1 &1144405786 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1144405787} - component: {fileID: 1144405788} m_Layer: 0 m_Name: ChatCompletionExample m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!4 &1144405787 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1144405786} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1144405788 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1144405786} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: ac671c01496633846acf376026fb4b26, type: 3} m_Name: m_EditorClassIdentifier: role: {fileID: 895809922} Input: {fileID: 1908724338} Output: {fileID: 285536671} --- !u!1 &1158409479 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1158409480} - component: {fileID: 1158409482} - component: {fileID: 1158409481} m_Layer: 5 m_Name: Item Background m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1158409480 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1158409479} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 342422714} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1158409481 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1158409479} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 0} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &1158409482 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1158409479} m_CullTransparentMesh: 1 --- !u!1 &1191005546 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1191005547} m_Layer: 5 m_Name: Sliding Area m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1191005547 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1191005546} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 290938306} m_Father: {fileID: 803458505} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: -20, y: -20} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1213195448 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1213195449} - component: {fileID: 1213195451} - component: {fileID: 1213195450} m_Layer: 5 m_Name: Arrow m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1213195449 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1213195448} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 895809921} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} m_AnchoredPosition: {x: -15, y: 0} m_SizeDelta: {x: 20, y: 20} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1213195450 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1213195448} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10915, guid: 0000000000000000f000000000000000, type: 0} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &1213195451 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1213195448} m_CullTransparentMesh: 1 --- !u!1 &1512394314 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1512394315} - component: {fileID: 1512394316} m_Layer: 5 m_Name: Chat IO m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1512394315 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1512394314} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1908724337} - {fileID: 285536670} m_Father: {fileID: 638305107} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 1750, y: 750} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1512394316 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1512394314} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: m_Left: 0 m_Right: 0 m_Top: 0 m_Bottom: 0 m_ChildAlignment: 4 m_StartCorner: 0 m_StartAxis: 0 m_CellSize: {x: 1500, y: 250} m_Spacing: {x: 0, y: 10} m_Constraint: 0 m_ConstraintCount: 2 --- !u!1 &1813061923 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1813061924} - component: {fileID: 1813061927} - component: {fileID: 1813061926} - component: {fileID: 1813061925} m_Layer: 5 m_Name: Template m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 0 --- !u!224 &1813061924 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1813061923} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 996691228} - {fileID: 803458505} m_Father: {fileID: 895809921} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} m_AnchoredPosition: {x: 0, y: 2} m_SizeDelta: {x: 0, y: 150} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1813061925 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1813061923} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3} m_Name: m_EditorClassIdentifier: m_Content: {fileID: 2073891501} m_Horizontal: 0 m_Vertical: 1 m_MovementType: 2 m_Elasticity: 0.1 m_Inertia: 1 m_DecelerationRate: 0.135 m_ScrollSensitivity: 1 m_Viewport: {fileID: 996691228} m_HorizontalScrollbar: {fileID: 0} m_VerticalScrollbar: {fileID: 803458506} m_HorizontalScrollbarVisibility: 0 m_VerticalScrollbarVisibility: 2 m_HorizontalScrollbarSpacing: 0 m_VerticalScrollbarSpacing: -3 m_OnValueChanged: m_PersistentCalls: m_Calls: [] --- !u!114 &1813061926 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1813061923} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &1813061927 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1813061923} m_CullTransparentMesh: 1 --- !u!1001 &1894887618 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 0} m_Modifications: - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_RootOrder value: 2 objectReference: {fileID: 0} - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - target: {fileID: 2458975999970266705, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - target: {fileID: 2692144715385115182, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: Model value: 0 objectReference: {fileID: 0} - target: {fileID: 2692144715385115183, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} propertyPath: m_Name value: OpenAiChatCompleterV1 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 4e6ec076fabc0494db4fa5402d517a9f, type: 3} --- !u!1 &1908724336 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1908724337} - component: {fileID: 1908724340} - component: {fileID: 1908724339} - component: {fileID: 1908724338} m_Layer: 5 m_Name: Input m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1908724337 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1908724336} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 21594509} - {fileID: 2129249664} m_Father: {fileID: 1512394315} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1908724338 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1908724336} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 m_WrapAround: 0 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 1908724339} m_TextComponent: {fileID: 2129249665} m_Placeholder: {fileID: 21594510} m_ContentType: 0 m_InputType: 0 m_AsteriskChar: 42 m_KeyboardType: 0 m_LineType: 0 m_HideMobileInput: 0 m_CharacterValidation: 0 m_CharacterLimit: 0 m_OnEndEdit: m_PersistentCalls: m_Calls: [] m_OnValueChanged: m_PersistentCalls: m_Calls: [] m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_CustomCaretColor: 0 m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} m_Text: m_CaretBlinkRate: 0.85 m_CaretWidth: 1 m_ReadOnly: 0 m_ShouldActivateOnSelect: 1 --- !u!114 &1908724339 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1908724336} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &1908724340 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1908724336} m_CullTransparentMesh: 0 --- !u!1 &1984789197 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1984789198} - component: {fileID: 1984789199} m_Layer: 5 m_Name: Choose Role m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1984789198 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1984789197} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 630972317} - {fileID: 895809921} m_Father: {fileID: 638305107} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} m_AnchoredPosition: {x: -87.5, y: -114.5} m_SizeDelta: {x: 550, y: 150} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1984789199 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1984789197} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3} m_Name: m_EditorClassIdentifier: m_Padding: m_Left: 0 m_Right: 0 m_Top: 0 m_Bottom: 0 m_ChildAlignment: 4 m_StartCorner: 0 m_StartAxis: 0 m_CellSize: {x: 250, y: 75} m_Spacing: {x: 10, y: 0} m_Constraint: 0 m_ConstraintCount: 2 --- !u!1 &1986469217 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1986469218} - component: {fileID: 1986469220} - component: {fileID: 1986469219} m_Layer: 5 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1986469218 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1986469217} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1075851854} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1986469219 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1986469217} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 40 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Attempt Completion --- !u!222 &1986469220 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1986469217} m_CullTransparentMesh: 0 --- !u!1 &2056935214 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 2056935217} - component: {fileID: 2056935216} - component: {fileID: 2056935215} m_Layer: 0 m_Name: EventSystem m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &2056935215 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2056935214} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} m_Name: m_EditorClassIdentifier: m_HorizontalAxis: Horizontal m_VerticalAxis: Vertical m_SubmitButton: Submit m_CancelButton: Cancel m_InputActionsPerSecond: 10 m_RepeatDelay: 0.5 m_ForceModuleActive: 0 --- !u!114 &2056935216 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2056935214} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} m_Name: m_EditorClassIdentifier: m_FirstSelected: {fileID: 0} m_sendNavigationEvents: 1 m_DragThreshold: 10 --- !u!4 &2056935217 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2056935214} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: -960, y: -540, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 638305107} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2073891500 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 2073891501} m_Layer: 5 m_Name: Content m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &2073891501 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2073891500} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 342422714} m_Father: {fileID: 996691228} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 28} m_Pivot: {x: 0.5, y: 1} --- !u!1 &2129249663 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 2129249664} - component: {fileID: 2129249666} - component: {fileID: 2129249665} m_Layer: 5 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &2129249664 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2129249663} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1908724337} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: -0.5} m_SizeDelta: {x: -20, y: -13} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2129249665 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2129249663} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 32 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 48 m_Alignment: 0 m_AlignByGeometry: 0 m_RichText: 0 m_HorizontalOverflow: 1 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: --- !u!222 &2129249666 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2129249663} m_CullTransparentMesh: 0 ================================================ FILE: Runtime/Scenes/ExampleChatRuntimeScene.unity.meta ================================================ fileFormatVersion: 2 guid: 0d4eb4ed72ff417418747843458b9fd2 DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scenes/ExampleOpenAiApiRuntimeScene.unity ================================================ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!29 &1 OcclusionCullingSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_OcclusionBakeSettings: smallestOccluder: 5 smallestHole: 0.25 backfaceThreshold: 100 m_SceneGUID: 00000000000000000000000000000000 m_OcclusionCullingData: {fileID: 0} --- !u!104 &2 RenderSettings: m_ObjectHideFlags: 0 serializedVersion: 9 m_Fog: 0 m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_FogMode: 3 m_FogDensity: 0.01 m_LinearFogStart: 0 m_LinearFogEnd: 300 m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} m_AmbientIntensity: 1 m_AmbientMode: 0 m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} m_HaloStrength: 0.5 m_FlareStrength: 1 m_FlareFadeSpeed: 3 m_HaloTexture: {fileID: 0} m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} m_DefaultReflectionMode: 0 m_DefaultReflectionResolution: 128 m_ReflectionBounces: 1 m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 serializedVersion: 11 m_GIWorkflowMode: 1 m_GISettings: serializedVersion: 2 m_BounceScale: 1 m_IndirectOutputScale: 1 m_AlbedoBoost: 1 m_EnvironmentLightingMode: 0 m_EnableBakedLightmaps: 1 m_EnableRealtimeLightmaps: 0 m_LightmapEditorSettings: serializedVersion: 12 m_Resolution: 2 m_BakeResolution: 40 m_AtlasSize: 1024 m_AO: 0 m_AOMaxDistance: 1 m_CompAOExponent: 1 m_CompAOExponentDirect: 0 m_ExtractAmbientOcclusion: 0 m_Padding: 2 m_LightmapParameters: {fileID: 0} m_LightmapsBakeMode: 1 m_TextureCompression: 1 m_FinalGather: 0 m_FinalGatherFiltering: 1 m_FinalGatherRayCount: 256 m_ReflectionCompression: 2 m_MixedBakeMode: 2 m_BakeBackend: 1 m_PVRSampling: 1 m_PVRDirectSampleCount: 32 m_PVRSampleCount: 512 m_PVRBounces: 2 m_PVREnvironmentSampleCount: 256 m_PVREnvironmentReferencePointCount: 2048 m_PVRFilteringMode: 1 m_PVRDenoiserTypeDirect: 1 m_PVRDenoiserTypeIndirect: 1 m_PVRDenoiserTypeAO: 1 m_PVRFilterTypeDirect: 0 m_PVRFilterTypeIndirect: 0 m_PVRFilterTypeAO: 0 m_PVREnvironmentMIS: 1 m_PVRCulling: 1 m_PVRFilteringGaussRadiusDirect: 1 m_PVRFilteringGaussRadiusIndirect: 5 m_PVRFilteringGaussRadiusAO: 2 m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 m_ExportTrainingData: 0 m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} m_UseShadowmask: 1 --- !u!196 &4 NavMeshSettings: serializedVersion: 2 m_ObjectHideFlags: 0 m_BuildSettings: serializedVersion: 2 agentTypeID: 0 agentRadius: 0.5 agentHeight: 2 agentSlope: 45 agentClimb: 0.4 ledgeDropHeight: 0 maxJumpAcrossDistance: 0 minRegionArea: 2 manualCellSize: 0 cellSize: 0.16666667 manualTileSize: 0 tileSize: 256 accuratePlacement: 0 debug: m_Flags: 0 m_NavMeshData: {fileID: 0} --- !u!1 &21594508 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 21594509} - component: {fileID: 21594511} - component: {fileID: 21594510} m_Layer: 5 m_Name: Placeholder m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &21594509 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 21594508} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1908724337} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: -0.5} m_SizeDelta: {x: -20, y: -13} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &21594510 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 21594508} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} m_RaycastTarget: 1 m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 m_FontStyle: 2 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 40 m_Alignment: 0 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Enter Prompt Here --- !u!222 &21594511 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 21594508} m_CullTransparentMesh: 0 --- !u!1001 &127665943 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 0} m_Modifications: - target: {fileID: 8905070302076984395, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_Name value: OpenAiCompleterV1 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_RootOrder value: 1 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - target: {fileID: 9000805303073374261, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: f28446e696573d2418d2a68633c4a3b3, type: 3} --- !u!1 &280116129 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 280116130} - component: {fileID: 280116133} - component: {fileID: 280116132} - component: {fileID: 280116131} m_Layer: 5 m_Name: Button_Quit m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &280116130 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 280116129} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 865087086} m_Father: {fileID: 638305107} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: -470} m_SizeDelta: {x: 200, y: 60} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &280116131 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 280116129} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 280116132} m_OnClick: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1144405788} m_MethodName: QuitApp m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 m_StringArgument: m_BoolArgument: 0 m_CallState: 2 --- !u!114 &280116132 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 280116129} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &280116133 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 280116129} m_CullTransparentMesh: 0 --- !u!1 &285536669 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 285536670} - component: {fileID: 285536672} - component: {fileID: 285536671} m_Layer: 5 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &285536670 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 285536669} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 638305107} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: -300} m_SizeDelta: {x: 1000, y: 102} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &285536671 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 285536669} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 40 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Output --- !u!222 &285536672 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 285536669} m_CullTransparentMesh: 0 --- !u!1 &358800524 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 358800527} - component: {fileID: 358800526} - component: {fileID: 358800525} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!81 &358800525 AudioListener: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 358800524} m_Enabled: 1 --- !u!20 &358800526 Camera: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 358800524} m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 2 m_BackGroundColor: {r: 0, g: 0.21792704, b: 0.2830189, a: 0} m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} m_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 x: 0 y: 0 width: 1 height: 1 near clip plane: 0.3 far clip plane: 1000 field of view: 60 orthographic: 0 orthographic size: 5 m_Depth: -1 m_CullingMask: serializedVersion: 2 m_Bits: 4294967295 m_RenderingPath: -1 m_TargetTexture: {fileID: 0} m_TargetDisplay: 0 m_TargetEye: 3 m_HDR: 1 m_AllowMSAA: 1 m_AllowDynamicResolution: 0 m_ForceIntoRT: 0 m_OcclusionCulling: 1 m_StereoConvergence: 10 m_StereoSeparation: 0.022 --- !u!4 &358800527 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 358800524} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &638305103 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 638305107} - component: {fileID: 638305106} - component: {fileID: 638305105} - component: {fileID: 638305104} m_Layer: 5 m_Name: Canvas m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &638305104 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 638305103} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} m_Name: m_EditorClassIdentifier: m_IgnoreReversedGraphics: 1 m_BlockingObjects: 0 m_BlockingMask: serializedVersion: 2 m_Bits: 4294967295 --- !u!114 &638305105 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 638305103} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} m_Name: m_EditorClassIdentifier: m_UiScaleMode: 1 m_ReferencePixelsPerUnit: 100 m_ScaleFactor: 1 m_ReferenceResolution: {x: 1920, y: 1080} m_ScreenMatchMode: 0 m_MatchWidthOrHeight: 0 m_PhysicalUnit: 3 m_FallbackScreenDPI: 96 m_DefaultSpriteDPI: 96 m_DynamicPixelsPerUnit: 1 --- !u!223 &638305106 Canvas: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 638305103} m_Enabled: 1 serializedVersion: 3 m_RenderMode: 0 m_Camera: {fileID: 0} m_PlaneDistance: 100 m_PixelPerfect: 0 m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_AdditionalShaderChannelsFlag: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 --- !u!224 &638305107 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 638305103} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} m_Children: - {fileID: 1908724337} - {fileID: 1075851854} - {fileID: 285536670} - {fileID: 280116130} m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} --- !u!1 &865087085 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 865087086} - component: {fileID: 865087088} - component: {fileID: 865087087} m_Layer: 5 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &865087086 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 865087085} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 280116130} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &865087087 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 865087085} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 40 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Quit Application --- !u!222 &865087088 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 865087085} m_CullTransparentMesh: 0 --- !u!1 &1075851853 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1075851854} - component: {fileID: 1075851857} - component: {fileID: 1075851856} - component: {fileID: 1075851855} m_Layer: 5 m_Name: Button_Completion m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1075851854 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1075851853} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1986469218} m_Father: {fileID: 638305107} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: -62} m_SizeDelta: {x: 200, y: 60} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1075851855 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1075851853} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 1075851856} m_OnClick: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1144405788} m_MethodName: DoApiCompletion m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 m_StringArgument: m_BoolArgument: 0 m_CallState: 2 --- !u!114 &1075851856 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1075851853} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &1075851857 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1075851853} m_CullTransparentMesh: 0 --- !u!1 &1144405786 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1144405787} - component: {fileID: 1144405788} m_Layer: 0 m_Name: CompletionExample m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!4 &1144405787 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1144405786} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1144405788 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1144405786} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 0dffa08172edd254b9cd939b09f211a0, type: 3} m_Name: m_EditorClassIdentifier: Input: {fileID: 1908724338} Output: {fileID: 285536671} --- !u!1 &1908724336 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1908724337} - component: {fileID: 1908724340} - component: {fileID: 1908724339} - component: {fileID: 1908724338} m_Layer: 5 m_Name: Input m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1908724337 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1908724336} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 21594509} - {fileID: 2129249664} m_Father: {fileID: 638305107} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 100} m_SizeDelta: {x: 1000, y: 120} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1908724338 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1908724336} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} m_Name: m_EditorClassIdentifier: m_Navigation: m_Mode: 3 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} m_SelectedSprite: {fileID: 0} m_DisabledSprite: {fileID: 0} m_AnimationTriggers: m_NormalTrigger: Normal m_HighlightedTrigger: Highlighted m_PressedTrigger: Pressed m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 m_TargetGraphic: {fileID: 1908724339} m_TextComponent: {fileID: 2129249665} m_Placeholder: {fileID: 21594510} m_ContentType: 0 m_InputType: 0 m_AsteriskChar: 42 m_KeyboardType: 0 m_LineType: 0 m_HideMobileInput: 0 m_CharacterValidation: 0 m_CharacterLimit: 0 m_OnEndEdit: m_PersistentCalls: m_Calls: [] m_OnValueChanged: m_PersistentCalls: m_Calls: [] m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_CustomCaretColor: 0 m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} m_Text: m_CaretBlinkRate: 0.85 m_CaretWidth: 1 m_ReadOnly: 0 --- !u!114 &1908724339 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1908724336} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 --- !u!222 &1908724340 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1908724336} m_CullTransparentMesh: 0 --- !u!1 &1986469217 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1986469218} - component: {fileID: 1986469220} - component: {fileID: 1986469219} m_Layer: 5 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &1986469218 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1986469217} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1075851854} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1986469219 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1986469217} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 40 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Attempt Completion --- !u!222 &1986469220 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1986469217} m_CullTransparentMesh: 0 --- !u!1 &2056935214 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 2056935217} - component: {fileID: 2056935216} - component: {fileID: 2056935215} m_Layer: 0 m_Name: EventSystem m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &2056935215 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2056935214} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} m_Name: m_EditorClassIdentifier: m_HorizontalAxis: Horizontal m_VerticalAxis: Vertical m_SubmitButton: Submit m_CancelButton: Cancel m_InputActionsPerSecond: 10 m_RepeatDelay: 0.5 m_ForceModuleActive: 0 --- !u!114 &2056935216 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2056935214} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} m_Name: m_EditorClassIdentifier: m_FirstSelected: {fileID: 0} m_sendNavigationEvents: 1 m_DragThreshold: 10 --- !u!4 &2056935217 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2056935214} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2129249663 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 2129249664} - component: {fileID: 2129249666} - component: {fileID: 2129249665} m_Layer: 5 m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!224 &2129249664 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2129249663} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1908724337} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: -0.5} m_SizeDelta: {x: -20, y: -13} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2129249665 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2129249663} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_FontSize: 24 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 m_MaxSize: 40 m_Alignment: 0 m_AlignByGeometry: 0 m_RichText: 0 m_HorizontalOverflow: 1 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: --- !u!222 &2129249666 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2129249663} m_CullTransparentMesh: 0 ================================================ FILE: Runtime/Scenes/ExampleOpenAiApiRuntimeScene.unity.meta ================================================ fileFormatVersion: 2 guid: 725f21f739d61fd47829ba2893d9c60f DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scenes.meta ================================================ fileFormatVersion: 2 guid: 8439a2f9f61f4044dadc2eba83e4b910 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Base/AApiResource.cs ================================================ using OpenAi.Json; using System; using System.Collections; using System.IO; using System.Text; using System.Threading.Tasks; using UnityEngine; using UnityEngine.Networking; namespace OpenAi.Api.V1 { /// /// An api resource represents some api endpoint with a specific function. An /// example of an api resource is https://api.openai.com/v1/engines. Each resource /// endpoint can have different functionity based on the HTTP method used (GET, POST, etc.) /// and the parameters provided in the request body. /// public abstract class AApiResource : IApiResource where TParent : IApiResource { private StringBuilder _sb = new StringBuilder(); /// public IApiResource ParentResource { get; } /// public abstract string Endpoint { get; } /// public void PopulateAuthHeaders(UnityWebRequest client) => ParentResource.PopulateAuthHeaders(client); /// public string Url { get { _sb.Clear(); ConstructEndpoint(_sb); return _sb.ToString(); } } /// /// Create a resource with a parent. Depending on how the api is /// architected, parents can provide common pieces of the api endpoints /// to their children. For example, https://api.openai.com/v1 could be /// represented by with a child of /// to represent https://api.openai.com/v1/engines /// public AApiResource(TParent parent) { ParentResource = parent; } /// public void ConstructEndpoint(StringBuilder sb) { ParentResource.ConstructEndpoint(sb); sb.Append(Endpoint); } #region GET /// /// Implements an async get request /// protected async Task> GetAsync() where TResponse : AModelV1, new() { UnityWebRequest response = await GetRequestAsync(); return PackResult(response); } /// /// Implements a get request as a Coroutine /// protected Coroutine GetCoroutine(MonoBehaviour mono, Action> onResult) where TResponse : AModelV1, new() { return mono.StartCoroutine(GetRoutine()); IEnumerator GetRoutine() { UnityWebRequest response = null; yield return mono.StartCoroutine(GetRequestCoroutine((res) => response = res)); if (response == null) onResult(new ApiResult() { IsSuccess = false }); ApiResult result = PackResult(response); if (result == null) onResult(new ApiResult() { IsSuccess = false }); else onResult(result); } } #endregion #region DELETE /// /// Implements an async get request /// protected async Task DeleteAsync() { UnityWebRequest response = await DeleteRequestAsync(); return PackResult_RequestOnly(response); } /// /// Implements a get request as a Coroutine /// protected Coroutine DeleteCoroutine(MonoBehaviour mono, Action onResult) { return mono.StartCoroutine(DeleteRoutine()); IEnumerator DeleteRoutine() { UnityWebRequest response = null; yield return mono.StartCoroutine(DeleteRequestCoroutine((res) => response = res)); if (response == null) onResult(new ApiResult() { IsSuccess = false }); ApiResult result = PackResult_RequestOnly(response); if (result == null) onResult(new ApiResult() { IsSuccess = false }); else onResult(result); } } #endregion #region POST /// /// Implements an async post request /// protected async Task> PostAsync(TRequest request) where TRequest : AModelV1, new() where TResponse : AModelV1, new() { UnityWebRequest response = await PostRequestAsync(request); return PackResult(response); } /// /// Implements a post request as a coroutine /// /// protected Coroutine PostCoroutine(MonoBehaviour mono, TRequest request, Action> onResult) where TRequest : AModelV1, new() where TResponse : AModelV1, new() { return mono.StartCoroutine(PostRoutine()); IEnumerator PostRoutine() { UnityWebRequest response = null; yield return mono.StartCoroutine(PostRequestCoroutine(request, (res) => response = res)); if (response == null) onResult(new ApiResult() { IsSuccess = false }); ApiResult result = PackResult(response); if (result == null) onResult(new ApiResult() { IsSuccess = false }); else onResult(result); } } #endregion #region POST Event Stream /// /// Implements an async post request, with the reception method as event streams /// protected async Task PostAsync_EventStream(TRequest request, Action> onRequestStatus, Action onPartialResult, Action onCompletion = null) where TRequest : AModelV1, new() where TResponse : AModelV1, new() { UnityWebRequest response = await PostRequestAsync(request); ApiResult status = new ApiResult() { IsSuccess = response.result == UnityWebRequest.Result.Success, HttpResponse = response }; onRequestStatus(status); if (response.result == UnityWebRequest.Result.Success) await ReadEventStreamAsync(response, onPartialResult, onCompletion); } /// /// Implements a post request as a coroutine, with the reception method as event streams /// /// protected Coroutine PostCoroutine_EventStream(MonoBehaviour mono, TRequest request, Action> onRequestStatus, Action onPartialResult, Action onCompletion = null) where TRequest : AModelV1, new() where TResponse : AModelV1, new() { return mono.StartCoroutine(PostEventStreamRoutine()); IEnumerator PostEventStreamRoutine() { UnityWebRequest response = null; yield return mono.StartCoroutine(PostRequestCoroutine(request, (res) => response = res)); if (response == null) onRequestStatus(new ApiResult() { IsSuccess = false }); else onRequestStatus(new ApiResult() { IsSuccess = response.result == UnityWebRequest.Result.Success, HttpResponse = response }); if (response != null && response.result == UnityWebRequest.Result.Success) { Task ReadStreamTask = ReadEventStreamAsync(response, onPartialResult, onCompletion); while (!ReadStreamTask.IsCompleted) yield return new WaitForEndOfFrame(); } } } #endregion private async Task PostRequestAsync(TRequest request) where TRequest : AModelV1, new() { UnityWebRequest client = #if UNITY_2022_2_OR_NEWER UnityWebRequest.PostWwwForm(Url, string.Empty); #else UnityWebRequest.Post(Url, string.Empty); #endif ParentResource.PopulateAuthHeaders(client); AddJsonToUnityWebRequest(client, request.ToJson()); await client.SendWebRequest(); client.uploadHandler.Dispose(); return client; } private async Task GetRequestAsync() { UnityWebRequest client = UnityWebRequest.Get(Url); ParentResource.PopulateAuthHeaders(client); await client.SendWebRequest(); return client; } private async Task DeleteRequestAsync() { UnityWebRequest client = UnityWebRequest.Delete(Url); ParentResource.PopulateAuthHeaders(client); await client.SendWebRequest(); return client; } private async Task ReadEventStreamAsync(UnityWebRequest response, Action onPartialResult, Action onCompletion) where TResponse : AModelV1, new() { using (Stream stream = new MemoryStream(response.downloadHandler.data)) { int index = 0; using (StreamReader reader = new StreamReader(stream)) { string line; while ((line = await reader.ReadLineAsync()) != null) { if (line.StartsWith("data: ")) line = line.Substring("data: ".Length); if (line == "[DONE]") { if(onCompletion != null) onCompletion(); return; } else if (!string.IsNullOrWhiteSpace(line)) { index++; JsonObject obj = JsonDeserializer.FromJson(line.Trim()); TResponse streamedResult = new TResponse(); streamedResult.FromJson(obj); onPartialResult(index, streamedResult); } } } } } private IEnumerator PostRequestCoroutine(TRequest request, Action onResponse) where TRequest : AModelV1, new() { Task responseTask = PostRequestAsync(request); while (!responseTask.IsCompleted) yield return new WaitForEndOfFrame(); UnityWebRequest response = responseTask.Result; onResponse(response); } private IEnumerator GetRequestCoroutine(Action onResponse) { Task responseTask = GetRequestAsync(); while (!responseTask.IsCompleted) yield return new WaitForEndOfFrame(); UnityWebRequest response = responseTask.Result; onResponse(response); } private IEnumerator DeleteRequestCoroutine(Action onResponse) { Task responseTask = DeleteRequestAsync(); while (!responseTask.IsCompleted) yield return new WaitForEndOfFrame(); UnityWebRequest response = responseTask.Result; onResponse(response); } private ApiResult PackResult(UnityWebRequest response) where TResponse : AModelV1, new() { ApiResult result = new ApiResult() { IsSuccess = response.result == UnityWebRequest.Result.Success, HttpResponse = response }; if (result.IsSuccess) { string resultAsString = response.downloadHandler.text; result.Result = UnpackResponseObject(resultAsString); } return result; } private ApiResult PackResult_RequestOnly(UnityWebRequest response) { ApiResult result = new ApiResult() { IsSuccess = response.result == UnityWebRequest.Result.Success, HttpResponse = response }; return result; } private void AddJsonToUnityWebRequest(UnityWebRequest client, string json) { client.SetRequestHeader("Content-Type", "application/json"); client.uploadHandler = new UploadHandlerRaw( Encoding.UTF8.GetBytes(json) ); } private TModel UnpackResponseObject(string content) where TModel : AModelV1, new() { JsonObject obj = JsonDeserializer.FromJson(content); TModel res = new TModel(); res.FromJson(obj); return res; } } } ================================================ FILE: Runtime/Scripts/Api/Base/AApiResource.cs.meta ================================================ fileFormatVersion: 2 guid: e39588fc3ace7674abd12ac0f6d7b8a8 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Base/ApiResult.cs ================================================ using UnityEngine.Networking; namespace OpenAi.Api.V1 { /// /// A result of an api call /// public class ApiResult { /// /// True if the request status is a success code /// public bool IsSuccess; /// /// The completed /// public UnityWebRequest HttpResponse; } /// /// A result of an api call /// /// The type of result expected from the api call public class ApiResult : ApiResult { /// /// The deserailized response from the call. Null if no repsonse received or call unsuccessful. /// public TResult Result; } } ================================================ FILE: Runtime/Scripts/Api/Base/ApiResult.cs.meta ================================================ fileFormatVersion: 2 guid: 0fa1c3e1c2e076e41abbd23c265754aa MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Base/IApiResource.cs ================================================ using System.Text; using UnityEngine.Networking; namespace OpenAi.Api.V1 { /// /// Represents an API endpoint /// public interface IApiResource { /// /// The parent resource object. Null if root. /// IApiResource ParentResource { get; } /// /// The url endpoint of the resource. /// string Endpoint { get; } /// /// The full constucted url to the endpoint /// string Url { get; } /// /// The endpoint is constructed by passing a up /// the tree until the parent is reached. The Parent then adds it's portion /// of the endpoint. The first child contributes it's portion, and so on. Until /// the whole endpoint is created. /// void ConstructEndpoint(StringBuilder sb); /// /// Populates a with the appropriate auth headers /// /// void PopulateAuthHeaders(UnityWebRequest client); } } ================================================ FILE: Runtime/Scripts/Api/Base/IApiResource.cs.meta ================================================ fileFormatVersion: 2 guid: 8eda116edf0387a44b2d3d67d0894770 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Base/OpenAiApiException.cs ================================================ using System; using UnityEngine; using Object = UnityEngine.Object; namespace OpenAi.Api { /// /// Exception that occurs when OpenAiApi calls fail /// public class OpenAiApiException : Exception { /// /// The context of the failed api call /// public Object Context { get; private set; } /// /// Construct with message, optional context and optional inner exception /// public OpenAiApiException(string message, Object context = null, Exception innerException = null) : base(message, innerException) { Context = context; } /// /// Prints an error to the unity console. /// public void LogAsError() { if(Context != null) { Debug.LogError($"OpenAiApi Error: {Message}", Context); } else { Debug.LogError($"OpenAiApi Error: {Message}"); } } } } ================================================ FILE: Runtime/Scripts/Api/Base/OpenAiApiException.cs.meta ================================================ fileFormatVersion: 2 guid: c74f739190347234db19aef3105a5375 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Base.meta ================================================ fileFormatVersion: 2 guid: b2c6be357cb1e6142bb16905d61aabf4 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Utility/EChatModelNames/EChatModelName.cs ================================================ using System; namespace OpenAi.Api { public static class UTEChatModelName { public static string GetModelName(EEngineName name) { switch (name) { case EEngineName.gpt_35_turbo: return UTModelNames.gpt_35_turbo; case EEngineName.BETA_gpt_4: return UTModelNames.BETA_gpt_4; case EEngineName.BETA_gpt_4_32k: return UTModelNames.BETA_gpt_4_32k; } throw new ArgumentException($"Invalid enum value provided when getting chat model name. Value provided: {name}"); } } } ================================================ FILE: Runtime/Scripts/Api/Utility/EChatModelNames/EChatModelName.cs.meta ================================================ fileFormatVersion: 2 guid: 1357fb1fce4191e42827032bccc96935 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Utility/EChatModelNames.meta ================================================ fileFormatVersion: 2 guid: d630afaa3786c95469a23e3dd97b1749 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Utility/EngineNames/EEngineName.cs ================================================ using System; namespace OpenAi.Api { public enum EEngineName { // GPT-3 ada, babbage, curie, davinci, text_ada_001, text_babbage_001, text_curie_001, // GPT 3-5 gpt_35_turbo, text_davinci_003, text_davinci_002, code_davinci_002, // GPT-4 in beta BETA_gpt_4, BETA_gpt_4_32k, } public static class UTEEngineName { public static string GetEngineName(EEngineName name) { switch (name) { case EEngineName.ada: return UTModelNames.ada; case EEngineName.babbage: return UTModelNames.babbage; case EEngineName.curie: return UTModelNames.curie; case EEngineName.davinci: return UTModelNames.davinci; case EEngineName.text_ada_001: return UTModelNames.text_ada_001; case EEngineName.text_babbage_001: return UTModelNames.text_babbage_001; case EEngineName.text_curie_001: return UTModelNames.text_curie_001; case EEngineName.gpt_35_turbo: return UTModelNames.gpt_35_turbo; case EEngineName.text_davinci_003: return UTModelNames.text_davinci_003; case EEngineName.text_davinci_002: return UTModelNames.text_davinci_002; case EEngineName.code_davinci_002: return UTModelNames.code_davinci_002; case EEngineName.BETA_gpt_4: return UTModelNames.BETA_gpt_4; case EEngineName.BETA_gpt_4_32k: return UTModelNames.BETA_gpt_4_32k; } throw new ArgumentException($"Invalid enum value provided when getting model name. Value provided: {name}"); } } } ================================================ FILE: Runtime/Scripts/Api/Utility/EngineNames/EEngineName.cs.meta ================================================ fileFormatVersion: 2 guid: a7f86371651b34640b3b6fc8c743ecb0 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Utility/EngineNames/UTEngineNames.cs ================================================ namespace OpenAi.Api { public static class UTModelNames { // GPT-3 public const string ada = "ada"; public const string babbage = "babbage"; public const string curie = "curie"; public const string davinci = "davinci"; public const string text_ada_001 = "text-ada-001"; public const string text_babbage_001= "text-babbage-001"; public const string text_curie_001= "text-curie-001"; // GPT 3-5 public const string gpt_35_turbo = "gpt-3.5-turbo"; public const string text_davinci_003 = "text-davinci-003"; public const string text_davinci_002= "text-davinci-002"; public const string code_davinci_002 = "code-davinci-002"; // GPT-4 in beta public const string BETA_gpt_4 = "gpt-4"; public const string BETA_gpt_4_32k = "gpt-4-32k"; } } ================================================ FILE: Runtime/Scripts/Api/Utility/EngineNames/UTEngineNames.cs.meta ================================================ fileFormatVersion: 2 guid: 355de6e305023a9448d2b35ac39294a9 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Utility/EngineNames.meta ================================================ fileFormatVersion: 2 guid: a9ce3ed80c6c87f439a23eafeb0342b7 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Utility/StringOrArray.cs ================================================ using OpenAi.Json; using System.Collections.Generic; namespace OpenAi.Api.V1 { /// /// Can be interpreted as a string (if only 1 string added) or an array, if multiple strings added. This is to facilitate arguments in the OpenAi.Api /// public class StringOrArray { private List _elements; /// /// Create a string or array using input strings. If 0 strings are provided, Resolve() = null. If /// 1 string is provided, Resolve() = a string, if 2+ strings are provided, Resolve() = string[] /// /// public StringOrArray(params string[] strings) { if (strings != null) { //Nullifies the empty strings in the array for (var i = 0; i < strings.Length; i++) { strings[i] = string.IsNullOrEmpty(strings[i]) ? null : strings[i]; } _elements = new List(strings); } } /// /// Resolves the StringOrArray to the appropriate type /// /// public object Resolve() { if (_elements == null || _elements.Count == 0) return null; if (_elements.Count == 1) return _elements[0]; return _elements.ToArray(); } /// /// Popualte based on json object /// public void FromJson(JsonObject json) { if(json.Type == EJsonType.List) { _elements = new List(); foreach(JsonObject obj in json.NestedValues) { _elements.Add(obj.StringValue); } } else if(json.Type == EJsonType.Value) { _elements = new List(); _elements.Add(json.StringValue); } } /// /// Implicitly make a StringOrArray from a string /// /// public static implicit operator StringOrArray(string str) { if (string.IsNullOrEmpty(str)) return null; return new StringOrArray(str); } /// /// Implicitly make a StringOrArray from a string array /// /// public static implicit operator StringOrArray(string[] strings) { if (strings == null) return null; return new StringOrArray(strings); } } } ================================================ FILE: Runtime/Scripts/Api/Utility/StringOrArray.cs.meta ================================================ fileFormatVersion: 2 guid: bbd00387caa7d8845a61bc6135e50e0a MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Utility/UnityWebRequestAsync/UnityWebRequestAwaiter.cs ================================================ // Taken from this gist https://gist.github.com/krzys-h/9062552e33dd7bd7fe4a6c12db109a1a using System; using System.Runtime.CompilerServices; using UnityEngine; using UnityEngine.Networking; namespace OpenAi.Api.V1 { /// /// Allows the UnityWebRequest object to be awaited /// public class UnityWebRequestAwaiter : INotifyCompletion { private UnityWebRequestAsyncOperation asyncOp; private Action continuation; public UnityWebRequestAwaiter(UnityWebRequestAsyncOperation asyncOp) { this.asyncOp = asyncOp; asyncOp.completed += OnRequestCompleted; } public bool IsCompleted { get { return asyncOp.isDone; } } public void GetResult() { } public void OnCompleted(Action continuation) { this.continuation = continuation; } private void OnRequestCompleted(AsyncOperation obj) { continuation(); } } } ================================================ FILE: Runtime/Scripts/Api/Utility/UnityWebRequestAsync/UnityWebRequestAwaiter.cs.meta ================================================ fileFormatVersion: 2 guid: 80b39eca5abef8f428da95abb7e26b0b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Utility/UnityWebRequestAsync/UnityWebRequestExtensions.cs ================================================ // Taken from this gist https://gist.github.com/krzys-h/9062552e33dd7bd7fe4a6c12db109a1a using UnityEngine.Networking; namespace OpenAi.Api.V1 { /// /// Provides a get waiter extension to Unity web requests to allow it to be awaited /// public static class ExtensionMethods { public static UnityWebRequestAwaiter GetAwaiter(this UnityWebRequestAsyncOperation asyncOp) { return new UnityWebRequestAwaiter(asyncOp); } } } ================================================ FILE: Runtime/Scripts/Api/Utility/UnityWebRequestAsync/UnityWebRequestExtensions.cs.meta ================================================ fileFormatVersion: 2 guid: ae29d89f8e5725341b1013077dec7a43 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Utility/UnityWebRequestAsync.meta ================================================ fileFormatVersion: 2 guid: 290d20dbfb3926844b03ed47ed3145b6 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/Utility.meta ================================================ fileFormatVersion: 2 guid: afac1627f3594e144b74d8d81b1a0060 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Chat/ChatResourceV1.cs ================================================ using System; using System.Threading.Tasks; using UnityEngine; namespace OpenAi.Api.V1 { /// /// Resource providing base chat functionality. /// public class ChatResourceV1 : AApiResource { /// public override string Endpoint => "/chat"; /// /// Construct with parent /// /// public ChatResourceV1(OpenAiApiV1 parent) : base(parent) { Completions = new ChatCompletionsResourceV1(this); } /// /// Completions resource. /// /// public ChatCompletionsResourceV1 Completions { get; private set; } } } ================================================ FILE: Runtime/Scripts/Api/V1/Api/Chat/ChatResourceV1.cs.meta ================================================ fileFormatVersion: 2 guid: 4341471d81112ce45a0cff5db6755675 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Chat/Completions/ChatCompletionRequestV1.cs ================================================ using OpenAi.Json; using System; using System.Collections.Generic; namespace OpenAi.Api.V1 { /// /// Object used when requesting a chat completion. /// public class ChatCompletionRequestV1 : AModelV1 { /// /// The OpenAI model to use /// public string model; /// /// Messages to send /// public List messages = new List(); /// /// What sampling temperature to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or top_p but not both. /// public float? temperature; /// /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. /// public float? top_p; /// /// How many completions to generate for each prompt. Note: Because this parameter generates many completions, it can quickly consume your token quota.Use carefully and ensure that you have reasonable settings for max_tokens and stop. /// public int? n; /// /// Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. /// public bool? stream; /// /// Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. /// public StringOrArray stop; /// /// The maximum number of tokens to generate. Requests can use up to 2048 tokens shared between prompt and completion. (One token is roughly 4 characters for normal English text) /// public int? max_tokens; /// /// Number between 0 and 1 that penalizes new tokens based on whether they appear in the text so far. Increases the model's likelihood to talk about new topics. /// public float? presence_penalty; /// /// Number between 0 and 1 that penalizes new tokens based on their existing frequency in the text so far. Decreases the model's likelihood to repeat the same line verbatim. /// public float? frequency_penalty; /// /// Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens(specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this tokenizer tool (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass {"50256": -100} to prevent the <|endoftext|> token from being generated. /// public Dictionary logit_bias; /// /// Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. /// public string user; /// public override void FromJson(JsonObject json) { if (json.Type != EJsonType.Object) throw new OpenAiApiException("Deserialization failed, provided json is not an object"); foreach (JsonObject obj in json.NestedValues) { switch (obj.Name) { case nameof(model): model = obj.StringValue; break; case nameof(messages): foreach (JsonObject child in obj.NestedValues) { MessageV1 message = new MessageV1(); message.FromJson(child); messages.Add(message); } break; case nameof(temperature): temperature = float.Parse(obj.StringValue); break; case nameof(top_p): top_p = float.Parse(obj.StringValue); break; case nameof(n): n = int.Parse(obj.StringValue); break; case nameof(stream): stream = bool.Parse(obj.StringValue); break; case nameof(stop): stop = new StringOrArray(); stop.FromJson(obj); break; case nameof(max_tokens): max_tokens = int.Parse(obj.StringValue); break; case nameof(presence_penalty): presence_penalty = float.Parse(obj.StringValue); break; case nameof(frequency_penalty): frequency_penalty = float.Parse(obj.StringValue); break; case nameof(logit_bias): logit_bias = new Dictionary(); foreach (JsonObject child in obj.NestedValues) { logit_bias.Add(child.Name, int.Parse(child.StringValue)); } break; case nameof(user): user = obj.StringValue; break; } } } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(model), model); jb.AddArray(nameof(messages), messages.ToArray()); jb.Add(nameof(temperature), temperature); jb.Add(nameof(top_p), top_p); jb.Add(nameof(n), n); jb.Add(nameof(stream), stream); jb.Add(nameof(stop), stop); jb.Add(nameof(max_tokens), max_tokens); jb.Add(nameof(presence_penalty), presence_penalty); jb.Add(nameof(frequency_penalty), frequency_penalty); jb.Add(nameof(logit_bias), logit_bias); jb.Add(nameof(user), user); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Api/Chat/Completions/ChatCompletionRequestV1.cs.meta ================================================ fileFormatVersion: 2 guid: 92b8c1ff381c5c844b69877fec55c613 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Chat/Completions/ChatCompletionsResourceV1.cs ================================================ using System; using System.Threading.Tasks; using UnityEngine; namespace OpenAi.Api.V1 { /// /// Resource providing chat completions functionality. Text generation is the core function of the API. You give the API a prompt, and it generates a completion. The way you program the API to do a task is by simply describing the task in plain english or providing a few written examples. This simple approach works for a wide range of use cases, including summarization, translation, grammar correction, question answering, chatbots, composing emails, and much more (see the prompt library for inspiration). /// public class ChatCompletionsResourceV1 : AApiResource { /// public override string Endpoint => "/completions"; /// /// Construct with parent /// /// public ChatCompletionsResourceV1(ChatResourceV1 parent) : base(parent) { } /// /// This is the main endpoint of the API. Returns the predicted completion for the given prompt, and can also return the probabilities of alternative tokens at each position if requested. . Ignores with request.stream parameter and automatically set to false. To stream, use instead /// /// /// Asynchronously returns the completion result. Look in its property for the completions. public async Task> CreateChatCompletionAsync(ChatCompletionRequestV1 request) { return await PostAsync(request); } /// /// This is the main endpoint of the API. Returns the predicted completion for the given prompt, and can also return the probabilities of alternative tokens at each position if requested. . Ignores with request.stream parameter and automatically set to false. To stream, use instead /// /// /// Asynchronously returns the completion result. Look in its property for the completions. public Coroutine CreateChatCompletionCoroutine(MonoBehaviour mono, ChatCompletionRequestV1 request, Action> onResult) { return PostCoroutine(mono, request, onResult); } #region Streaming /// /// This is the main endpoint of the API. Returns the predicted completion for the given prompt, and can also return the probabilities of alternative tokens at each position if requested. . Ignores with request.stream parameter and automatically set to true. To stream, use instead /// /// /// Asynchronously returns the completion result. Look in its property for the completions. public async Task CreateChatCompletionAsync_EventStream(ChatCompletionRequestV1 request, Action> onRequestStatus, Action onPartialResult, Action onCompletion = null) { request.stream = true; await PostAsync_EventStream(request, onRequestStatus, onPartialResult, onCompletion); } /// /// This is the main endpoint of the API. Returns the predicted completion for the given prompt, and can also return the probabilities of alternative tokens at each position if requested. . Ignores with request.stream parameter and automatically set to true. To stream, use instead /// /// /// Asynchronously returns the completion result. Look in its property for the completions. public Coroutine CreateChatCompletionCoroutine_EventStream(MonoBehaviour mono, ChatCompletionRequestV1 request, Action> onRequestStatus, Action onPartialResult, Action onCompletion = null) { request.stream = true; return PostCoroutine_EventStream(mono, request, onRequestStatus, onPartialResult, onCompletion); } #endregion } } ================================================ FILE: Runtime/Scripts/Api/V1/Api/Chat/Completions/ChatCompletionsResourceV1.cs.meta ================================================ fileFormatVersion: 2 guid: bdb1362d65b74a043a3cea97ee915da7 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Chat/Completions.meta ================================================ fileFormatVersion: 2 guid: d65146491b5b90342a2f90ee79c5186b folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Chat.meta ================================================ fileFormatVersion: 2 guid: 29e74741b9ee81547a568f5cedb5367c folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines/Engine/Completions/CompletionRequestV1.cs ================================================ using OpenAi.Json; using System; using System.Collections.Generic; namespace OpenAi.Api.V1 { /// /// Object used when requesting a completion. /// public class CompletionRequestV1 : AModelV1 { /// /// The prompt(s) to generate completions for, encoded as a string, a list of strings, or a list of token lists. Note that<|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. /// public StringOrArray prompt; /// /// The maximum number of tokens to generate. Requests can use up to 2048 tokens shared between prompt and completion. (One token is roughly 4 characters for normal English text) /// public int? max_tokens; /// /// What sampling temperature to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or top_p but not both. /// public float? temperature; /// /// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. /// public float? top_p; /// /// How many completions to generate for each prompt. Note: Because this parameter generates many completions, it can quickly consume your token quota.Use carefully and ensure that you have reasonable settings for max_tokens and stop. /// public int? n; /// /// Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. /// public bool? stream; /// /// Include the log probabilities on the logprobs most likely tokens, as well the chosen tokens. For example, if logprobs is 10, the API will return a list of the 10 most likely tokens. the API will always return the logprob of the sampled token, so there may be up to logprobs+1 elements in the response. /// public int? logprobs; /// /// Echo back the prompt in addition to the completion /// public bool? echo; /// /// Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. /// public StringOrArray stop; /// /// Number between 0 and 1 that penalizes new tokens based on whether they appear in the text so far. Increases the model's likelihood to talk about new topics. /// public float? presence_penalty; /// /// Number between 0 and 1 that penalizes new tokens based on their existing frequency in the text so far. Decreases the model's likelihood to repeat the same line verbatim. /// public float? frequency_penalty; /// /// Generates best_of completions server-side and returns the "best" (the one with the lowest log probability per token). Results cannot be streamed. When used with n, best_of controls the number of candidate completions and n specifies how many to return – best_of must be greater than n. Note: Because this parameter generates many completions, it can quickly consume your token quota.Use carefully and enure that you have reasonable settings for max_tokens and stop. /// public int? best_of; /// /// Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens(specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this tokenizer tool (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass {"50256": -100} to prevent the <|endoftext|> token from being generated. /// public Dictionary logit_bias; /// public override void FromJson(JsonObject json) { if (json.Type != EJsonType.Object) throw new OpenAiApiException("Deserialization failed, provided json is not an object"); foreach(JsonObject obj in json.NestedValues) { switch (obj.Name) { case nameof(prompt): prompt = new StringOrArray(); prompt.FromJson(obj); break; case nameof(max_tokens): max_tokens = int.Parse(obj.StringValue); break; case nameof(temperature): temperature = float.Parse(obj.StringValue); break; case nameof(top_p): top_p = float.Parse(obj.StringValue); break; case nameof(n): n = int.Parse(obj.StringValue); break; case nameof(stream): stream = bool.Parse(obj.StringValue); break; case nameof(logprobs): logprobs = int.Parse(obj.StringValue); break; case nameof(echo): echo = bool.Parse(obj.StringValue); break; case nameof(stop): stop = new StringOrArray(); stop.FromJson(obj); break; case nameof(presence_penalty): presence_penalty = float.Parse(obj.StringValue); break; case nameof(frequency_penalty): frequency_penalty = float.Parse(obj.StringValue); break; case nameof(best_of): best_of = int.Parse(obj.StringValue); break; case nameof(logit_bias): logit_bias = new Dictionary(); foreach(JsonObject child in obj.NestedValues) { logit_bias.Add(child.Name, int.Parse(child.StringValue)); } break; } } } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(prompt), prompt); jb.Add(nameof(max_tokens), max_tokens); jb.Add(nameof(temperature), temperature); jb.Add(nameof(top_p), top_p); jb.Add(nameof(n), n); jb.Add(nameof(stream), stream); jb.Add(nameof(logprobs), logprobs); jb.Add(nameof(echo), echo); jb.Add(nameof(stop), stop); jb.Add(nameof(presence_penalty), presence_penalty); jb.Add(nameof(frequency_penalty), frequency_penalty); jb.Add(nameof(best_of), best_of); jb.Add(nameof(logit_bias), logit_bias); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines/Engine/Completions/CompletionRequestV1.cs.meta ================================================ fileFormatVersion: 2 guid: d67961fac1123804cbd0b551d5b54bc3 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines/Engine/Completions/CompletionsResourceV1.cs ================================================ using System; using System.Threading.Tasks; using UnityEngine; namespace OpenAi.Api.V1 { /// /// Resource providing completions functionality. Text generation is the core function of the API. You give the API a prompt, and it generates a completion. The way you program the API to do a task is by simply describing the task in plain english or providing a few written examples. This simple approach works for a wide range of use cases, including summarization, translation, grammar correction, question answering, chatbots, composing emails, and much more (see the prompt library for inspiration). /// public class CompletionsResourceV1 : AApiResource { /// public override string Endpoint => "/completions"; /// /// Construct with parent /// /// public CompletionsResourceV1(EngineResourceV1 parent) : base(parent) { } /// /// This is the main endpoint of the API. Returns the predicted completion for the given prompt, and can also return the probabilities of alternative tokens at each position if requested. . Ignores with request.stream parameter and automatically set to false. To stream, use instead /// /// /// Asynchronously returns the completion result. Look in its property for the completions. public async Task> CreateCompletionAsync(CompletionRequestV1 request) { request.stream = false; return await PostAsync(request); } /// /// This is the main endpoint of the API. Returns the predicted completion for the given prompt, and can also return the probabilities of alternative tokens at each position if requested. . Ignores with request.stream parameter and automatically set to false. To stream, use instead /// /// /// Asynchronously returns the completion result. Look in its property for the completions. public Coroutine CreateCompletionCoroutine(MonoBehaviour mono, CompletionRequestV1 request, Action> onResult) { request.stream = false; return PostCoroutine(mono, request, onResult); } #region Streaming /// /// This is the main endpoint of the API. Returns the predicted completion for the given prompt, and can also return the probabilities of alternative tokens at each position if requested. . Ignores with request.stream parameter and automatically set to true. To stream, use instead /// /// /// Asynchronously returns the completion result. Look in its property for the completions. public async Task CreateCompletionAsync_EventStream(CompletionRequestV1 request, Action> onRequestStatus, Action onPartialResult, Action onCompletion = null) { request.stream = true; await PostAsync_EventStream(request, onRequestStatus, onPartialResult, onCompletion); } /// /// This is the main endpoint of the API. Returns the predicted completion for the given prompt, and can also return the probabilities of alternative tokens at each position if requested. . Ignores with request.stream parameter and automatically set to true. To stream, use instead /// /// /// Asynchronously returns the completion result. Look in its property for the completions. public Coroutine CreateCompletionCoroutine_EventStream(MonoBehaviour mono, CompletionRequestV1 request, Action> onRequestStatus, Action onPartialResult, Action onCompletion = null) { request.stream = true; return PostCoroutine_EventStream(mono, request, onRequestStatus, onPartialResult, onCompletion); } #endregion } } ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines/Engine/Completions/CompletionsResourceV1.cs.meta ================================================ fileFormatVersion: 2 guid: 930378a6629aa0d49beee3f8872ecd17 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines/Engine/Completions.meta ================================================ fileFormatVersion: 2 guid: 9c530e33d81a2a44e992bdb1e6e1e42b folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines/Engine/EngineResourceV1.cs ================================================ using System; using System.Threading.Tasks; using UnityEngine; namespace OpenAi.Api.V1 { /// /// Resource related to a specific engine. /// public class EngineResourceV1 : AApiResource { private string _endpoint; /// public override string Endpoint => _endpoint; /// /// Completions resource. and onwards. /// public CompletionsResourceV1 Completions { get; private set; } /// /// Construct an engine resource with parent and engineId /// /// The ID of the engine to use for this request public EngineResourceV1(EnginesResourceV1 parent, string engineId) : base(parent) { _endpoint = $"/{engineId}"; Completions = new CompletionsResourceV1(this); } /// /// Retrieves an engine instance, providing basic information about the engine such as the owner and availability. /// public async Task> RetrieveEngineAsync() => await GetAsync(); /// /// Retrieves an engine instance, providing basic information about the engine such as the owner and availability. /// public Coroutine RetrieveEngineCoroutine(MonoBehaviour mono, Action> onResult) => GetCoroutine(mono, onResult); } } ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines/Engine/EngineResourceV1.cs.meta ================================================ fileFormatVersion: 2 guid: baeec16b75e2c6044b08752a3b420e84 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines/Engine.meta ================================================ fileFormatVersion: 2 guid: a73c5a0a80b8c364ebb4a11a5114bab9 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines/EnginesResourceV1.cs ================================================ using System; using System.Threading.Tasks; using UnityEngine; namespace OpenAi.Api.V1 { /// /// Provides functions to get infomation about available engines /// public class EnginesResourceV1 : AApiResource { /// public override string Endpoint => "/engines"; /// /// Construct Engines resource with parent /// /// public EnginesResourceV1(OpenAiApiV1 parent) : base(parent) { } /// /// Construct an engine resource using an engine id. The engine id must be a valid engine. /// /// /// The ID of the engine to use for this request public EngineResourceV1 Engine(string engineId) => new EngineResourceV1(this, engineId); /// /// Lists the currently available engines, and provides basic information about each one such as the owner and availability. /// public async Task> ListEnginesAsync() => await GetAsync(); /// /// Lists the currently available engines, and provides basic information about each one such as the owner and availability. /// public Coroutine ListEnginesCoroutine(MonoBehaviour mono, Action> onResult) => GetCoroutine(mono, onResult); } } ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines/EnginesResourceV1.cs.meta ================================================ fileFormatVersion: 2 guid: 9d81cffee98ada249b5ebca9d97eaba7 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Engines.meta ================================================ fileFormatVersion: 2 guid: bb4ca3b2a411cd3408d4bb4db3f9c235 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Files/File/FileResourceV1.cs ================================================ using System; using System.Threading.Tasks; using UnityEngine; namespace OpenAi.Api.V1 { /// /// Resource related to a specific engine. /// public class FileResourceV1 : AApiResource { private string _endpoint; /// public override string Endpoint => _endpoint; /// /// Construct an engine resource with parent and engineId /// /// The ID of the engine to use for this request public FileResourceV1(FilesResourceV1 parent, string fileId) : base(parent) { _endpoint = $"/{fileId}"; } /// /// Retrieve a file from the OpenAi Api backend /// public async Task> RetrieveEngineAsync() => await GetAsync(); /// /// Retrieve a file from the OpenAi Api backend /// public Coroutine RetrieveEngineCoroutine(MonoBehaviour mono, Action> onResult) => GetCoroutine(mono, onResult); /// /// Delete a file from the OpenAi Api backend /// public async Task DeleteFileAsync() => await DeleteAsync(); /// /// Delete a file from the OpenAi Api backend /// public Coroutine DeleteFileCoroutine(MonoBehaviour mono, Action> onResult) => GetCoroutine(mono, onResult); } } ================================================ FILE: Runtime/Scripts/Api/V1/Api/Files/File/FileResourceV1.cs.meta ================================================ fileFormatVersion: 2 guid: 5461aae83fd7f5b43b65528149966f6e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Files/File.meta ================================================ fileFormatVersion: 2 guid: 51906efa7ecd41c4ca8c4469cc98964b folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Files/FilesResourceV1.cs ================================================ using System; using System.Threading.Tasks; using UnityEngine; namespace OpenAi.Api.V1 { /// /// Provides functions to list and upload files /// public class FilesResourceV1 : AApiResource { /// public override string Endpoint => "/files"; /// /// Construct Files resource for listing and manging files /// /// public FilesResourceV1(OpenAiApiV1 parent) : base(parent) { } /// /// Construct an engine resource using an engine id. The engine id must be a valid engine. /// /// /// The ID of the engine to use for this request //public FilesResourceV1 Engine(string engineId) => new FilesResourceV1(this, ); /// /// Lists the currently available files /// public async Task> ListFilesAsync() => await GetAsync(); /// /// Lists the currently available files /// public Coroutine ListFilesCoroutine(MonoBehaviour mono, Action> onResult) => GetCoroutine(mono, onResult); } } ================================================ FILE: Runtime/Scripts/Api/V1/Api/Files/FilesResourceV1.cs.meta ================================================ fileFormatVersion: 2 guid: 26addc9b68de71c449ae34c6cdb88510 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api/Files.meta ================================================ fileFormatVersion: 2 guid: a6977f671f4c9ed44b1354cb9dcac515 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Api.meta ================================================ fileFormatVersion: 2 guid: a74574a8cf46ac747ad2a2dd7da64702 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/AnswerV1.cs ================================================ using OpenAi.Json; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace OpenAi.Api.V1 { public class AnswerV1 : AModelV1 { public string[] answers; public string completion; public string model; public string obj; public string search_model; public SelectedDocumentV1[] selected_documents; public override void FromJson(JsonObject json) { foreach (JsonObject jo in json.NestedValues) { switch (jo.Name) { case nameof(answers): answers = jo.AsStringArray(); break; case nameof(completion): completion = jo.StringValue; break; case nameof(model): model = jo.StringValue; break; case "object": obj = jo.StringValue; break; case nameof(search_model): search_model = jo.StringValue; break; case nameof(selected_documents): selected_documents = ArrayFromJson(jo); break; } } } public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.AddArray(nameof(answers), answers); jb.Add(nameof(completion), completion); jb.Add(nameof(model), model); jb.Add("object", obj); jb.Add(nameof(search_model), search_model); jb.AddArray(nameof(selected_documents), selected_documents); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/AnswerV1.cs.meta ================================================ fileFormatVersion: 2 guid: eb5c442bf526a7346b706c3e1214445d MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/ChatChoiceV1.cs ================================================ using OpenAi.Json; using System; using UnityEngine; namespace OpenAi.Api.V1 { /// /// A single choice returned by the OpenAi Api chat completion endpoint /// public class ChatChoiceV1 : AModelV1 { /// /// The returned message /// public MessageV1 message; /// /// A portion of the returned message /// public DeltaV1 delta; /// /// the index of the choice /// public int index; /// /// The reason the engine ended the completion /// public string finish_reason; /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); if (message != null) jb.Add(nameof(message), message.ToJson()); else if (delta != null) jb.Add(nameof(delta), delta.ToJson()); jb.Add(nameof(index), index); jb.Add(nameof(finish_reason), finish_reason); jb.EndObject(); return jb.ToString(); } /// public override void FromJson(JsonObject jsonObj) { if (jsonObj.Type != EJsonType.Object) throw new Exception("Must be an object"); foreach (JsonObject jo in jsonObj.NestedValues) { switch (jo.Name) { case nameof(message): message = new MessageV1(); message.FromJson(jo); break; case nameof(delta): delta = new DeltaV1(); delta.FromJson(jo); break; case nameof(index): index = int.Parse(jo.StringValue); break; case nameof(finish_reason): finish_reason = jo.StringValue; break; default: Debug.LogWarning("ChatChoiceV1: missing field " + jo.Name); break; } } } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/ChatChoiceV1.cs.meta ================================================ fileFormatVersion: 2 guid: 1dd6e46a4a834ac479389881228aac81 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/ChatCompletionV1.cs ================================================ using OpenAi.Json; using System; using System.Text; using UnityEngine; namespace OpenAi.Api.V1 { /// /// The response to chat completion request /// public class ChatCompletionV1 : AModelV1 { /// /// the id of the competion /// public string id; /// /// The object type (text_completion) /// public string obj; /// /// The created time as Unix epoch /// public int created; /// /// The model used to create the completion /// public string model; /// /// The choices returned by the completion /// public ChatChoiceV1[] choices; /// /// Token usage stats /// public UsageV1 usage; /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(id), id); jb.Add("object", obj); jb.Add(nameof(created), created); jb.Add(nameof(model), model); jb.AddArray(nameof(choices), choices); jb.AddSimpleObject(nameof(usage), usage); jb.EndObject(); return jb.ToString(); } /// public override void FromJson(JsonObject jsonObj) { if (jsonObj.Type != EJsonType.Object) throw new Exception("Must be an object"); foreach(JsonObject jo in jsonObj.NestedValues) { switch (jo.Name) { case nameof(id): id = jo.StringValue; break; case "object": obj = jo.StringValue; break; case nameof(created): created = int.Parse(jo.StringValue); break; case nameof(model): model = jo.StringValue; break; case nameof(choices): ChatChoiceV1[] choiceArray = new ChatChoiceV1[jo.NestedValues.Count]; for(int i = 0; i /// A single choice returned by the OpenAi Api completion endpoint /// public class ChoiceV1 : AModelV1 { /// /// The returned text /// public string text; /// /// the index of the choice /// public int index; /// /// The log probabilities /// public string logprobs; /// /// The reason the engine ended the completion /// public string finish_reason; /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(text), text); jb.Add(nameof(index), index); jb.Add(nameof(logprobs), logprobs); jb.Add(nameof(finish_reason), finish_reason); jb.EndObject(); return jb.ToString(); } /// public override void FromJson(JsonObject jsonObj) { if (jsonObj.Type != EJsonType.Object) throw new Exception("Must be an object"); foreach (JsonObject jo in jsonObj.NestedValues) { switch (jo.Name) { case nameof(text): text = jo.StringValue; break; case nameof(index): index = int.Parse(jo.StringValue); break; case nameof(logprobs): logprobs = jo.StringValue; break; case nameof(finish_reason): finish_reason = jo.StringValue; break; } } } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/ChoiceV1.cs.meta ================================================ fileFormatVersion: 2 guid: 03e638cb303909c4abbf7db3625a542b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/ClassificationV1.cs ================================================ using OpenAi.Json; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace OpenAi.Api.V1 { public class ClassificationV1 : AModelV1 { /// /// id of classification /// public string completion; /// /// label selected by classificaiton /// public string label; /// /// model used to perform classification /// public string model; /// /// The type of task performed by the completion, in this case classification /// public string obj; /// /// The search model applied to the classification. /// public string search_model; /// /// The examples provided to perform the completion with /// public SelectedExampleV1[] selected_examples; /// public override void FromJson(JsonObject json) { foreach (JsonObject jo in json.NestedValues) { switch (jo.Name) { case nameof(completion): completion = jo.StringValue; break; case nameof(label): label = jo.StringValue; break; case nameof(model): model = jo.StringValue; break; case "object": obj = jo.StringValue; break; case nameof(search_model): search_model = jo.StringValue; break; case nameof(selected_examples): selected_examples = ArrayFromJson(jo); break; } } } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(completion), completion); jb.Add(nameof(label), label); jb.Add(nameof(model), model); jb.Add("object", obj); jb.Add(nameof(search_model), search_model); jb.AddArray(nameof(selected_examples), selected_examples); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/ClassificationV1.cs.meta ================================================ fileFormatVersion: 2 guid: 502995a34cdbdce4491a77c0acaa9461 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/CompletionV1.cs ================================================ using OpenAi.Json; using System; using System.Text; namespace OpenAi.Api.V1 { /// /// The response to completion request /// public class CompletionV1 : AModelV1 { /// /// the id of the competion /// public string id; /// /// The object type (text_completion) /// public string obj; /// /// The created time as Unix epoch /// public int created; /// /// The model used to create the completion /// public string model; /// /// The choices returned by the completion /// public ChoiceV1[] choices; /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(id), id); jb.Add("object", obj); jb.Add(nameof(created), created); jb.Add(nameof(model), model); jb.AddArray(nameof(choices), choices); jb.EndObject(); return jb.ToString(); } /// public override void FromJson(JsonObject jsonObj) { if (jsonObj.Type != EJsonType.Object) throw new Exception("Must be an object"); foreach(JsonObject jo in jsonObj.NestedValues) { switch (jo.Name) { case nameof(id): id = jo.StringValue; break; case "object": obj = jo.StringValue; break; case nameof(created): created = int.Parse(jo.StringValue); break; case nameof(model): model = jo.StringValue; break; case nameof(choices): ChoiceV1[] choiceArray = new ChoiceV1[jo.NestedValues.Count]; for(int i = 0; i /// A partial message returned from the OpenAi Api chat completion endpoint /// public class DeltaV1 : AModelV1 { /// /// the message object role /// public MessageV1.MessageRole? role; /// /// the content of the message /// public string content; /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); if (role != null) jb.Add(nameof(role), role.ToString()); jb.Add(nameof(content), content); jb.EndObject(); return jb.ToString(); } /// public override void FromJson(JsonObject jsonObj) { if (jsonObj.Type != EJsonType.Object) throw new Exception("Must be an object"); foreach (JsonObject jo in jsonObj.NestedValues) { switch (jo.Name) { case nameof(role): role = (MessageV1.MessageRole?)Enum.Parse(typeof(MessageV1.MessageRole), jo.StringValue); break; case nameof(content): content = jo.StringValue; break; default: Debug.LogWarning("DeltaV1: missing field " + jo.Name); break; } } } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/DeltaV1.cs.meta ================================================ fileFormatVersion: 2 guid: 8c653c686b46c594aa1cdf39c1342a4e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/EngineV1.cs ================================================ using OpenAi.Json; namespace OpenAi.Api.V1 { /// /// Info about an engine. /// public class EngineV1 : AModelV1 { /// /// Engine id /// public string id; /// /// object type ("engine") /// public string obj; /// /// Owner of the engine /// public string owner; /// /// Is the engine ready? Not clear what this means /// public bool? ready; /// public override void FromJson(JsonObject json) { foreach(JsonObject jo in json.NestedValues) { switch (jo.Name) { case "id": id = jo.StringValue; break; case "object": obj = jo.StringValue; break; case "owner": owner = jo.StringValue; break; case "ready": ready = bool.Parse(jo.StringValue); break; } } } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(id), id); jb.Add("object", obj); jb.Add(nameof(owner), owner); jb.Add(nameof(ready), ready); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/EngineV1.cs.meta ================================================ fileFormatVersion: 2 guid: e29977a3db79cb946aa620129154da46 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/EnginesListV1.cs ================================================ using OpenAi.Json; namespace OpenAi.Api.V1 { /// /// A list of engines. /// public class EnginesListV1 : AModelV1 { /// /// The list of engines /// public EngineV1[] data; /// /// The obj type (list) /// public string obj; /// public override void FromJson(JsonObject json) { foreach (JsonObject jo in json.NestedValues) { switch (jo.Name) { case "object": obj = jo.StringValue; break; case "data": data = ArrayFromJson(jo); break; } } } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.AddArray(nameof(data), data); jb.Add("object", obj); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/EnginesListV1.cs.meta ================================================ fileFormatVersion: 2 guid: 77f46c211a2e79f45aa478f113b8066c MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/FileV1.cs ================================================ using OpenAi.Json; namespace OpenAi.Api.V1 { /// /// Info about a file. /// public class FileV1 : AModelV1 { /// /// Engine id /// public string id; /// /// object type ("engine") /// public string obj; /// /// the byte size of the file /// public int? bytes; /// /// The unix epoch the file was created at /// public int? created_at; /// /// The name of the file /// public string filename; /// /// The use case the the file is ued for /// public string purpose; /// public override void FromJson(JsonObject json) { foreach(JsonObject jo in json.NestedValues) { switch (jo.Name) { case nameof(id): id = jo.StringValue; break; case "object": obj = jo.StringValue; break; case nameof(bytes): bytes = int.Parse(jo.StringValue); break; case nameof(created_at): created_at = int.Parse(jo.StringValue); break; case nameof(filename): filename = jo.StringValue; break; case nameof(purpose): purpose = jo.StringValue; break; } } } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(id), id); jb.Add("object", obj); jb.Add(nameof(bytes), bytes); jb.Add(nameof(created_at), created_at); jb.Add(nameof(filename), filename); jb.Add(nameof(purpose), purpose); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/FileV1.cs.meta ================================================ fileFormatVersion: 2 guid: ca8c4f867680cbf4c87ce8e9e34fb9e2 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/FilesListV1.cs ================================================ using OpenAi.Json; namespace OpenAi.Api.V1 { /// /// A list of files. /// public class FilesListV1 : AModelV1 { /// /// The list of engines /// public FileV1[] data; /// /// The obj type (list) /// public string obj; /// public override void FromJson(JsonObject json) { foreach (JsonObject jo in json.NestedValues) { switch (jo.Name) { case "object": obj = jo.StringValue; break; case "data": data = ArrayFromJson(jo); break; } } } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.AddArray(nameof(data), data); jb.Add("object", obj); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/FilesListV1.cs.meta ================================================ fileFormatVersion: 2 guid: 2853cf33389674b43892960fb673f210 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/LabeledExampleV1.cs ================================================ using OpenAi.Json; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace OpenAi.Api.V1 { /// /// /// public class LabeledExampleV1 : AModelV1 { /// /// The example that you are performing a search on /// public string example; /// /// The label that is used when trying to classify a prompt against an example /// public string label; public LabeledExampleV1(string example, string label) { this.example = example == null ? "" : example; this.label = label == null ? "" : label; } public LabeledExampleV1() { } /// public override void FromJson(JsonObject json) { if (json.NestedValues.Count != 2) throw new OpenAiJsonException($"Received badly formated LabeledExampleV1 array"); example = json.NestedValues[0].StringValue; label = json.NestedValues[1].StringValue; } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.AddArray(new string[] { example, label }); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/LabeledExampleV1.cs.meta ================================================ fileFormatVersion: 2 guid: 49d8145284aa67f4aac19f1dfac484de MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/MessageV1.cs ================================================ using OpenAi.Json; using System; using UnityEngine; namespace OpenAi.Api.V1 { /// /// A single message passed to the OpenAi Api chat completion endpoint /// [System.Serializable] public class MessageV1 : AModelV1 { public enum MessageRole { system, user, assistant }; /// /// the message object role /// public MessageRole role; /// /// the content of the message /// public string content; /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(role), role.ToString()); jb.Add(nameof(content), content); jb.EndObject(); return jb.ToString(); } /// public override void FromJson(JsonObject jsonObj) { if (jsonObj.Type != EJsonType.Object) throw new Exception("Must be an object"); foreach (JsonObject jo in jsonObj.NestedValues) { switch (jo.Name) { case nameof(role): role = (MessageRole)Enum.Parse(typeof(MessageRole), jo.StringValue); break; case nameof(content): content = jo.StringValue; break; default: Debug.LogWarning("MessageV1: missing field " + jo.Name); break; } } } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/MessageV1.cs.meta ================================================ fileFormatVersion: 2 guid: 11813a2397ca53e4eb3115f2e5075e0c MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/QuestionAnswerPairV1.cs ================================================ using OpenAi.Json; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace OpenAi.Api.V1 { /// /// /// public class QuestionAnswerPairV1 : AModelV1 { /// /// The example that you are performing a search on /// public string question; /// /// The label that is used when trying to classify a prompt against an example /// public string answer; public QuestionAnswerPairV1(string question, string answer) { this.question = question == null ? "" : question; this.answer = answer == null ? "" : answer; } public QuestionAnswerPairV1() { } /// public override void FromJson(JsonObject json) { if (json.NestedValues.Count != 2) throw new OpenAiJsonException($"Received badly formated {nameof(QuestionAnswerPairV1)} array"); question = json.NestedValues[0].StringValue; answer = json.NestedValues[1].StringValue; } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.AddArray(new string[] { question, answer }); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/QuestionAnswerPairV1.cs.meta ================================================ fileFormatVersion: 2 guid: 3dbccebdcdfac4d4abab6bc2f80a310e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/SearchListV1.cs ================================================ using OpenAi.Json; namespace OpenAi.Api.V1 { /// /// A list of searchs to perform in a OpenAi Api search query /// public class SearchListV1 : AModelV1 { /// /// The array of searches to perform /// public SearchV1[] data; /// /// The object type /// public string obj; /// public override void FromJson(JsonObject json) { foreach(JsonObject jb in json.NestedValues) { switch (jb.Name) { case nameof(data): data = new SearchV1[jb.NestedValues.Count]; for(int i = 0; i public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.AddArray(nameof(data), data); jb.Add("object", obj); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/SearchListV1.cs.meta ================================================ fileFormatVersion: 2 guid: 953c9222a9a017f4187ac9b5d970ca91 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/SearchV1.cs ================================================ using OpenAi.Json; namespace OpenAi.Api.V1 { /// /// A returned value from a GPT-3 search. /// public class SearchV1 : AModelV1 { /// /// The document searched /// public int document; /// /// The object type /// public string obj; /// /// The score attributed to the document /// public float score; /// public override void FromJson(JsonObject json) { foreach(JsonObject jo in json.NestedValues) { switch (jo.Name) { case nameof(document): document = int.Parse(jo.StringValue); break; case "object": obj = jo.StringValue; break; case nameof(score): score = float.Parse(jo.StringValue); break; } } } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(document), document); jb.Add("object", obj); jb.Add(nameof(score), score); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/SearchV1.cs.meta ================================================ fileFormatVersion: 2 guid: 5fe551b9c0b56c7498f23211afe62bd3 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/SelectedDocumentV1.cs ================================================ using OpenAi.Json; namespace OpenAi.Api.V1 { /// /// /// public class SelectedDocumentV1 : AModelV1 { /// /// The document the label is associated to /// public string document; /// /// The text assoicated with the document /// public string text; /// public override void FromJson(JsonObject json) { foreach (JsonObject jo in json.NestedValues) { switch (jo.Name) { case nameof(document): document = jo.StringValue; break; case nameof(text): text = jo.StringValue; break; } } } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(document), document); jb.Add(nameof(text), text); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/SelectedDocumentV1.cs.meta ================================================ fileFormatVersion: 2 guid: 47a4d2e28ecb6e44d9eeb5245fa92067 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/SelectedExampleV1.cs ================================================ using OpenAi.Json; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace OpenAi.Api.V1 { /// /// /// public class SelectedExampleV1 : AModelV1 { /// /// The document the label is associated to /// public string document; /// /// The label that is used when trying to classify a prompt against an example /// public string label; /// /// The example that you are performing a search on /// public string example; /// public override void FromJson(JsonObject json) { foreach (JsonObject jo in json.NestedValues) { switch (jo.Name) { case nameof(document): document = jo.StringValue; break; case nameof(label): label = jo.StringValue; break; case nameof(example): example = jo.StringValue; break; } } } /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(document), document); jb.Add(nameof(label), label); jb.Add(nameof(example), example); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/SelectedExampleV1.cs.meta ================================================ fileFormatVersion: 2 guid: e62fcf537ca59d941b63d2e1d78888b6 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models/UsageV1.cs ================================================ using OpenAi.Json; using System; using UnityEngine; namespace OpenAi.Api.V1 { /// /// Part of completion response, count of i/o tokens /// [Serializable] public class UsageV1 : AModelV1 { /// /// Prompt (input) token count /// public int prompt_tokens; /// /// Completion (output) token count /// public int completion_tokens; /// /// Total (i/o) token count /// public int total_tokens; /// public override string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(prompt_tokens), prompt_tokens); jb.Add(nameof(completion_tokens), completion_tokens); jb.Add(nameof(total_tokens), total_tokens); jb.EndObject(); return jb.ToString(); } /// public override void FromJson(JsonObject jsonObj) { if (jsonObj.Type != EJsonType.Object) throw new Exception("Must be an object"); foreach (JsonObject jo in jsonObj.NestedValues) { switch (jo.Name) { case nameof(prompt_tokens): prompt_tokens = int.Parse(jo.StringValue); break; case nameof(completion_tokens): completion_tokens = int.Parse(jo.StringValue); break; case nameof(total_tokens): total_tokens = int.Parse(jo.StringValue); break; default: Debug.LogWarning("UsageV1: missing field " + jo.Name); break; } } } public static implicit operator UsageV1(JsonObject v) { throw new NotImplementedException(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/Models/UsageV1.cs.meta ================================================ fileFormatVersion: 2 guid: 0c7eec027c8b1ef48a93712348658aa3 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/Models.meta ================================================ fileFormatVersion: 2 guid: 496e72bb847530346a4d6c7029c62ecf folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/OpenAiApiV1.cs ================================================ using System.Text; using UnityEngine.Networking; namespace OpenAi.Api.V1 { /// /// Entry point for all api calls to the OpenAi Api. Read the docs at . /// Api calls are managed using resource objects, which contain various calls that can be performed on that resource. /// For example, is the documentation for the list engines /// api call. This is a GET request at https://api.openai.com/v1/engines. To make this call with the object, /// the syntax is OpenAiApiV1.Engines.List() /// public class OpenAiApiV1 : IApiResource { private SAuthArgsV1 _authArgs; /// public IApiResource ParentResource => null; /// public string Endpoint => "https://api.openai.com/v1"; /// public string Url => Endpoint; /// /// The Engines resources. /// public EnginesResourceV1 Engines { get; private set; } /// /// The Files resources. /// public FilesResourceV1 Files { get; private set; } /// /// Chat resource. /// public ChatResourceV1 Chat { get; set; } /// /// Construct an with the provided auth args. /// /// public OpenAiApiV1(SAuthArgsV1 authArgs) { _authArgs = authArgs; Engines = new EnginesResourceV1(this); Files = new FilesResourceV1(this); Chat = new ChatResourceV1(this); } /// public void ConstructEndpoint(StringBuilder sb) { sb.Append(Endpoint); } /// public void PopulateAuthHeaders(UnityWebRequest client) { client.SetRequestHeader("Authorization", $"Bearer {_authArgs.private_api_key}"); client.SetRequestHeader("User-Agent", $"hexthedev/openai_api_unity"); if (!string.IsNullOrEmpty(_authArgs.organization)) client.SetRequestHeader("OpenAI-Organization", _authArgs.organization); } } } ================================================ FILE: Runtime/Scripts/Api/V1/OpenAiApiV1.cs.meta ================================================ fileFormatVersion: 2 guid: b606a2a29008a6b4bb1e2cd1001ee7ab MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/SAuthArgsV1.cs ================================================ using OpenAi.Json; using System; namespace OpenAi.Api.V1 { /// /// Authentication arguments used to authenticate each api call to OpenAI /// public struct SAuthArgsV1 : IJsonable { /// /// The private api key found at /// public string private_api_key; /// /// The organization id, used by individuals in multiple organizations to determine the quota to use /// public string organization; /// public void FromJson(JsonObject jsonObj) { if (jsonObj.Type != EJsonType.Object) throw new Exception("Must be an object"); foreach (JsonObject jo in jsonObj.NestedValues) { switch (jo.Name) { case nameof(private_api_key): private_api_key = jo.StringValue; break; case nameof(organization): organization = jo.StringValue; break; } } } /// public string ToJson() { JsonBuilder jb = new JsonBuilder(); jb.StartObject(); jb.Add(nameof(private_api_key), private_api_key); jb.Add(nameof(organization), organization); jb.EndObject(); return jb.ToString(); } } } ================================================ FILE: Runtime/Scripts/Api/V1/SAuthArgsV1.cs.meta ================================================ fileFormatVersion: 2 guid: c8f356b234ec21848a6894a17a7c7ee6 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Api/V1/_abstract/AModelV1.cs ================================================ using OpenAi.Json; namespace OpenAi.Api.V1 { /// /// A model that can be converted from json and populated from json /// public abstract class AModelV1 : IJsonable { /// public abstract void FromJson(JsonObject json); /// public abstract string ToJson(); public static T[] ArrayFromJson(JsonObject parent) where T : AModelV1, new() { T[] newArray = new T[parent.NestedValues.Count]; for(int i = 0; i Output.text = s, e => Output.text = $"ERROR: StatusCode: {e.responseCode} - {e.error}" ); } public void DoAddToDialogue() { Api.V1.MessageV1 message = new Api.V1.MessageV1(); message.role = (Api.V1.MessageV1.MessageRole)System.Enum.Parse( typeof(Api.V1.MessageV1.MessageRole), role.options[role.value].text); message.content = Input.text; OpenAiChatCompleterV1.Instance.dialogue.Add(message); } public void QuitApp() { Application.Quit(); } } } ================================================ FILE: Runtime/Scripts/Examples/ExampleChatRuntime.cs.meta ================================================ fileFormatVersion: 2 guid: ac671c01496633846acf376026fb4b26 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Examples/ExampleOpenAiApiRuntime.cs ================================================ using UnityEngine; using UnityEngine.UI; using OpenAi.Unity.V1; namespace OpenAi.Examples { public class ExampleOpenAiApiRuntime : MonoBehaviour { public InputField Input; public Text Output; public void DoApiCompletion() { string text = Input.text; if (string.IsNullOrEmpty(text)) { Debug.LogError("Example requires input in input field"); return; } Debug.Log("Performing Completion in Play Mode"); Output.text = "Perform Completion..."; OpenAiCompleterV1.Instance.Complete( text, s => Output.text = s, e => Output.text = $"ERROR: StatusCode: {e.responseCode} - {e.error}" ); } public void QuitApp() { Application.Quit(); } } } ================================================ FILE: Runtime/Scripts/Examples/ExampleOpenAiApiRuntime.cs.meta ================================================ fileFormatVersion: 2 guid: 0dffa08172edd254b9cd939b09f211a0 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Examples.meta ================================================ fileFormatVersion: 2 guid: 4f80f38abc299c1468fcc611b81d4486 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/JsonDeserializer.cs ================================================ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace OpenAi.Json { public static class JsonDeserializer { public static JsonObject FromJson(string json) { string[] tokens = JsonLexer.Lex(json); return JsonSyntaxAnalyzer.Parse(tokens); } } } ================================================ FILE: Runtime/Scripts/Json/Deserialization/JsonDeserializer.cs.meta ================================================ fileFormatVersion: 2 guid: b184cce1b528b70498079c2e1e689726 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/JsonObject.cs ================================================ using System.Collections.Generic; namespace OpenAi.Json { public class JsonObject { public EJsonType Type; public string Name; public string StringValue; public List NestedValues; } } ================================================ FILE: Runtime/Scripts/Json/Deserialization/JsonObject.cs.meta ================================================ fileFormatVersion: 2 guid: 2b80d53d968a1c74a8981b8b27a04a60 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/LexicalAnalysis/CharacterAnalyzer/BaseAnalyzer.cs ================================================ namespace OpenAi.Json { /// /// Basic character analyzer used during lexical analysis of json strings /// public class BaseAnalyzer : ICharacterAnalyzer { private StringAnalyzer stringAnalyzer = new StringAnalyzer(); /// /// Categorizes characters in a json string, assuming they are now between "", and are /// not a json string literal /// /// Character to analyze /// returns if character is a " /// Analysis of character public ECharacterAnalyzerResponse Analyze(char c, out ICharacterAnalyzer engage) { engage = null; if (char.IsWhiteSpace(c)) return ECharacterAnalyzerResponse.ExcludeCharacter; if( c == '{' || c == '}' || c == '[' || c == ']' || c == ',' || c == ':') // Add ':' as a Token to correctly process numerical values in JSON { return ECharacterAnalyzerResponse.Token; } if (c == '"') { engage = stringAnalyzer; return ECharacterAnalyzerResponse.EngageCharacter; } return ECharacterAnalyzerResponse.IncludeCharacter; } } } ================================================ FILE: Runtime/Scripts/Json/Deserialization/LexicalAnalysis/CharacterAnalyzer/BaseAnalyzer.cs.meta ================================================ fileFormatVersion: 2 guid: 0c94ce4a5b7e273458068ae001f78c46 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/LexicalAnalysis/CharacterAnalyzer/ECharacterAnalyzerResponse.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OpenAi.Json { /// /// Possible character analysis results that can occur during deserailization /// public enum ECharacterAnalyzerResponse { /// /// This character alone is a token and should be added directly /// Token, /// /// This character should be included in a token that is being generated /// IncludeCharacter, /// /// Using \ as anchor, include escape character by skipping next character /// IncludeEscapeCharacter, /// /// This character should be excluded from token generation /// ExcludeCharacter, /// /// This character requires the engament of another analyzer, provided in out ICharacterAnalyzer /// EngageCharacter, /// /// This characher requires the release of the current analyzer and reversion to the last used analyzer /// ReleaseCharacter } } ================================================ FILE: Runtime/Scripts/Json/Deserialization/LexicalAnalysis/CharacterAnalyzer/ECharacterAnalyzerResponse.cs.meta ================================================ fileFormatVersion: 2 guid: cc2e08b043caa8f42b8698386306da36 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/LexicalAnalysis/CharacterAnalyzer/ICharacterAnalyzer.cs ================================================ namespace OpenAi.Json { /// /// Capable of analyzing a single character for the purpose of deserialization /// public interface ICharacterAnalyzer { /// /// Analyzes a character and returns result based on the type of character it is. /// /// The character to analyze /// The new character analyzer to engage, if the character represents the start of a unique section /// ECharacterAnalyzerResponse Analyze(char c, out ICharacterAnalyzer engage); } } ================================================ FILE: Runtime/Scripts/Json/Deserialization/LexicalAnalysis/CharacterAnalyzer/ICharacterAnalyzer.cs.meta ================================================ fileFormatVersion: 2 guid: 2b2a280e741cd7045a2351bd56b3222e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/LexicalAnalysis/CharacterAnalyzer/StringAnalyzer.cs ================================================ namespace OpenAi.Json { /// /// Analyzes characters that are between " " in a json string. /// public class StringAnalyzer : ICharacterAnalyzer { /// /// Analyzes characters that are between " " in a json string. /// /// Character is analyze /// Never used /// Analysis of character public ECharacterAnalyzerResponse Analyze(char c, out ICharacterAnalyzer engage) { engage = null; if (c == '"') return ECharacterAnalyzerResponse.ReleaseCharacter; if (c == '\\') return ECharacterAnalyzerResponse.IncludeEscapeCharacter; return ECharacterAnalyzerResponse.IncludeCharacter; } } } ================================================ FILE: Runtime/Scripts/Json/Deserialization/LexicalAnalysis/CharacterAnalyzer/StringAnalyzer.cs.meta ================================================ fileFormatVersion: 2 guid: 3f4c1da055f011440928de92a8009ac8 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/LexicalAnalysis/CharacterAnalyzer.meta ================================================ fileFormatVersion: 2 guid: 02d8c26e86046ce48b1ba09aabeca34e folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/LexicalAnalysis/JsonLexer.cs ================================================ using System.Collections.Generic; using System.Text; namespace OpenAi.Json { /// /// Simple single pass lexical analysis of a JSON string /// public static class JsonLexer { /// /// Preforms a lexical analysis of a JSON string and returns an array of tokens. /// /// json string to analyze /// array of tokens public static string[] Lex(string json) { StringBuilder sb = new StringBuilder(); bool generatingToken = false; Stack analyzer = new Stack(); analyzer.Push(new BaseAnalyzer()); List tokens = new List(); // Analyzes each character in the string based on the currently set analyzer. // Based on analysis adds tokens to the tokens list. for (int i = 0; i /// Types of objects in json /// public enum EJsonType { /// /// Simple value type. It may or may not have a key /// Value, /// /// An object, or many "key":"values" /// Object, /// /// A list of indexed values /// List } } ================================================ FILE: Runtime/Scripts/Json/Deserialization/SyntacticAnalysis/EJsonType.cs.meta ================================================ fileFormatVersion: 2 guid: b68cf8be6cf32ad4db5f6e93f25b0b6b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/SyntacticAnalysis/JsonSyntaxAnalyzer.cs ================================================ using System; using System.Collections.Generic; namespace OpenAi.Json { /// /// Parses arrays of json tokens and outputs /// public static class JsonSyntaxAnalyzer { /// /// Parse an array of json tokens /// /// array of tokens /// representation of deserialized object public static JsonObject Parse(string[] syntax) { if (syntax == null || syntax.Length < 2) throw new OpenAiJsonException("Failed to parse syntax. Either null, or length < 2"); JsonObject obj = new JsonObject(); switch (syntax[0]) { case "{": obj.Type = EJsonType.Object; ParseObject(obj, syntax, 1); return obj; case "[": obj.Type = EJsonType.List; ParseList(obj, syntax, 1); return obj; } throw new OpenAiJsonException("Failed to parse. Unknown error"); } private static int ParseObject(JsonObject parent, string[] syntax, int index) { // Handle empty object, i.e.: object: {} if (syntax[index] == "}") { parent.NestedValues = new List(); return index + 1; } int i = index; for (; i(); parent.NestedValues.Add(val); switch (syntax[index + 2]) { case "{": val.Type = EJsonType.Object; return ParseObject(val, syntax, index + 3); case "[": val.Type = EJsonType.List; return ParseList(val, syntax, index + 3); } val.Type = EJsonType.Value; val.StringValue = syntax[index + 2]; return index + 3; } public static int ParseListValue(JsonObject parent, string[] syntax, int index) { // Validate JsonObject val = new JsonObject(); if (parent.NestedValues == null) parent.NestedValues = new List(); parent.NestedValues.Add(val); switch (syntax[index]) { case "{": val.Type = EJsonType.Object; return ParseObject(val, syntax, index + 1); case "[": val.Type = EJsonType.List; return ParseList(val, syntax, index + 1); } val.Type = EJsonType.Value; val.StringValue = syntax[index]; return index + 1; } } } ================================================ FILE: Runtime/Scripts/Json/Deserialization/SyntacticAnalysis/JsonSyntaxAnalyzer.cs.meta ================================================ fileFormatVersion: 2 guid: b9500b3287886e4448a4acf15cc5ae51 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/SyntacticAnalysis.meta ================================================ fileFormatVersion: 2 guid: 8383419f9ce52d7409b7908c9a889726 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization/UTJsonDeserialization.cs ================================================ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace OpenAi.Json { public static class UTJsonDeserialization { public static string[] AsStringArray(this JsonObject json) { if (json.Type == EJsonType.List) { List extract = new List(); foreach (JsonObject obj in json.NestedValues) { extract.Add(obj.StringValue); } return extract.ToArray(); } else { throw new OpenAiJsonException($"Attempted to deserialize json to string[] but json object type is not a list. JSON: {json.StringValue}"); } return null; } } } ================================================ FILE: Runtime/Scripts/Json/Deserialization/UTJsonDeserialization.cs.meta ================================================ fileFormatVersion: 2 guid: 85df79bde77a85b4185c17570a217d7a MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Deserialization.meta ================================================ fileFormatVersion: 2 guid: e55a05d8360bf9347b1c2d8b84b67fe4 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/IJsonable.cs ================================================ namespace OpenAi.Json { /// /// Can be converted to and from json /// public interface IJsonable { /// /// Convert the object to json format /// /// Object in json format string string ToJson(); /// /// Update the objects values based on JsonObject /// /// JsonObject representing object instance void FromJson(JsonObject json); } } ================================================ FILE: Runtime/Scripts/Json/IJsonable.cs.meta ================================================ fileFormatVersion: 2 guid: 8a8e961569596a041a625bc8e5b76c5c MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/OpenAiJsonException.cs ================================================ using System; using UnityEngine; namespace OpenAi.Json { /// /// Exception thrown during json deserailization or serialization in the OpenAi Api Unity library /// public class OpenAiJsonException : Exception { /// /// Constrct with message and inner exception /// /// Message to show /// Inner exception public OpenAiJsonException(string message, Exception innerException = null) : base(message, innerException) { } /// /// Print to Unity Log as errors /// public void LogAsError() { Debug.LogError($"OpenAi Json Error: {Message}"); } } } ================================================ FILE: Runtime/Scripts/Json/OpenAiJsonException.cs.meta ================================================ fileFormatVersion: 2 guid: 3950378f7c31a764186e6c15c62014fb MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Json/Serialization/JsonBuilder.cs ================================================ using OpenAi.Api.V1; using System; using System.Collections.Generic; using System.Globalization; using System.Text; namespace OpenAi.Json { /// /// A bare-minimum Json string creation class geared towards creating JSON strings in the OpenAi Api. /// public class JsonBuilder { private StringBuilder _sb = new StringBuilder(); private bool _shouldAddComma = false; private string _prefix => _shouldAddComma ? "," : ""; /// /// Construct builder /// public JsonBuilder() { } /// /// Start object by adding { /// public void StartObject() => _sb.Append("{"); /// /// Start object by adding } /// public void EndObject() => _sb.Append("}"); /// /// Start list by adding [ /// public void StartList() => _sb.Append("["); /// /// Start list by adding ] /// public void EndList() => _sb.Append("]"); /// /// If not null, add int to json /// /// /// public void Add(string name, int? val) => AddSimpleObject(name, val); /// /// If not null, add float to json /// public void Add(string name, float? val) { if (val != null) { float value = (float)val; _sb.Append($"{_prefix}\"{name}\":{value.ToString(CultureInfo.InvariantCulture)}"); _shouldAddComma = true; } } /// /// if not null, add bool to json /// public void Add(string name, bool? val) { if (val != null) { string valString = val == true ? "true" : "false"; _sb.Append($"{_prefix}\"{name}\":{valString}"); _shouldAddComma = true; } } /// /// if not null, add string to json /// /// /// public void Add(string name, string val) { if (val != null) { _sb.Append($"{_prefix}\"{name}\":{GetJsonString(val)}"); _shouldAddComma = true; } } /// /// if not null, adds object to json by naively casting val to string /// /// /// public void AddSimpleObject(string name, object val) { if (val != null) { _sb.Append($"{_prefix}\"{name}\":{val}"); _shouldAddComma = true; } } /// /// if not null, adds to json /// /// /// public void Add(string name, StringOrArray val) { if(val != null) { object valActual = val.Resolve(); string valString = ""; switch (valActual) { case string s: valString = GetJsonString(s); break; case string[] a: //We send a list because we don't know how many non-null elements we have on the array List arr = new List(); for(int i = 0; i /// Adds a dictionary to json as a json object /// /// /// public void Add(string name, Dictionary dict) { if (dict == null) return; _sb.Append(_prefix); _sb.Append($"\"{name}\":"); StartObject(); bool isFirst = true; foreach(KeyValuePair kv in dict) { if (!isFirst) _sb.Append(","); _sb.Append($"\"{kv.Key}\":{kv.Value}"); if(isFirst) isFirst = false; } EndObject(); } /// /// Adds adds an array of objects as a json list /// /// /// /// public void AddArray(string name, T[] value) where T: IJsonable { if (value == null) return; _sb.Append(_prefix); _sb.Append($"\"{name}\":"); StartList(); string[] strings = new string[value.Length]; for(int i = 0; i /// Adds an array of strings as a json list /// /// /// public void AddArray(string name, string[] value) { if (value == null) return; _sb.Append(_prefix); _sb.Append($"\"{name}\":"); StartList(); string[] strings = new string[value.Length]; for (int i = 0; i < value.Length; i++) { strings[i] = GetJsonString(value[i]); } _sb.Append(string.Join(",", strings)); EndList(); _shouldAddComma = true; } /// /// Adds an array to the json without applying a name. This is used for nested arrays /// public void AddArray(string[] values) { StartList(); string[] strings = new string[values.Length]; for (int i = 0; i < values.Length; i++) { strings[i] = GetJsonString(values[i]); } _sb.Append(string.Join(",", strings)); EndList(); } /// /// Write JsonBuilder value as string /// /// public override string ToString() { return _sb.ToString(); } private string GetJsonString(string s) => $"\"{ProcessString(s)}\""; private string ProcessString(string json) { StringBuilder sb = new StringBuilder(); for(int i = 0; i /// Implementation of Singleton for that insures only a single instance /// of the exists in the scene, and that instance is not destroyed /// between scene loads /// /// The type of the subclass. public abstract class AMonoSingleton : MonoBehaviour where T : AMonoSingleton { private static T _instance; private static bool _instantiating = false; private static bool AppQuitting { get; set; } = false; /// /// Singleton instance /// public static T Instance { get { if (AppQuitting) { Debug.LogWarning($"No {nameof(AMonoSingleton)} returned because application is quiting"); return null; } TryCreateSingleton(_instance, ref _instance); return _instance; } } /// /// Tries to create a singleton. Succeeds if no instance has yet been created. Destroys any calling object that isn't the instance /// /// The instance calling the function /// A reference to the variable which holds the instance /// false if trying to create new instance public static bool TryCreateSingleton(T caller, ref T instanceVar) { // if no instance created, can create if (instanceVar == null) { // block used to catch other threads creating singleton if (_instantiating) { //Debug.LogWarning("Attempting to instantiate singleton, but _instantiation attempts indicate another thread is instantiating"); return false; } _instantiating = true; // Check if there is a gameobject in the scene using the monobehaviour. // If not make one instanceVar = FindObjectOfType(); if (instanceVar == null) { instanceVar = new GameObject(typeof(T).Name + "(AutoGenerated)").AddComponent(); } // Mark Singleton not to be destroyed between scenes. DontDestroyOnLoad only works for root level objects if (instanceVar.transform.parent != null) instanceVar.transform.SetParent(null); DontDestroyOnLoad(instanceVar.gameObject); return true; } else if (caller != instanceVar) { Destroy(caller); return false; } return true; } private void OnApplicationQuit() => AppQuitting = true; protected void Awake() => TryCreateSingleton((T)this, ref _instance); } } ================================================ FILE: Runtime/Scripts/Unity/Util/AMonoSingleton.cs.meta ================================================ fileFormatVersion: 2 guid: d0f4f33e525c60b4faf9b337ef8ac5b6 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/Util.meta ================================================ fileFormatVersion: 2 guid: ea6ea4c33a049da4b96aef452604005f folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1/Auth/SOAuthArgsV1.cs ================================================ using OpenAi.Api; using OpenAi.Api.V1; using OpenAi.Json; using System; using System.IO; using System.Text; using UnityEngine; namespace OpenAi.Unity.V1 { /// /// The Authentication arguments required to authenticate an OpenAI Api request. /// /// /// Projects pushed to public reposities should not use the String authentication type, as the private key will be exposed to the public. /// [CreateAssetMenu(fileName = "AuthArgsV1", menuName = "OpenAi/Unity/V1/AuthArgs")] public class SOAuthArgsV1 : ScriptableObject { /// /// The method by which the authentication and organization keys are supplied to the auth args. /// public EAuthProvisionMethod AuthType = EAuthProvisionMethod.LocalFile; /// /// The private key provided by OpenAi. You private api key can be found at if you have an account. /// public string PrivateApiKey; /// /// The organization id provided by OpenAi. This is optional. It is only required when a user belongs to multiple organizations and they want to specifiy the organization who's quota should be consumed. /// public string Organization; /// /// Based on the resolves and provides the instance /// /// public SAuthArgsV1 ResolveAuth() { switch (AuthType) { case EAuthProvisionMethod.LocalFile: return ResolveLocalFileAuthArgs(); case EAuthProvisionMethod.String: return new SAuthArgsV1() { private_api_key = PrivateApiKey, organization = Organization }; } throw new Exception("Failed to resolve AuthArgs"); } private SAuthArgsV1 ResolveLocalFileAuthArgs() { string userPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); string authPath = $"{userPath}/.openai/auth.json"; FileInfo fi = new FileInfo(authPath); if (!fi.Exists) throw new OpenAiApiException($"No authentication file exists at {authPath}", this); string json = null; using (FileStream fs = fi.OpenRead()) { byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, (int)fs.Length); json = Encoding.UTF8.GetString(buffer); } JsonObject des = JsonDeserializer.FromJson(json); SAuthArgsV1 authArgs = new SAuthArgsV1(); authArgs.FromJson(des); return authArgs; } /// /// Options for provisioning auth keys /// public enum EAuthProvisionMethod { /// /// The local file looks for a auth.json file located at `~/.openai/auth.json` (Linux/Mac) /// or `%USERPROFILE%/.openai/auth.json` (Windows) and extracts the key. /// LocalFile = 0, /// /// The secret is copied into a field of this scriptable object and used directly /// String = 1 } } } ================================================ FILE: Runtime/Scripts/Unity/V1/Auth/SOAuthArgsV1.cs.meta ================================================ fileFormatVersion: 2 guid: 82cfa4d983a7d91419ea8999b972a333 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1/Auth.meta ================================================ fileFormatVersion: 2 guid: 312fa3fc0c3c46b429ddafdc8fbadf33 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1/ChatCompleter/OpenAiChatCompleterV1.cs ================================================ using OpenAi.Api; using OpenAi.Api.V1; using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; namespace OpenAi.Unity.V1 { /// /// Automatically handles setting up OpenAiApi for chat completions. Exposes a simple method to allow users to perform completions /// public class OpenAiChatCompleterV1 : AMonoSingleton { OpenAiApiGatewayV1 _gateway = null; ChatCompletionsResourceV1 _model = null; /// /// The auth arguments used to authenticate the api. Should not be changed after initalization. Once the is initalized it must be cleared and initialized again if any changes are made to this property /// [Tooltip("Arguments used to authenticate the OpenAi Api")] public SOAuthArgsV1 Auth; /// /// Arguments used to configure the model when sending a chat completion /// [Tooltip("Arguments used to configure the chat completion")] public SOChatCompletionArgsV1 Args; /// /// The id of the model to use /// [Tooltip("The id of the model to use")] public EEngineName Model = EEngineName.gpt_35_turbo; /// /// Current model usage /// [Tooltip("Current model usage")] public UsageV1 Usage; /// /// The dialogue of chat messages, may be prepopulated /// [Tooltip("The dialogue of chat messages, may be prepopulated")] public List dialogue; public void Start() { _gateway = OpenAiApiGatewayV1.Instance; if (Auth == null) Auth = ScriptableObject.CreateInstance(); if (Args == null) Args = ScriptableObject.CreateInstance(); if (!_gateway.IsInitialized) { _gateway.Auth = Auth; _gateway.InitializeApi(); } _model = _gateway.Api.Chat.Completions; } public Coroutine Complete(string prompt, Action onResponse, Action onError) { MessageV1 message = new MessageV1(); message.role = MessageV1.MessageRole.user; message.content = prompt; dialogue.Add(message); return Complete(onResponse, onError); } public Coroutine Complete(Action onResponse, Action onError) { ChatCompletionRequestV1 request = Args == null ? new ChatCompletionRequestV1() : Args.AsChatCompletionRequest(); request.model = UTEChatModelName.GetModelName(Model); request.messages = dialogue; return _model.CreateChatCompletionCoroutine(this, request, (r) => HandleResponse(r, onResponse, onError)); } private void HandleResponse(ApiResult result, Action onResponse, Action onError) { if (result.IsSuccess) { foreach (ChatChoiceV1 choice in result.Result.choices) { dialogue.Add(choice.message); } Usage = result.Result.usage; onResponse(dialogue[dialogue.Count - 1].content); return; } else { onError(result.HttpResponse); return; } } } } ================================================ FILE: Runtime/Scripts/Unity/V1/ChatCompleter/OpenAiChatCompleterV1.cs.meta ================================================ fileFormatVersion: 2 guid: 582650b353200ef458d8ce61588f26dc MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: - _auth: {fileID: 11400000, guid: 6d0ce71886a13d44a9693a5e31c0a754, type: 2} executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1/ChatCompleter/SOChatCompletionArgsV1.cs ================================================ using OpenAi.Api; using OpenAi.Api.V1; using System.Collections.Generic; using UnityEngine; namespace OpenAi.Unity.V1 { /// /// Arguments used to create a chat completion with the /// [CreateAssetMenu(fileName = "ChatCompletionArgs", menuName = "OpenAi/Unity/V1/ChatCompletionArgs")] public class SOChatCompletionArgsV1 : ScriptableObject { [Tooltip("What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both. ")] public float temperature = 1; [Tooltip("An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. ")] public float top_p = 1; [Tooltip("How many chat completion choices to generate for each input message.")] public int n = 1; [Tooltip("If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. See the OpenAI Cookbook for example code.")] bool stream = false; [Tooltip("Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.")] public string[] stop = new string[4]; [Tooltip("The maximum number of tokens to generate in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length.")] public int max_tokens = 4097; [Tooltip("Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. ")] public float presence_penalty = 0; [Tooltip("Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.")] public float frequency_penalty = 0; [Tooltip("Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens(specified by their token ID in the GPT tokenizer) to an associated bias value from - 100 to 100.")] public Dictionary logit_bias = new Dictionary(); [Tooltip("A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.")] public string user = ""; public ChatCompletionRequestV1 AsChatCompletionRequest() { return new ChatCompletionRequestV1() { temperature = temperature, top_p = top_p, n = n, stream = stream, //stop = stop, max_tokens = max_tokens, presence_penalty = presence_penalty, frequency_penalty = frequency_penalty, // logit_bias = logit_bias, user = user }; } } } ================================================ FILE: Runtime/Scripts/Unity/V1/ChatCompleter/SOChatCompletionArgsV1.cs.meta ================================================ fileFormatVersion: 2 guid: 080e53b2b28b9684d819081e4e9b9de6 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1/ChatCompleter.meta ================================================ fileFormatVersion: 2 guid: 879144c005aec984c917ea92b9011d45 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1/Completer/OpenAiCompleterV1.cs ================================================ using OpenAi.Api; using OpenAi.Api.V1; using System; using UnityEngine; using UnityEngine.Networking; namespace OpenAi.Unity.V1 { /// /// Automatically handles setting up OpenAiApi for simple completions with 1 engine. Exposes a simple method to allow users to perform completions /// public class OpenAiCompleterV1 : AMonoSingleton { OpenAiApiGatewayV1 _gateway = null; EngineResourceV1 _engine = null; /// /// The auth arguments used to authenticate the api. Should not be changed after initalization. Once the is initalized it must be cleared and initialized again if any changes are made to this property /// [Tooltip("Arguments used to authenticate the OpenAi Api")] public SOAuthArgsV1 Auth; /// /// Arguments used to configure the engine when sending a completion /// [Tooltip("Arguments used to configure the completion")] public SOCompletionArgsV1 Args; /// /// The id of the engine to use /// [Tooltip("The id of the engine to use")] public EEngineName Engine = EEngineName.text_davinci_003; public void Start() { _gateway = OpenAiApiGatewayV1.Instance; if (Auth == null) Auth = ScriptableObject.CreateInstance(); if (Args == null) Args = ScriptableObject.CreateInstance(); if (!_gateway.IsInitialized) { _gateway.Auth = Auth; _gateway.InitializeApi(); } _engine = _gateway.Api.Engines.Engine(UTEEngineName.GetEngineName(Engine)); } public Coroutine Complete(string prompt, Action onResponse, Action onError) { CompletionRequestV1 request = Args == null ? new CompletionRequestV1() { max_tokens = 64 } : Args.AsCompletionRequest(); request.prompt = prompt; return _engine.Completions.CreateCompletionCoroutine(this, request, (r) => HandleResponse(r, onResponse, onError)); } private void HandleResponse(ApiResult result, Action onResponse, Action onError) { if (result.IsSuccess) { onResponse(result.Result.choices[0].text); return; } else { onError(result.HttpResponse); return; } } } } ================================================ FILE: Runtime/Scripts/Unity/V1/Completer/OpenAiCompleterV1.cs.meta ================================================ fileFormatVersion: 2 guid: 00b92053656ca0643ab0d4d86e1387fa MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: - _auth: {fileID: 11400000, guid: 6d0ce71886a13d44a9693a5e31c0a754, type: 2} executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1/Completer/SOCompletionArgsV1.cs ================================================ using OpenAi.Api.V1; using UnityEngine; namespace OpenAi.Unity.V1 { /// /// Arguments used to create a completion with the /// [CreateAssetMenu(fileName = "CompletionArgs", menuName = "OpenAi/Unity/V1/CompletionArgs")] public class SOCompletionArgsV1 : ScriptableObject { [Tooltip("The maximum number of tokens to generate. Requests can use up to 2048 tokens shared between prompt and completion. (One token is roughly 4 characters for normal English text)")] public int max_tokens = 32; [Tooltip("What sampling temperature to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or top_p but not both.")] public float temperature = 0.7f; [Tooltip("An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.")] public float top_p = 1; [Tooltip("Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.")] public string[] stop = new string[4]; [Tooltip("Number between 0 and 1 that penalizes new tokens based on whether they appear in the text so far. Increases the model's likelihood to talk about new topics. https://beta.openai.com/docs/api-reference/parameter-details/>")] public float presences_penalty = 0; [Tooltip("Number between 0 and 1 that penalizes new tokens based on their existing frequency in the text so far. Decreases the model's likelihood to repeat the same line verbatim. https://beta.openai.com/docs/api-reference/parameter-details")] public float frequency_penalty = 0; public CompletionRequestV1 AsCompletionRequest() { return new CompletionRequestV1() { max_tokens = max_tokens, temperature = temperature, top_p = top_p, stop = "\n", frequency_penalty = frequency_penalty }; } } } ================================================ FILE: Runtime/Scripts/Unity/V1/Completer/SOCompletionArgsV1.cs.meta ================================================ fileFormatVersion: 2 guid: 6fd689c40e44326488e8c75b58e63175 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1/Completer.meta ================================================ fileFormatVersion: 2 guid: 00b5ae1736e255341bc2b895c60c32e1 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1/Gateway/OpenAiApiGatewayV1.cs ================================================ using OpenAi.Api.V1; using UnityEngine; namespace OpenAi.Unity.V1 { /// /// A singleton that handles the inialization of an OpenAiApiV1 object and provides access to it. For the to function /// it needs to be initalized. /// public class OpenAiApiGatewayV1 : AMonoSingleton { /// /// If true, calls in /// [Tooltip("If true, initalizes the api in Start. Otherwise requires initalization programmatically")] public bool InitializeOnStart = false; /// /// The auth arguments used to authenticate the api. Should not be changed after initalization. Once the is initalized it must be cleared and initialized again if any changes are made to this property /// [Tooltip("Arguments used to authenticate the OpenAi Api")] public SOAuthArgsV1 Auth; /// /// True if the has been initialized successfully and is ready for api calls to be made. /// public bool IsInitialized { get; private set; } = false; /// /// instance used the make api calls through internal resources. /// public OpenAiApiV1 Api { get; private set; } void Start() { if (InitializeOnStart) InitializeApi(); } /// /// Sets the by resolving /// public void InitializeApi() { if (Auth == null) { Debug.LogError("OpenAi API Error: OpenAi Api cannot be authenticated. No SOAuthArgs provided. API won't be created"); } else { Api = new OpenAiApiV1(Auth.ResolveAuth()); IsInitialized = true; } } /// /// Sets the to null and marks false /// public void ClearApi() { Api = null; IsInitialized = false; } } } ================================================ FILE: Runtime/Scripts/Unity/V1/Gateway/OpenAiApiGatewayV1.cs.meta ================================================ fileFormatVersion: 2 guid: 2368cfe602a61dc47b9fceb48ea4dae0 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: - _auth: {fileID: 11400000, guid: 6d0ce71886a13d44a9693a5e31c0a754, type: 2} executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1/Gateway.meta ================================================ fileFormatVersion: 2 guid: 600ea62b57028514eb38209ef14ee650 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity/V1.meta ================================================ fileFormatVersion: 2 guid: 848427f27c877f2408e2467479f7bc26 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts/Unity.meta ================================================ fileFormatVersion: 2 guid: bf1dcfeb373d2a54e81e8addb04cc917 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/Scripts.meta ================================================ fileFormatVersion: 2 guid: 44d4518f6fd7e54468095366e58d0ed9 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime/openai.api.unity.asmdef ================================================ { "name": "openai.api.unity" } ================================================ FILE: Runtime/openai.api.unity.asmdef.meta ================================================ fileFormatVersion: 2 guid: 762faf06f60fab647b9b71ae958fdf20 AssemblyDefinitionImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Runtime.meta ================================================ fileFormatVersion: 2 guid: d210dc3ddd702344694f0b1256df17b7 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Core/V1/Models/CompletionRequestModelTests.cs ================================================ using NUnit.Framework; namespace OpenAi.Api.V1.Test { class CompletionRequestModelTests { [Test] public void ToJsonBase() { CompletionRequestV1 crm = new CompletionRequestV1() { stop = new StringOrArray("\n", "a"), echo = true }; string json = crm.ToJson(); string expected = "{\"echo\":true,\"stop\":[\"\\n\",\"a\"]}"; Assert.That(json == expected); } } } ================================================ FILE: Tests/Editor/Scripts/Core/V1/Models/CompletionRequestModelTests.cs.meta ================================================ fileFormatVersion: 2 guid: b6656729fe18ae4469079fb03627cffd MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Core/V1/Models.meta ================================================ fileFormatVersion: 2 guid: 3b0c87db33cf8044882d2709761ac89f folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Core/V1.meta ================================================ fileFormatVersion: 2 guid: 501a01483ee15a643af8145511eca1b5 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Core.meta ================================================ fileFormatVersion: 2 guid: 3ba5e0cafa5d7e74f8465aab852e6a54 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Json/JsonDeserializerTests.cs ================================================ using NUnit.Framework; using OpenAi.Json; using UnityEngine.TestTools; namespace OpenAiApi { public class JsonDeserializerTests { [Test] public void DeserializeTestEmpty() { string json = "{}"; JsonObject obj = JsonDeserializer.FromJson(json); obj.AssertRootIsObject(); obj.NestedValues.AssertIsValidJsonObjectArray(0); } [Test] public void DeserializeTestBasic() { string json = "{\"key1\":\"val1\"}"; JsonObject obj = JsonDeserializer.FromJson(json); obj.AssertRootIsObject(); obj.NestedValues.AssertIsValidJsonObjectArray(1); obj.NestedValues[0].AssertValue("key1", "val1"); } [Test] public void DeserializeTestComplexe() { string json = "{\"key1\":\"val1\", \"key2\":\"val2\", \"list1\":[\"li1\n\", 67, 1.234], \"objt\" : { \"obj1\":\"ob1\", \"obj2\":\"ob2\", \"obj3\": [1, 1] }}"; JsonObject obj = JsonDeserializer.FromJson(json); Assert.IsNotNull(obj); //AssertValue(obj.NestedValue[0], "key1", "val1"); //AssertValue(obj.NestedValue[1], "key2", "val2"); //AssertList(obj.NestedValue[2], "list1", "li1\n", "67", "1.234"); JsonObject objt = obj.NestedValues[3]; Assert.That(objt.Type == EJsonType.Object); //AssertValue(objt.NestedValue[0], "obj1", "ob1"); //AssertValue(objt.NestedValue[1], "obj2", "ob2"); //AssertList(objt.NestedValue[2], "obj3", "1", "1"); } } } ================================================ FILE: Tests/Editor/Scripts/Json/JsonDeserializerTests.cs.meta ================================================ fileFormatVersion: 2 guid: 223bf5360d26a5e409c6c8ecc05c83a8 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Json/LexicalAnalysis/JsonLexerTests.cs ================================================ using NUnit.Framework; using OpenAi.Json; namespace OpenAiApi { public class JsonLexerTests { [Test] public void LexerTestSimpleObject() { string[] lex = JsonLexer.Lex("{\"key\":\"value\"}"); Assert.IsNotNull(lex); string[] expected = new string[] { "{", "key", ":", "value", "}" }; for (int i = 0; i < expected.Length; i++) Assert.That(lex[i] == expected[i]); } [Test] public void LexerTestSimpleList() { string[] lex = JsonLexer.Lex("[\"li1\",\"li2\"]"); Assert.IsNotNull(lex); string[] expected = new string[] { "[", "li1", ",", "li2", "]" }; for (int i = 0; i < expected.Length; i++) Assert.That(lex[i] == expected[i]); } [Test] public void LexerTestListOfObjects() { string[] lex = JsonLexer.Lex("[{\"key1\":\"val1\"},{\"key2\":\"val2\"}]"); Assert.IsNotNull(lex); string[] expected = new string[] { "[", "{", "key1", ":", "val1", "}", ",", "{", "key2", ":", "val2", "}", "]" }; for (int i = 0; i < expected.Length; i++) Assert.That(lex[i] == expected[i]); } [Test] public void LexerTestObjectWithListValue() { string[] lex = JsonLexer.Lex("{\"key1\":[\"li1\",\"li2\"]}"); Assert.IsNotNull(lex); string[] expected = new string[] { "{", "key1", ":", "[", "li1", ",", "li2", "]", "}" }; for (int i = 0; i < expected.Length; i++) Assert.That(lex[i] == expected[i]); } // A Test behaves as an ordinary method [Test] public void LexerTestOpenAiExample() { string[] lex = JsonLexer.Lex("{\"id\": \"cmpl - uqkvlQyYK7bGYrRHQ0eXlWi7\",\"object\": \"text_completion\", \"created\": 1589478378,\"model\": \"davinci:2020-05-03\",\"choices\": [{\"text\": \" there was a girl who\",\"index\": 0,\"logprobs\": null,\"finish_reason\": \"length\"}]} "); Assert.IsNotNull(lex); string[] expected = new string[] { "{", "id", ":", "cmpl - uqkvlQyYK7bGYrRHQ0eXlWi7", ",", "object", ":", "text_completion", ",", "created", ":", "1589478378", ",", "model", ":", "davinci:2020-05-03", ",", "choices", ":", "[", "{", "text", ":", " there was a girl who", ",", "index", ":", "0", ",", "logprobs", ":", "null", ",", "finish_reason", ":", "length", "}", "]", "}" }; for (int i = 0; i < expected.Length; i++) Assert.That(lex[i] == expected[i]); } } } ================================================ FILE: Tests/Editor/Scripts/Json/LexicalAnalysis/JsonLexerTests.cs.meta ================================================ fileFormatVersion: 2 guid: 1e8417b673afe434b9ddcf90a69adc80 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Json/LexicalAnalysis.meta ================================================ fileFormatVersion: 2 guid: 5c5edb816bdb80c4da0a30f99d889942 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Json/SyntacticAnalysis/JsonSyntaxAnalyzerTests.cs ================================================ using NUnit.Framework; using OpenAi.Json; using System.Collections.Generic; namespace OpenAiApi { class SyntaxAnalyzerTests { [Test] public void AnalyzeTestEmptyObject() { string[] syntax = new string[] { "{", "}" }; JsonObject obj = JsonSyntaxAnalyzer.Parse(syntax); obj.AssertRootIsObject(); obj.NestedValues.AssertIsValidJsonObjectArray(0); } [Test] public void AnalyzeTestSimpleObject() { string[] syntax = new string[] { "{", "key", ":", "value", "}" }; JsonObject obj = JsonSyntaxAnalyzer.Parse(syntax); obj.AssertRootIsObject(); obj.NestedValues.AssertIsValidJsonObjectArray(1); obj.NestedValues[0].AssertValue("key", "value"); } [Test] public void AnalyzeTestSimpleList() { string[] syntax = new string[] { "[", "li1", ",", "li2", "]" }; JsonObject obj = JsonSyntaxAnalyzer.Parse(syntax); obj.AssertRootIsList(); obj.AssertListWithSimpleValues(null, "li1", "li2"); } [Test] public void AnalyzeTestListOfObjects() { string[] syntax = new string[] { "[", "{", "key0", ":", "val0", "}", ",", "{", "key1", ":", "val1", "}", "]" }; JsonObject obj = JsonSyntaxAnalyzer.Parse(syntax); obj.AssertRootIsList(); obj.NestedValues.AssertIsValidJsonObjectArray(2); for(int i = 0; i<=1; i++) { // Test the object JsonObject listElement = obj.NestedValues[i]; listElement.AssertListElementIsObject(); listElement.NestedValues.AssertIsValidJsonObjectArray(1); // Test the objects inner key value pair JsonObject objectKeyValue = listElement.NestedValues[0]; objectKeyValue.AssertValue($"key{i}", $"val{i}"); } } [Test] public void AnalyzeTestWithListValue() { string[] syntax = new string[] { "{", "key1", ":", "[", "li1", ",", "li2", "]", "}" }; JsonObject obj = JsonSyntaxAnalyzer.Parse(syntax); obj.AssertRootIsObject(); obj.NestedValues.AssertIsValidJsonObjectArray(1); // Test the value with list JsonObject val = obj.NestedValues[0]; val.AssertListWithSimpleValues("key1", "li1", "li2"); } [Test] public void AnalyzeTestOpenAiExample() { string[] syntax = new string[] { "{", "id", ":", "cmpl - uqkvlQyYK7bGYrRHQ0eXlWi7", ",", "object", ":", "text_completion", ",", "created", ":", "1589478378", ",", "model", ":", "davinci:2020-05-03", ",", "choices", ":", "[", "{", "text", ":", " there was a girl who", ",", "index", ":", "0", ",", "logprobs", ":", "null", ",", "finish_reason", ":", "length", "}", "]", "}" }; JsonObject obj = JsonSyntaxAnalyzer.Parse(syntax); // Root obj.AssertRootIsObject(); obj.NestedValues.AssertIsValidJsonObjectArray(5); // First few values obj.NestedValues[0].AssertValue("id", "cmpl - uqkvlQyYK7bGYrRHQ0eXlWi7"); obj.NestedValues[1].AssertValue("object", "text_completion"); obj.NestedValues[2].AssertValue("created", "1589478378"); obj.NestedValues[3].AssertValue("model", "davinci:2020-05-03"); // Choices list object JsonObject list = obj.NestedValues[4]; list.AssertList(1); // The one choices object inside the list JsonObject choiceObject = list.NestedValues[0]; choiceObject.AssertListElementIsObject(); choiceObject.NestedValues.AssertIsValidJsonObjectArray(4); List choiceObjectKVs = choiceObject.NestedValues; choiceObjectKVs[0].AssertValue("text", " there was a girl who"); choiceObjectKVs[1].AssertValue("index", "0"); choiceObjectKVs[2].AssertValue("logprobs", "null"); choiceObjectKVs[3].AssertValue("finish_reason", "length"); } } } ================================================ FILE: Tests/Editor/Scripts/Json/SyntacticAnalysis/JsonSyntaxAnalyzerTests.cs.meta ================================================ fileFormatVersion: 2 guid: 5b9e21e2bfd24ae4380d3800e3af2738 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Json/SyntacticAnalysis.meta ================================================ fileFormatVersion: 2 guid: b2b410013ccbb7f469706eac37366419 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Json/UTJsonObjectTests.cs ================================================ using NUnit.Framework; using OpenAi.Json; using System.Collections.Generic; namespace OpenAiApi { public static class UTJsonObjectTests { /// /// Asserts that a JsonObject is the root, and is an object type /// /// public static void AssertRootIsObject(this JsonObject obj) { Assert.IsNotNull(obj); Assert.That(obj.Name == null); Assert.That(obj.Type == EJsonType.Object); } /// /// Asserts that a JsonObject is the root, and is a list type /// /// public static void AssertRootIsList(this JsonObject obj) { Assert.IsNotNull(obj); Assert.That(obj.Name == null); Assert.That(obj.Type == EJsonType.List); } /// /// Asserts that a JsonObject is a value, and verifies the name and val /// of the JsonObject /// /// /// /// /// public static void AssertValue(this JsonObject obj, string name, string val) { Assert.IsNotNull(obj); Assert.That(obj.Type == EJsonType.Value); Assert.That(obj.Name == name); Assert.That(obj.StringValue == val); } /// /// Asserts that the object is a list of a certain size, but does not check the element values /// /// /// /// /// public static void AssertList(this JsonObject obj, int count) { Assert.IsNotNull(obj); Assert.That(obj.Type == EJsonType.List); obj.NestedValues.AssertIsValidJsonObjectArray(count); } /// /// Asserts that a JsonObject is a list of values, and verifies the name of the object /// and the value of each list member /// /// /// /// /// public static void AssertListWithSimpleValues(this JsonObject obj, string name, params string[] vals) { Assert.IsNotNull(obj); Assert.That(obj.Type == EJsonType.List); Assert.That(obj.Name == name); for (int i = 0; i < obj.NestedValues.Count; i++) { Assert.IsNotNull(obj.NestedValues[i]); Assert.That(obj.NestedValues[i].Type == EJsonType.Value); Assert.That(vals[i] == obj.NestedValues[i].StringValue); } } /// /// Asserts that a JsonObject is an object that is in a list. This means the object has no name /// since it's a list value and has an index instead. /// /// /// /// /// public static void AssertListElementIsObject(this JsonObject obj) { Assert.IsNotNull(obj); Assert.That(obj.Type == EJsonType.Object); } /// /// Asserts that a JsonObject array is not null and of a certain size /// /// public static void AssertIsValidJsonObjectArray(this List objs, int count) { Assert.IsNotNull(objs); Assert.That(objs.Count == count); } } } ================================================ FILE: Tests/Editor/Scripts/Json/UTJsonObjectTests.cs.meta ================================================ fileFormatVersion: 2 guid: b7b5972f4d2ad7f4a95e57fdce251dd1 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts/Json.meta ================================================ fileFormatVersion: 2 guid: 50d1d1ceda820ca46a345407951b1cfc folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/Scripts.meta ================================================ fileFormatVersion: 2 guid: ff968cb2f1f71924eb57b584ce2568de folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor/openai.api.unity.editor.tests.asmdef ================================================ { "name": "openai.api.unity.editor.tests", "references": [ "UnityEngine.TestRunner", "UnityEditor.TestRunner", "openai.api.unity", "openai.api.unity.tests" ], "includePlatforms": [ "Editor" ], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": true, "precompiledReferences": [ "nunit.framework.dll" ], "autoReferenced": false, "defineConstraints": [ "UNITY_INCLUDE_TESTS" ], "versionDefines": [], "noEngineReferences": false } ================================================ FILE: Tests/Editor/openai.api.unity.editor.tests.asmdef.meta ================================================ fileFormatVersion: 2 guid: 5786b1a7a94f11943b8a6d85a558e577 AssemblyDefinitionImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Editor.meta ================================================ fileFormatVersion: 2 guid: 0e5915828fe8d7b45af787f69cd45855 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Runtime/Scripts/Core/V1/V1BugTests.cs ================================================ using NUnit.Framework; using OpenAi.Api.V1; using OpenAi.Unity.V1; using System.Collections; using UnityEngine; using UnityEngine.Networking; using UnityEngine.TestTools; namespace OpenAi.Api.Test { public class V1BugTests { private TestManager test; private OpenAiApiV1 api; [OneTimeSetUp] public void OneTimeSetup() => test = TestManager.Instance; [SetUp] public void SetUp() => api = test.CleanAndProvideApi(); [UnityTest] // Issue: https://github.com/hexthedev/OpenAi-Api-Unity/issues/7 // Prompts weren't working with escape characters public IEnumerator Issue007_EscapeCharacterBug() { ApiResult result = null; yield return api.Engines.Engine("ada").Completions.CreateCompletionCoroutine( test, new CompletionRequestV1() { prompt = "something\r\n", max_tokens = 8 }, (r) => result = r ); Assert.That(test.TestApiResultHasResponse(result)); } [UnityTest] // Issue: https://github.com/hexthedev/OpenAi-Api-Unity/issues/10 // For some reason the completer is logging twice public IEnumerator Issue010_CompleterLoggingTwice() { OpenAiCompleterV1 comp = OpenAiCompleterV1.Instance; yield return new WaitForEndOfFrame(); int count = 0; string res = null; UnityWebRequest err = null; yield return OpenAiCompleterV1.Instance.Complete( "test", extractRes, extractErr ); int count2 = count; string res2 = res; UnityWebRequest err2 = err; bool resIsNotNull = res != null; test.LogTest("A response was received by the first request", resIsNotNull); bool errIsNull = err == null; test.LogTest("The web request is null", errIsNull); bool only1requestHappened = count == 1; test.LogTest("Only 1 request happened", only1requestHappened); Assert.That(resIsNotNull && errIsNull && only1requestHappened); void extractRes(string r) { res = r; count++; } void extractErr(UnityWebRequest e) { err = e; count++; } } [UnityTest] // Issue: https://github.com/hexthedev/OpenAi-Api-Unity/issues/13 // Prompts weren't working multiline strings public IEnumerator Issue013_MultilineStringBug() { string multiprompt = @"test ""Are these an isse"" "; ApiResult result = null; yield return api.Engines.Engine("ada").Completions.CreateCompletionCoroutine( test, new CompletionRequestV1() { prompt = multiprompt, max_tokens = 8 }, (r) => result = r ); Assert.That(test.TestApiResultHasResponse(result)); } } } ================================================ FILE: Tests/Runtime/Scripts/Core/V1/V1BugTests.cs.meta ================================================ fileFormatVersion: 2 guid: 86b352fb947b61a41a1d13d30b0e844d MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Runtime/Scripts/Core/V1/V1PlayTests.cs ================================================ using NUnit.Framework; using OpenAi.Api.V1; using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; using UnityEngine.TestTools; namespace OpenAi.Api.Test { public class V1PlayTests { private TestManager test; private OpenAiApiV1 api; [OneTimeSetUp] public void OneTimeSetup() => test = TestManager.Instance; [SetUp] public void SetUp() => api = test.CleanAndProvideApi(); #region Engines Requests [UnityTest] public IEnumerator EnginesListCoroutine() { ApiResult result = null; yield return api.Engines.ListEnginesCoroutine(test, (r) => result = r); if (!test.TestApiResultHasResponse(result)) Assert.That(false); bool isDataNotEmpty = result.Result.data != null; test.LogTest("Data is not empty", isDataNotEmpty); bool containsAda = false; foreach (EngineV1 engine in result.Result.data) { if (engine.id == "ada") { containsAda = true; break; } } test.LogTest("Engine id contains \"ada\"", containsAda); Assert.That(isDataNotEmpty && containsAda); } [UnityTest] public IEnumerator EnginesListAsync() { Task> resTask = api.Engines.ListEnginesAsync(); while (!resTask.IsCompleted) yield return new WaitForEndOfFrame(); ApiResult res = resTask.Result; if (!test.TestApiResultHasResponse(res)) Assert.That(false); bool isResultDataNotEmpty = res.Result.data != null && res.Result.data.Length > 0; test.LogTest("Result data is not empty", isResultDataNotEmpty); Assert.That(isResultDataNotEmpty); } #endregion #region Engine Requests [UnityTest] public IEnumerator EngineRetrieveCoroutine() { ApiResult result = null; yield return api.Engines.Engine("ada").RetrieveEngineCoroutine(test, (r) => result = r); if (!test.TestApiResultHasResponse(result)) Assert.That(false); bool isResultIdAda = result.Result.id == "ada"; test.LogTest("The result id is ada", isResultIdAda); Assert.That(isResultIdAda); } [UnityTest] public IEnumerator EngineRetrieveAsync() { Task> resultTask = api.Engines.Engine("ada").RetrieveEngineAsync(); while (!resultTask.IsCompleted) yield return new WaitForEndOfFrame(); ApiResult result = resultTask.Result; if (!test.TestApiResultHasResponse(result)) Assert.That(false); bool isResultIdAda = result.Result.id == "ada"; test.LogTest("The result id is ada", isResultIdAda); Assert.That(isResultIdAda); } #endregion #region Completion Requests [UnityTest] public IEnumerator Completions_TestAllRequestParamsString() { ApiResult result = null; CompletionRequestV1 req = new CompletionRequestV1() { prompt = "hello", best_of = 1, echo = false, frequency_penalty = 0, presence_penalty = 0, logit_bias = new Dictionary() { { "123", -100 }, { "111", 100 } }, stop = "###", logprobs = 0, stream = false, max_tokens = 8, n = 1, temperature = 0, top_p = 1 }; yield return api.Engines.Engine("ada").Completions.CreateCompletionCoroutine(test, req, (r) => result = r); if (!test.TestApiResultHasResponse(result)) Assert.That(false); bool doesResultObjectExist = result.Result.choices != null && result.Result.choices.Length > 0; test.LogTest("Does non empty result object exist", doesResultObjectExist); Assert.That(doesResultObjectExist); } [UnityTest] public IEnumerator Completions_TestAllRequestParamsArray() { ApiResult result = null; CompletionRequestV1 req = new CompletionRequestV1() { prompt = new string[] { "prompt1", "prompt2" }, best_of = 1, echo = false, frequency_penalty = 0, presence_penalty = 0, logit_bias = new Dictionary() { { "123", -100 }, { "111", 100 } }, stop = new string[] { "stop1", "stop2" }, logprobs = 0, stream = false, max_tokens = 8, n = 1, temperature = 0, top_p = 1 }; yield return api.Engines.Engine("ada").Completions.CreateCompletionCoroutine(test, req, (r) => result = r); if (!test.TestApiResultHasResponse(result)) Assert.That(false); bool doesResultObjectExist = result.Result.choices != null && result.Result.choices.Length > 0; test.LogTest("Does non empty result object exist", doesResultObjectExist); Assert.That(doesResultObjectExist); } [UnityTest] public IEnumerator CompletionsCreateCoroutine() { ApiResult result = null; CompletionRequestV1 req = new CompletionRequestV1() { prompt = "hello", n = 8 }; yield return api.Engines.Engine("ada").Completions.CreateCompletionCoroutine(test, req, (r) => result = r); if (!test.TestApiResultHasResponse(result)) Assert.That(false); bool doesResultObjectExist = result.Result.choices != null && result.Result.choices.Length > 0; test.LogTest("Does non empty result object exist", doesResultObjectExist); Assert.That(doesResultObjectExist); } [UnityTest] public IEnumerator CompletionsCreateAsync() { Task> resTask = api.Engines.Engine("ada").Completions.CreateCompletionAsync( new CompletionRequestV1() { prompt = "hello", max_tokens = 8 } ); while (!resTask.IsCompleted) yield return new WaitForEndOfFrame(); ApiResult res = resTask.Result; Assert.That(test.TestApiResultHasResponse(res)); } [UnityTest] public IEnumerator CompletionsCreateCoroutine_EventStream() { ApiResult result = null; List partials = new List(); bool isComplete = false; CompletionRequestV1 req = new CompletionRequestV1() { prompt = "hello", n = 8 }; yield return api.Engines.Engine("ada").Completions.CreateCompletionCoroutine_EventStream( test, req, (r) => result = r, (i, l) => partials.Add(l), () => isComplete = true ); float timer = 10f; while (!isComplete && timer > 0) { timer -= Time.deltaTime; yield return new WaitForEndOfFrame(); } test.LogTest("Stream was completed", isComplete); if (!test.TestApiResultSuccess(result)) Assert.That(false); bool partialsNotEmpty = partials != null && partials.Count > 0; test.LogTest("Partial reponses were received", partialsNotEmpty); Assert.That(isComplete && partialsNotEmpty); } [UnityTest] public IEnumerator CompletionsCreateAsync_EventStream() { ApiResult result = null; List completions = new List(); bool isComplete = false; Task engineTask = api.Engines.Engine("davinci").Completions.CreateCompletionAsync_EventStream( new CompletionRequestV1() { prompt = "hello", max_tokens = 8, stream = true }, (r) => result = r, (i, c) => completions.Add(c), () => isComplete = true ); while (!engineTask.IsCompleted) yield return new WaitForEndOfFrame(); test.LogTest("Stream was completed", isComplete); if (!test.TestApiResultSuccess(result)) Assert.That(false); bool completionsNotEmpty = completions != null && completions.Count > 0; test.LogTest("Partial reponses were received", completionsNotEmpty); Assert.That(isComplete && completionsNotEmpty); } #endregion #region Chat Completion Requests [UnityTest] public IEnumerator ChatCompletions_TestAllRequestParamsString() { ApiResult result = null; MessageV1 message = new MessageV1(); message.role = MessageV1.MessageRole.user; message.content = "hello"; List messages = new List(); messages.Add(message); ChatCompletionRequestV1 req = new ChatCompletionRequestV1() { model = "gpt-3.5-turbo", messages = messages, frequency_penalty = 0, presence_penalty = 0, logit_bias = new Dictionary() { { "123", -100 }, { "111", 100 } }, stop = "###", stream = false, max_tokens = 8, n = 1, temperature = 0, top_p = 1, user = "" }; yield return api.Chat.Completions.CreateChatCompletionCoroutine(test, req, (r) => result = r); if (!test.TestApiResultHasResponse(result)) Assert.That(false); bool doesResultObjectExist = result.Result.choices != null && result.Result.choices.Length > 0; test.LogTest("Does non empty result object exist", doesResultObjectExist); Assert.That(doesResultObjectExist); } [UnityTest] public IEnumerator ChatCompletions_TestAllRequestParamsArray() { ApiResult result = null; MessageV1 message = new MessageV1(); message.role = MessageV1.MessageRole.user; message.content = "hello"; List messages = new List(); messages.Add(message); ChatCompletionRequestV1 req = new ChatCompletionRequestV1() { model = "gpt-3.5-turbo", messages = messages, frequency_penalty = 0, presence_penalty = 0, logit_bias = new Dictionary() { { "123", -100 }, { "111", 100 } }, stop = new string[] { "stop1", "stop2" }, stream = false, max_tokens = 8, n = 1, temperature = 0, top_p = 1, user = "" }; yield return api.Chat.Completions.CreateChatCompletionCoroutine(test, req, (r) => result = r); if (!test.TestApiResultHasResponse(result)) Assert.That(false); bool doesResultObjectExist = result.Result.choices != null && result.Result.choices.Length > 0; test.LogTest("Does non empty result object exist", doesResultObjectExist); Assert.That(doesResultObjectExist); } [UnityTest] public IEnumerator ChatCompletionsCreateCoroutine() { ApiResult result = null; MessageV1 message = new MessageV1(); message.role = MessageV1.MessageRole.user; message.content = "hello"; List messages = new List(); messages.Add(message); ChatCompletionRequestV1 req = new ChatCompletionRequestV1() { model = "gpt-3.5-turbo", messages = messages, n = 8 }; yield return api.Chat.Completions.CreateChatCompletionCoroutine(test, req, (r) => result = r); if (!test.TestApiResultHasResponse(result)) Assert.That(false); bool doesResultObjectExist = result.Result.choices != null && result.Result.choices.Length > 0; test.LogTest("Does non empty result object exist", doesResultObjectExist); Assert.That(doesResultObjectExist); } [UnityTest] public IEnumerator ChatCompletionsCreateAsync() { MessageV1 message = new MessageV1(); message.role = MessageV1.MessageRole.user; message.content = "hello"; List messages = new List(); messages.Add(message); ChatCompletionRequestV1 req = new ChatCompletionRequestV1() { model = "gpt-3.5-turbo", messages = messages, max_tokens = 8 }; Task> resTask = api.Chat.Completions.CreateChatCompletionAsync(req); while (!resTask.IsCompleted) yield return new WaitForEndOfFrame(); ApiResult res = resTask.Result; Assert.That(test.TestApiResultHasResponse(res)); } [UnityTest] public IEnumerator ChatCompletionsCreateCoroutine_EventStream() { ApiResult result = null; List partials = new List(); bool isComplete = false; MessageV1 message = new MessageV1(); message.role = MessageV1.MessageRole.user; message.content = "hello"; List messages = new List(); messages.Add(message); ChatCompletionRequestV1 req = new ChatCompletionRequestV1() { model = "gpt-3.5-turbo", messages = messages, max_tokens = 8 }; yield return api.Chat.Completions.CreateChatCompletionCoroutine_EventStream( test, req, (r) => result = r, (i, l) => partials.Add(l), () => isComplete = true ); float timer = 10f; while (!isComplete && timer > 0) { timer -= Time.deltaTime; yield return new WaitForEndOfFrame(); } test.LogTest("Stream was completed", isComplete); if (!test.TestApiResultSuccess(result)) Assert.That(false); bool partialsNotEmpty = partials != null && partials.Count > 0; test.LogTest("Partial reponses were received", partialsNotEmpty); Assert.That(isComplete && partialsNotEmpty); } [UnityTest] public IEnumerator ChatCompletionsCreateAsync_EventStream() { ApiResult result = null; List completions = new List(); bool isComplete = false; MessageV1 message = new MessageV1(); message.role = MessageV1.MessageRole.user; message.content = "hello"; List messages = new List(); messages.Add(message); ChatCompletionRequestV1 req = new ChatCompletionRequestV1() { model = "gpt-3.5-turbo", messages = messages, max_tokens = 8, stream = true }; Task engineTask = api.Chat.Completions.CreateChatCompletionAsync_EventStream( req, (r) => result = r, (i, c) => completions.Add(c), () => isComplete = true ); while (!engineTask.IsCompleted) yield return new WaitForEndOfFrame(); test.LogTest("Stream was completed", isComplete); if (!test.TestApiResultSuccess(result)) Assert.That(false); bool completionsNotEmpty = completions != null && completions.Count > 0; test.LogTest("Partial reponses were received", completionsNotEmpty); Assert.That(isComplete && completionsNotEmpty); } [UnityTest] public IEnumerator ChatCompletionsCreateAsync_Multiple() { MessageV1 message = new MessageV1(); message.role = MessageV1.MessageRole.system; message.content = "You are Yoda from Star Wars."; List messages = new List(); messages.Add(message); message = new MessageV1(); message.role = MessageV1.MessageRole.user; message.content = "Is Vader good or evil?"; messages.Add(message); ChatCompletionRequestV1 req = new ChatCompletionRequestV1() { model = "gpt-3.5-turbo", messages = messages }; Task> resTask = api.Chat.Completions.CreateChatCompletionAsync(req); while (!resTask.IsCompleted) yield return new WaitForEndOfFrame(); ApiResult res = resTask.Result; Assert.That(test.TestApiResultHasResponse(res)); } #endregion } } ================================================ FILE: Tests/Runtime/Scripts/Core/V1/V1PlayTests.cs.meta ================================================ fileFormatVersion: 2 guid: 2c42900de9f02ee48af3c3d4f42e6f36 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Runtime/Scripts/Core/V1.meta ================================================ fileFormatVersion: 2 guid: fb6fb4f46e6b0d74290f8811c3b4b8ca folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Runtime/Scripts/Core.meta ================================================ fileFormatVersion: 2 guid: 6123089993dd31c4e95f28d6b1a4ea08 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Runtime/Scripts/Utility/TestManager.cs ================================================ using OpenAi.Unity; using OpenAi.Unity.V1; using OpenAi.Api.V1; using UnityEngine; namespace OpenAi.Api.Test { public class TestManager : AMonoSingleton { private OpenAiApiGatewayV1 _apiGateway = null; public OpenAiApiV1 CleanAndProvideApi() { if(_apiGateway != null) { Destroy(_apiGateway.gameObject); _apiGateway = null; } _apiGateway = OpenAiApiGatewayV1.Instance; _apiGateway.Auth = ScriptableObject.CreateInstance(); _apiGateway.Auth.AuthType = SOAuthArgsV1.EAuthProvisionMethod.LocalFile; _apiGateway.InitializeApi(); return _apiGateway.Api; } public void LogTest(string testDescription, bool result) { if (result) { Debug.Log($"[SUCCESS] {testDescription}"); } else { Debug.Log($"[FAIL] {testDescription}"); } } public bool TestApiResultSuccess(ApiResult result) { bool resultIsNotNull = result != null; LogTest("Result is not null", resultIsNotNull); if (!resultIsNotNull) return false; bool resultIsSuccess = result.IsSuccess; LogTest("Result is success", resultIsSuccess); return resultIsNotNull && resultIsSuccess; } public bool TestApiResultHasResponse(ApiResult result) { if (!TestApiResultSuccess(result)) return false; bool resultDataIsNotNull = result.Result != null; LogTest("Result data is not null", resultDataIsNotNull); return resultDataIsNotNull; } } } ================================================ FILE: Tests/Runtime/Scripts/Utility/TestManager.cs.meta ================================================ fileFormatVersion: 2 guid: d5af3e7604a64fc48a09cd9c35c52761 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Runtime/Scripts/Utility.meta ================================================ fileFormatVersion: 2 guid: c416749ed6215ba4c942296b750293a5 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Runtime/Scripts.meta ================================================ fileFormatVersion: 2 guid: 90068a42ae1f929488453d252586f75d folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Runtime/openai.api.unity.tests.asmdef ================================================ { "name": "openai.api.unity.tests", "rootNamespace": "", "references": [ "UnityEngine.TestRunner", "UnityEditor.TestRunner", "openai.api.unity" ], "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": true, "precompiledReferences": [ "nunit.framework.dll" ], "autoReferenced": false, "defineConstraints": [ "UNITY_INCLUDE_TESTS" ], "versionDefines": [], "noEngineReferences": false } ================================================ FILE: Tests/Runtime/openai.api.unity.tests.asmdef.meta ================================================ fileFormatVersion: 2 guid: fc54d62c1ca99e743bf1d95c40e63e49 AssemblyDefinitionImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests/Runtime.meta ================================================ fileFormatVersion: 2 guid: ce5d35051f4a3a443ae48ed52729c1c8 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: Tests.meta ================================================ fileFormatVersion: 2 guid: 3062c48fbb54dac4a97a5a800a5ab3b7 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: ================================================ FILE: package.json ================================================ {"name": "com.openai.api.unity", "version": "0.2.12", "displayName": "OpenAi Api Unity", "description": "An OpenAi Api for the Unity Engine", "unity": "2020.3", "unityRelease": "0f1", "dependencies": {}, "keywords": ["OpenAi"], "author": {"name": "James McCafferty", "email": "jamesmccafferty@live.ca", "url": "https://github.com/hexthedev/OpenAi-Api-Unity"}} ================================================ FILE: package.json.meta ================================================ fileFormatVersion: 2 guid: 9bdc328e9c2659345a872bec307bca2d TextScriptImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant: