Skip to content

Commit 4800b95

Browse files
committed
Rename ai instance for universal client
1 parent 2c9fed2 commit 4800b95

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ A developer-friendly Lua interface for working with multiple generative AI provi
2424
```lua
2525
local AI = require("src.ai")
2626

27-
local ai = AI.new("<YOUR_API_KEY>", "https://api.openai.com/v1/chat/completions")
27+
local client = AI.new("<YOUR_API_KEY>", "https://api.openai.com/v1/chat/completions")
2828
```
2929

3030
### Minimal
3131

3232
```lua
33-
local chat = ai:chat("gpt-4o-mini")
33+
local chat = client:chat("gpt-4o-mini")
3434
print(chat:say("Hello, world!"))
3535
```
3636

3737
### Streaming
3838

3939
```lua
40-
local chat = ai:chat("gpt-4o-mini", { settings = { stream = true } })
40+
local chat = client:chat("gpt-4o-mini", { settings = { stream = true } })
4141
chat:say("Hello, world!")
4242
```
4343

@@ -56,7 +56,7 @@ local json_object = {
5656
schema = npc_schema,
5757
}
5858

59-
local chat = ai:chat("gpt-4o-mini", { settings = { json = json_object } })
59+
local chat = client:chat("gpt-4o-mini", { settings = { json = json_object } })
6060
print(chat:say("Create a powerful wizard called Torben."))
6161
```
6262

main.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ local endpoint = "https://api.openai.com/v1/chat/completions"
2525
local model = "gpt-4o-mini"
2626

2727
local function main()
28-
local ai = AI.new(api_key, endpoint)
29-
local chat = ai:chat(model, {
28+
local client = AI.new(api_key, endpoint)
29+
local chat = client:chat(model, {
3030
system_prompt = "Respond extremely briefly.",
3131
settings = {
3232
stream = false,

0 commit comments

Comments
 (0)