Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make datasetId optional for experiments #46

Merged
merged 5 commits into from
Jul 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' of github.com:Chainlit/typescript-client into wil…
…ly/eng-1669-experiments-features
willydouhard committed Jul 26, 2024
commit 2d877a5d02b459c6138e2c4a92ebc39aadb86e42
12 changes: 12 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -75,6 +75,18 @@ export class LiteralClient {
});
}

_currentThread(): Thread | null {
const store = storage.getStore();

return store?.currentThread || null;
}

_currentStep(): Step | null {
const store = storage.getStore();

return store?.currentStep || null;
}

/**
* Gets the current thread from the context.
* WARNING : this will throw if run outside of a thread context.
6 changes: 3 additions & 3 deletions tests/attachments.test.ts
Original file line number Diff line number Diff line change
@@ -3,12 +3,12 @@ import { createReadStream, readFileSync } from 'fs';

import { Attachment, LiteralClient, Maybe } from '../src';

const url = process.env.LITERAL_API_URL;
const apiUrl = process.env.LITERAL_API_URL;
const apiKey = process.env.LITERAL_API_KEY;
if (!url || !apiKey) {
if (!apiUrl || !apiKey) {
throw new Error('Missing environment variables');
}
const client = new LiteralClient(apiKey, url);
const client = new LiteralClient({ apiKey, apiUrl });

const filePath = './tests/chainlit-logo.png';
const mime = 'image/png';
4 changes: 2 additions & 2 deletions tests/integration/openai.test.ts
Original file line number Diff line number Diff line change
@@ -348,7 +348,7 @@ describe('OpenAI Instrumentation', () => {

describe('Handling tags and metadata', () => {
it('handles tags and metadata on the instrumentation call', async () => {
const client = new LiteralClient(apiKey, url);
const client = new LiteralClient({ apiKey, apiUrl });
client.instrumentation.openai({
tags: ['tag1', 'tag2'],
metadata: { key: 'value' }
@@ -382,7 +382,7 @@ describe('OpenAI Instrumentation', () => {
}, 30_000);

it('handles tags and metadata on the LLM call', async () => {
const client = new LiteralClient(apiKey, url);
const client = new LiteralClient({ apiKey, apiUrl });

const instrumentedOpenAi = client.instrumentation.openai({
tags: ['tag1', 'tag2'],
You are viewing a condensed version of this merge commit. You can view the full changes here.