@chinudotdev/provider-openai 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -0
- package/package.json +15 -2
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @chinudotdev/provider-openai
|
|
2
|
+
|
|
3
|
+
OpenAI-compatible **agent-core/v1** provider adapter — Chat Completions API, SSE streaming, tools, images, reasoning extensions.
|
|
4
|
+
|
|
5
|
+
Works with OpenAI, Azure OpenAI, and any OpenAI-compatible endpoint.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @chinudotdev/provider-openai
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createOpenAIProvider } from "@chinudotdev/provider-openai";
|
|
17
|
+
|
|
18
|
+
const provider = createOpenAIProvider({
|
|
19
|
+
apiKey: process.env.OPENAI_API_KEY!,
|
|
20
|
+
baseURL: "https://api.openai.com", // optional
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
for await (const event of provider.stream(
|
|
24
|
+
{
|
|
25
|
+
spec: "agent-core/v1",
|
|
26
|
+
model: "gpt-4o-mini",
|
|
27
|
+
messages: [{ role: "user", content: [{ type: "text", text: "Hello" }] }],
|
|
28
|
+
},
|
|
29
|
+
new AbortController().signal,
|
|
30
|
+
)) {
|
|
31
|
+
if (event.type === "text_delta") process.stdout.write(event.text);
|
|
32
|
+
if (event.type === "stop") break;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Environment helper
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { createProviderFromEnv } from "@chinudotdev/provider-openai";
|
|
40
|
+
// Reads OPENAI_API_KEY, optional OPENAI_BASE_URL
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## With Agent SDK
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { Agent } from "@chinudotdev/agent";
|
|
47
|
+
import { createProviderFromEnv } from "@chinudotdev/provider-openai";
|
|
48
|
+
|
|
49
|
+
const agent = new Agent({
|
|
50
|
+
model: "gpt-4o-mini",
|
|
51
|
+
provider: createProviderFromEnv(),
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Docs
|
|
56
|
+
|
|
57
|
+
- [Provider guide](https://github.com/chinudotdev/agent-sdk/tree/main/packages/providers)
|
|
58
|
+
- [Examples](https://github.com/chinudotdev/agent-sdk/tree/main/packages/providers/openai/examples)
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chinudotdev/provider-openai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "OpenAI-compatible agent-core/v1 provider adapter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"sideEffects": false,
|
|
8
|
+
"homepage": "https://github.com/chinudotdev/agent-sdk/tree/main/packages/providers/openai#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/chinudotdev/agent-sdk/issues"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"agent",
|
|
14
|
+
"agent-core",
|
|
15
|
+
"openai",
|
|
16
|
+
"provider",
|
|
17
|
+
"llm",
|
|
18
|
+
"typescript"
|
|
19
|
+
],
|
|
8
20
|
"repository": {
|
|
9
21
|
"type": "git",
|
|
10
22
|
"url": "git+https://github.com/chinudotdev/agent-sdk.git",
|
|
@@ -14,7 +26,8 @@
|
|
|
14
26
|
"access": "public"
|
|
15
27
|
},
|
|
16
28
|
"files": [
|
|
17
|
-
"dist"
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md"
|
|
18
31
|
],
|
|
19
32
|
"exports": {
|
|
20
33
|
".": {
|