File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed 
examples/ai-core/src/stream-object Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 11import  {  anthropic  }  from  '@ai-sdk/anthropic' ; 
22import  {  streamObject  }  from  'ai' ; 
3- import  'dotenv/config' ; 
43import  {  z  }  from  'zod' ; 
54
6- async  function  main ( )  { 
5+ import  {  run  }  from  '../lib/run' ; 
6+ 
7+ run ( async  ( )  =>  { 
78  const  result  =  streamObject ( { 
89    model : anthropic ( 'claude-sonnet-4-20250514' ) , 
910    maxOutputTokens : 5000 , 
@@ -20,16 +21,13 @@ async function main() {
2021    } ) , 
2122    prompt :
2223      'Generate 3 character descriptions for a fantasy role playing game.' , 
23-     onError :  err   =>  { 
24-       console . error ( err ) ; 
24+     headers :  { 
25+       'anthropic-beta' :  'fine-grained-tool-streaming-2025-05-14' , 
2526    } , 
26-     temperature : 0 , 
2727  } ) ; 
2828
2929  for  await  ( const  partialObject  of  result . partialObjectStream )  { 
3030    console . clear ( ) ; 
3131    console . log ( partialObject ) ; 
3232  } 
33- } 
34- 
35- main ( ) . catch ( console . error ) ; 
33+ } ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments