Skip to content

Commit c9d8947

Browse files
authored
Revert "📦 NEW: Tracing Support (#99)" (#107)
This reverts commit 22f2698.
1 parent f3521ce commit c9d8947

File tree

5 files changed

+73
-553
lines changed

5 files changed

+73
-553
lines changed
Lines changed: 29 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,40 @@
1-
// Test script for the simplified proxy approach
1+
// Experimental upcoming beta AI primitve.
2+
// Please refer to the documentation for more information: https://langbase.com/docs for more information.
3+
24
import 'dotenv/config';
3-
import {Langbase} from 'langbase';
5+
import {Langbase, Workflow} from 'langbase';
46

5-
// Create Langbase instance
67
const langbase = new Langbase({
78
apiKey: process.env.LANGBASE_API_KEY!,
89
});
910

1011
async function main() {
11-
// Create a workflow with debug mode enabled
12-
const workflow = langbase.workflow({
13-
name: 'simplified-proxy-test',
14-
debug: true, // Enable debug logging
12+
const {step} = new Workflow({debug: true});
13+
14+
const result = await step({
15+
id: 'sumamrize',
16+
run: async () => {
17+
return langbase.llm.run({
18+
model: 'openai:gpt-4o-mini',
19+
apiKey: process.env.OPENAI_API_KEY!,
20+
messages: [
21+
{
22+
role: 'system',
23+
content:
24+
'You are an expert summarizer. Summarize the user input.',
25+
},
26+
{
27+
role: 'user',
28+
content:
29+
'I am testing workflows. I just created an example of summarize workflow. Can you summarize this?',
30+
},
31+
],
32+
stream: false,
33+
});
34+
},
1535
});
1636

17-
try {
18-
// STEP 1: Call langbase.agent.run but don't return its result directly
19-
const step1Result = await workflow.step({
20-
id: 'call-but-return-custom',
21-
run: async () => {
22-
// Return custom result instead
23-
return {
24-
customField: 'Custom result from simplified proxy',
25-
timestamp: new Date().toISOString(),
26-
};
27-
},
28-
});
29-
30-
// STEP 2: Return agent.run result directly
31-
const step2Result = await workflow.step({
32-
id: 'return-agent-run-directly',
33-
run: async () => {
34-
// Call Langbase API and return the result directly
35-
return langbase.agent.run({
36-
model: 'openai:gpt-4o-mini',
37-
apiKey: process.env.OPENAI_API_KEY!,
38-
instructions: 'Be brief and concise.',
39-
input: 'What is 2+2?',
40-
stream: false,
41-
});
42-
},
43-
});
44-
45-
// STEP 3: Make multiple Langbase calls in one step
46-
const step3Result = await workflow.step({
47-
id: 'multiple-calls',
48-
run: async () => {
49-
// First call
50-
const call1 = await langbase.agent.run({
51-
model: 'openai:gpt-4o-mini',
52-
apiKey: process.env.OPENAI_API_KEY!,
53-
instructions: 'Be brief.',
54-
input: 'First proxy test',
55-
stream: false,
56-
});
57-
58-
// Second call with different method
59-
const call2 = await langbase.agent.run({
60-
model: 'openai:gpt-4o-mini',
61-
apiKey: process.env.OPENAI_API_KEY!,
62-
instructions: 'Be brief.',
63-
input: 'Second proxy test',
64-
stream: false,
65-
});
66-
67-
// Return combined result
68-
return {
69-
summary: 'Multiple calls completed with simplified proxy',
70-
calls: 2,
71-
firstOutput: call1.output,
72-
secondOutput: call2.output,
73-
};
74-
},
75-
});
76-
} catch (error) {
77-
console.error('❌ Workflow error:', error);
78-
} finally {
79-
// End the workflow to show trace report
80-
workflow.end();
81-
}
37+
console.log(result['completion']);
8238
}
8339

84-
// Run the test
85-
main().catch(console.error);
40+
main();

packages/langbase/src/common/request.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,6 @@ export class Request {
6262
const isLllmGenerationEndpoint =
6363
GENERATION_ENDPOINTS.includes(endpoint);
6464

65-
// All endpoints should return headers if rawResponse is true
66-
if (!isLllmGenerationEndpoint && options.body?.rawResponse) {
67-
const responseData = await response.json();
68-
return {
69-
...responseData,
70-
rawResponse: {
71-
headers: Object.fromEntries(response.headers.entries()),
72-
},
73-
} as T;
74-
}
75-
7665
if (isLllmGenerationEndpoint) {
7766
const threadId = response.headers.get('lb-thread-id');
7867

packages/langbase/src/langbase/langbase.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {convertDocToFormData} from '@/lib/utils/doc-to-formdata';
22
import {Request} from '../common/request';
3-
import {Workflow} from './workflows';
43

54
export type Role = 'user' | 'assistant' | 'system' | 'tool';
65

@@ -640,12 +639,6 @@ export class Langbase {
640639
};
641640
};
642641

643-
public workflow: (config: {debug?: boolean; name: string}) => Workflow;
644-
645-
public traces: {
646-
create: (trace: any) => Promise<any>;
647-
};
648-
649642
constructor(options?: LangbaseOptions) {
650643
this.baseUrl = options?.baseUrl ?? 'https://api.langbase.com';
651644
this.apiKey = options?.apiKey ?? '';
@@ -730,12 +723,6 @@ export class Langbase {
730723
this.agent = {
731724
run: this.runAgent.bind(this),
732725
};
733-
734-
this.workflow = config => new Workflow({...config, langbase: this});
735-
736-
this.traces = {
737-
create: this.createTrace.bind(this),
738-
};
739726
}
740727

741728
private async runPipe(
@@ -1159,17 +1146,4 @@ export class Langbase {
11591146
},
11601147
});
11611148
}
1162-
1163-
/**
1164-
* Creates a new trace on Langbase.
1165-
*
1166-
* @param {any} trace - The trace data to send.
1167-
* @returns {Promise<any>} A promise that resolves to the response of the trace creation.
1168-
*/
1169-
private async createTrace(trace: any): Promise<any> {
1170-
return this.request.post({
1171-
endpoint: '/v1/traces',
1172-
body: trace,
1173-
});
1174-
}
11751149
}

packages/langbase/src/langbase/trace.ts

Lines changed: 0 additions & 133 deletions
This file was deleted.

0 commit comments

Comments
 (0)