You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle error from OpenAI without locking the conversation
Support Api-Key header that Azure OpenAI use ( use SPIN_VARIABLE_OPENAI_API_KEY_METHOD environment variable to decide which method to use for passing the api key )
Allow refunding all tokens if there is no usage
Lock emscripten version. After emscripten 3.1.74 the standard libraries are built with non-mvp features. The NEAR wasm spec is at mvp, and so the build was broken.
Enhance test suites to support the different Api-Key passing methods
Copy file name to clipboardExpand all lines: examples/aiproxy/README.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,14 @@ This folder contains a [Spin](https://www.fermyon.com/spin) application, based o
4
4
5
5
There is a simple example of a web client in the [web](./web/) folder.
6
6
7
-
The application will keep track of of token usage per conversation in the built-in key-value storage of Spin. The initial balance for a conversation is retrieved from the Fungible Token smart contract.
7
+
The application will keep track of token usage per conversation in the built-in key-value storage of Spin. The initial balance for a conversation is retrieved from the Fungible Token smart contract.
8
8
9
9
To launch the application, make sure to have the Spin SDK installed.
10
10
11
11
You also need to set some environment variables:
12
12
13
13
-`SPIN_VARIABLE_OPENAI_API_KEY` your OpenAI API key.
14
+
-`SPIN_VARIABLE_OPENAI_API_KEY_METHOD` specifies the method to provide the API key. Use `authorization` for OpenAI (default) and `api-key` for Azure OpenAI.
14
15
-`SPIN_VARIABLE_REFUND_SIGNING_KEY` an ed21159 secret key that will be used to sign refund requests. You can run the [create-refund-signing-keypair.js](./create-refund-signing-keypair.js) script to create the keypair. Run it using the command `$(node create-refund-signing-keypair.js)` and it will set the environment variable for you.
15
16
-`SPIN_VARIABLE_FT_CONTRACT_ID` the NEAR contract account id. e.g `aitoken.test.near`
16
17
-`SPIN_VARIABLE_OPENAI_COMPLETIONS_ENDPOINT` OpenAI API completions endpoint. E.g. https://api.openai.com/v1/chat/completions
awaitexpect(awaitpage.locator("#refund_message")).toContainText(`EVENT_JSON:{"standard":"nep141","version":"1.0.0","event":"ft_transfer","data":[{"old_owner_id":"${contractId}","new_owner_id":"${accountId}","amount":"127999973"}]}\nrefunded 127999973 to ${accountId}`);
85
+
awaitexpect(awaitpage.locator("#refund_message")).toContainText(`EVENT_JSON:{"standard":"nep141","version":"1.0.0","event":"ft_transfer","data":[{"old_owner_id":"${contractId}","new_owner_id":"${accountId}","amount":"${expectedRefundAmount}"}]}\nrefunded ${expectedRefundAmount} to ${accountId}`,{timeout: 10_000});
0 commit comments