@@ -8,21 +8,19 @@ import (
88 "testing"
99 "time"
1010
11- "github.com/google/uuid"
1211 "github.com/tmc/langchaingo/llms"
1312 "github.com/tmc/langchaingo/llms/openai"
1413)
1514
1615func TestMain (m * testing.M ) {
16+
1717 m .Run ()
1818
1919}
2020func TestRun (t * testing.T ) {
2121 t .Run ("use with GenerateFromSinglePrompt" , func (t * testing.T ) {
22- t . Skip ()
22+
2323 // Create a new client
24- runId := uuid .New ().String ()
25- log .Println ("runId: " , runId )
2624 client := NewClient ("" )
2725 prompt := "The first man to walk on the moon"
2826 llm , err := openai .New ()
@@ -34,7 +32,6 @@ func TestRun(t *testing.T) {
3432 Name : "langsmithgo-chain" ,
3533 SessionName : "langsmithgo" ,
3634 RunType : Chain ,
37- RunID : runId ,
3835 Inputs : map [string ]interface {}{
3936 "prompt" : prompt ,
4037 },
@@ -55,7 +52,6 @@ func TestRun(t *testing.T) {
5552 }
5653
5754 err = client .Run (& RunPayload {
58- RunID : runId ,
5955 Outputs : map [string ]interface {}{
6056 "output" : completion ,
6157 },
@@ -69,9 +65,8 @@ func TestRun(t *testing.T) {
6965 })
7066
7167 t .Run ("use with Chain" , func (t * testing.T ) {
72- t . Skip ()
68+
7369 // Create a new client
74- runId := uuid .New ().String ()
7570 client := NewClient ("" )
7671
7772 opts := []openai.Option {
@@ -92,7 +87,6 @@ func TestRun(t *testing.T) {
9287 Name : "langsmithgo-llm" ,
9388 SessionName : "langsmithgo" ,
9489 RunType : LLM ,
95- RunID : runId ,
9690 Tags : []string {"llm" },
9791 Inputs : map [string ]interface {}{
9892 "prompt" : content , // Ensure 'output' is properly defined and is of type that has a String method
@@ -110,7 +104,6 @@ func TestRun(t *testing.T) {
110104 t .Errorf ("Error running: %v" , err )
111105 }
112106 err = client .Run (& RunPayload {
113- ParentID : runId ,
114107 Outputs : map [string ]interface {}{
115108 "output" : out ,
116109 },
@@ -124,9 +117,7 @@ func TestRun(t *testing.T) {
124117
125118 // use 2 chains
126119 t .Run ("use with 2 traces" , func (t * testing.T ) {
127- t .Skip ()
128120 // Create a new client
129- runId := uuid .New ().String ()
130121 client := NewClient ("" )
131122
132123 opts := []openai.Option {
@@ -149,7 +140,6 @@ func TestRun(t *testing.T) {
149140 Name : "langsmithgo-llm" ,
150141 SessionName : "langsmithgo" ,
151142 RunType : LLM ,
152- RunID : runId ,
153143 Tags : []string {"llm" },
154144 Inputs : map [string ]interface {}{
155145 "prompt" : content , // Ensure 'output' is properly defined and is of type that has a String method
@@ -169,20 +159,16 @@ func TestRun(t *testing.T) {
169159 }
170160
171161 err = client .Run (& RunPayload {
172- RunID : runId ,
173162 Outputs : map [string ]interface {}{
174163 "output" : out ,
175164 },
176165 })
177166
178- embdId := uuid .New ().String ()
179167 // create embedding
180168 err = client .Run (& RunPayload {
181169 Name : "langsmithgo-llm" ,
182170 SessionName : "langsmithgo" ,
183171 RunType : Embedding ,
184- RunID : embdId ,
185- ParentID : runId ,
186172 Tags : []string {"llm" },
187173 Inputs : map [string ]interface {}{
188174 "prompt" : out .Choices [0 ].Content , // Ensure 'output' is properly defined and is of type that has a String method
@@ -196,7 +182,6 @@ func TestRun(t *testing.T) {
196182 }
197183
198184 err = client .Run (& RunPayload {
199- RunID : embdId ,
200185 Outputs : map [string ]interface {}{
201186 "output" : embedings ,
202187 },
@@ -206,9 +191,8 @@ func TestRun(t *testing.T) {
206191
207192 t .Run ("use with 2 traces and SimpleRun" , func (t * testing.T ) {
208193 // Create a new client
209- runId := uuid .New ().String ()
210- client := NewClient (os .Getenv ("LANGSMITH_API_KEY" ))
211194
195+ client := NewClient (os .Getenv ("LANGSMITH_API_KEY" ))
212196 opts := []openai.Option {
213197 openai .WithModel ("gpt-3.5-turbo-0125" ),
214198 openai .WithEmbeddingModel ("text-embedding-3-large" ),
@@ -238,7 +222,6 @@ func TestRun(t *testing.T) {
238222 Name : "langsmithgo-llm" ,
239223 SessionName : "langsmithgo" ,
240224 RunType : LLM ,
241- RunID : runId ,
242225 Tags : []string {"llm" },
243226 StartTime : startTime ,
244227 Inputs : map [string ]interface {}{
@@ -258,9 +241,7 @@ func TestRun(t *testing.T) {
258241 t .Errorf ("Error running: %v" , err )
259242 }
260243
261- embdId := uuid .New ().String ()
262244 // create embedding
263-
264245 startTime = time .Now ().UTC ()
265246
266247 embedings , err := llm .CreateEmbedding (ctx , []string {"ola" , "mundo" })
@@ -273,8 +254,6 @@ func TestRun(t *testing.T) {
273254 SessionName : "langsmithgo" ,
274255 RunType : Embedding ,
275256 StartTime : startTime ,
276- RunID : embdId ,
277- ParentID : runId ,
278257 Tags : []string {"llm" },
279258 Inputs : map [string ]interface {}{
280259 "prompt" : out .Choices [0 ].Content , // Ensure 'output' is properly defined and is of type that has a String method
0 commit comments