Skip to content

Commit

Permalink
fix: apply review
Browse files Browse the repository at this point in the history
  • Loading branch information
Clément Sirieix authored and Clément Sirieix committed Sep 12, 2024
1 parent 773dba5 commit 05bb5e8
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 25 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dist-ssr
*.local

.env
examples

# Editor directories and files
.vscode/*
Expand Down
2 changes: 1 addition & 1 deletion openai.ts → examples/openai.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dotenv/config';
import OpenAI from 'openai';

import { LiteralClient } from './src';
import { LiteralClient } from '../src';

const literalClient = new LiteralClient();

Expand Down
2 changes: 1 addition & 1 deletion prompt.ts → examples/prompt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dotenv/config';

import { LiteralClient } from './src';
import { LiteralClient } from '../src';

const literalClient = new LiteralClient();

Expand Down
21 changes: 18 additions & 3 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
"zod-to-json-schema": "^3.23.0"
},
"dependencies": {
"@langchain/openai": "^0.2.7",
"axios": "^1.6.2",
"form-data": "^4.0.0",
"mustache": "^4.2.0",
"uuid": "^9.0.1"
},
"peerDependencies": {
"@ai-sdk/openai": "0.0.x",
"@langchain/openai": "^0.2.7",
"ai": "3.x",
"langchain": "0.1.x",
"llamaindex": "0.3.x",
Expand Down
1 change: 0 additions & 1 deletion src/instrumentation/langchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@ export class LiteralCallbackHandler extends BaseCallbackHandler {
}
}
} catch (e) {
console.error(e);
console.log('Error in handleLLMEnd', e);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/prompt-engineering/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class PromptFields extends Utils {
type!: GenerationType;
createdAt!: string;
name!: string;
url!: string;
version!: number;
url?: Maybe<string>;
versionDesc?: Maybe<string>;
Expand Down
27 changes: 12 additions & 15 deletions tests/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { Dataset } from '../src/evaluation/dataset';
import { Score } from '../src/evaluation/score';
import { sleep } from './utils';

describe('End to end tests for the SDK', function() {
describe('End to end tests for the SDK', function () {
let client: LiteralClient;

beforeAll(function() {
beforeAll(function () {
const url = process.env.LITERAL_API_URL;
const apiKey = process.env.LITERAL_API_KEY;

Expand All @@ -20,7 +20,7 @@ describe('End to end tests for the SDK', function() {
client = new LiteralClient({ apiKey, apiUrl: url });
});

it('should test user', async function() {
it('should test user', async function () {
const identifier = `test_user_${uuidv4()}`;
const user = await client.api.createUser(identifier, { foo: 'bar' });

Expand All @@ -47,7 +47,7 @@ describe('End to end tests for the SDK', function() {
expect(deletedUser).toBeUndefined();
});

it('should test generation', async function() {
it('should test generation', async function () {
const generation = await client.api.createGeneration({
provider: 'test',
model: 'test',
Expand All @@ -66,7 +66,7 @@ describe('End to end tests for the SDK', function() {
expect(generations.data[0].id).toBe(generation.id);
});

it('should test thread with a single argument', async function() {
it('should test thread with a single argument', async function () {
const thread = await client.api.upsertThread({
threadId: uuidv4(),
name: 'name',
Expand All @@ -90,14 +90,11 @@ describe('End to end tests for the SDK', function() {

await client.api.deleteThread(thread.id);

// We have to await 5 seconds for the thread to disappear from the cache
await sleep(5000);

const deletedThread = await client.api.getThread(thread.id);
expect(deletedThread).toBeNull();
});

it('should test thread (deprecated)', async function() {
it('should test thread (deprecated)', async function () {
const thread = await client.api.upsertThread(
uuidv4(),
'name',
Expand Down Expand Up @@ -130,7 +127,7 @@ describe('End to end tests for the SDK', function() {
expect(deletedThread).toBeNull();
});

it('should test export thread', async function() {
it('should test export thread', async function () {
const thread = await client.api.upsertThread({
threadId: uuidv4(),
name: 'test',
Expand Down Expand Up @@ -166,7 +163,7 @@ describe('End to end tests for the SDK', function() {
expect(deletedThread).toBeNull();
});

it('should test run', async function() {
it('should test run', async function () {
const step = await client
.run({
name: 'test',
Expand Down Expand Up @@ -197,7 +194,7 @@ describe('End to end tests for the SDK', function() {
expect(deletedStep).toBeNull();
});

it('should test step', async function() {
it('should test step', async function () {
const thread = await client.thread({ id: uuidv4() });
const step = await thread
.step({
Expand Down Expand Up @@ -231,7 +228,7 @@ describe('End to end tests for the SDK', function() {
expect(deletedStep).toBeNull();
});

it('should test steps', async function() {
it('should test steps', async function () {
const thread = await client.thread({ id: uuidv4() });

const step = await thread
Expand Down Expand Up @@ -266,7 +263,7 @@ describe('End to end tests for the SDK', function() {
await client.api.deleteThread(thread.id);
});

it('should test score', async function() {
it('should test score', async function () {
const thread = await client.thread({ id: uuidv4() });
const step = await thread
.step({
Expand Down Expand Up @@ -306,7 +303,7 @@ describe('End to end tests for the SDK', function() {
await client.api.deleteThread(thread.id);
});

it('should test scores', async function() {
it('should test scores', async function () {
const thread = await client.thread({ id: uuidv4() });
const step = await thread
.step({
Expand Down
2 changes: 1 addition & 1 deletion tests/attachments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Attachments', () => {
{ type: 'ArrayBuffer', content: arrayBuffer! },
{ type: 'Blob', content: blob! },
{ type: 'File', content: file! }
])('handles $type objects', async function({ type, content }) {
])('handles $type objects', async function ({ type, content }) {
const attachment = await client.api.createAttachment({
content,
mime,
Expand Down

0 comments on commit 05bb5e8

Please sign in to comment.