Skip to content

Commit

Permalink
Fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
joch committed Feb 2, 2024
1 parent e9b1850 commit 4dd21e7
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 114 deletions.
4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Run the examples:
`basic.ts`: Simple example of how to use the Opper TypeScript SDK to send a message to a function and receive a response.

```shell
npx ts-node basic.ts
npm run basic
```

`streaming.ts`: Example of how to use the Opper TypeScript SDK to start a streaming connection to a function and receive messages.

```shell
npx ts-node streaming.ts
npm run streaming
```
6 changes: 3 additions & 3 deletions examples/basic.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { config } from 'dotenv';
import { Message, ChatPayload } from 'opperai/types';
import { types } from 'opperai';
import Client from 'opperai';

config();
const client = new Client(process.env.OPPER_API_KEY);

const message: Message = {
const message: types.Message = {
role: "user",
content: "Hello world! This is a test message."
};

const payload: ChatPayload = {
const payload: types.ChatPayload = {
messages: [message]
};

Expand Down
5 changes: 3 additions & 2 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"version": "1.0.0",
"description": "Examples of using the Opper SDK",
"scripts": {
"dev": "tsc && node index.js"
"basic": "npx ts-node basic.ts",
"streaming": "npx ts-node streaming.ts"
},
"dependencies": {
"dotenv": "^16.4.1",
"opperai": "file:../dist"
"opperai": "^0.1.1"
},
"devDependencies": {
"@types/node": "^20.11.15",
Expand Down
12 changes: 6 additions & 6 deletions examples/streaming.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { config } from 'dotenv';
import { Message, ChatPayload, SSEStreamCallbacks } from 'opperai/types';
import { SSEClient } from 'opperai/ssestream';
import { types } from 'opperai';
import { ssestream } from 'opperai';

config();
const sseClient = new SSEClient(process.env.OPPER_API_KEY);
const sseClient = new ssestream.SSEClient(process.env.OPPER_API_KEY);

const message: Message = {
const message: types.Message = {
role: "user",
content: "Hello world! This is a test message."
};

const payload: ChatPayload = {
const payload: types.ChatPayload = {
messages: [message]
};

const callbacks: SSEStreamCallbacks = {
const callbacks: types.SSEStreamCallbacks = {
onMessage: (data: any) => {
console.log('Received message:', data);
},
Expand Down
93 changes: 0 additions & 93 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "opperai",
"version": "0.1.0",
"version": "0.1.1",
"description": "",
"main": "dist/index.js",
"types": "dist/types.d.ts",
"main": "dist/index",
"types": "dist/types",
"scripts": {
"prepare": "npm run build",
"build": "tsc",
Expand Down Expand Up @@ -31,8 +31,5 @@
"ts-jest": "^29.1.2",
"typescript": "^5.3.3",
"web-streams-polyfill": "^3.3.2"
},
"dependencies": {
"axios": "^1.6.7"
}
}
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * as types from './types'
export * as ssestream from './ssestream'
export * as types from "./types";
export * as ssestream from "./ssestream";
export { Client } from "./client";
export { Client as default } from "./client";

0 comments on commit 4dd21e7

Please sign in to comment.