- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 451
 
Improve attachments workflow #1485
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
          
     Draft
      
      
            joadoumie
  wants to merge
  16
  commits into
  jupyterlab:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
joadoumie:improve-attachments-workflow
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Draft
            
            Improve attachments workflow #1485
                    joadoumie
  wants to merge
  16
  commits into
  jupyterlab:main
from
joadoumie:improve-attachments-workflow
  
      
      
   
              
            Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    This commit adds workspace directory awareness to tools (bash and search_grep) by creating a dynamic toolkit that binds the workspace directory to tool calls. Also updates the system prompt to guide the LLM on when to use these tools. Note: This version has a bug where tool call UI is not displaying properly. Saving this commit to preserve the directional changes before reverting.
The id attribute is a reserved HTML attribute and was not being properly passed to the React component when used in web components. This caused the tool call UI to not display because the component returned null when props.id was undefined. Changed all instances of id to tool_id in: - toolcall_list.py: Changed prop key from "id" to "tool_id" - types.py: Updated JaiToolCallProps type definition - web-components-plugin.ts: Updated prop declaration and allowed attributes - jai-tool-call.tsx: Updated TypeScript interface and usage
Added cwd parameter to read, edit, and write tools to support relative file paths. The tools now resolve relative paths against the workspace directory, allowing the LLM to reference files without absolute paths. Changes: - Added cwd parameter to read(), edit(), and write() in default_toolkit.py - Updated _build_toolkit() to use functools.partial with a helper function - Replaced verbose wrapper functions with cleaner partial binding approach - All file tools now receive workspace directory context automatically
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
WIP Draft - Exploration
This is definitely a work in progress and based off of some of the really cool incoming changes with #1479.
My goal was to move away from an attachment flow where the entire context of a file is injected into the prompt and rely on some of the tools that are being introduced in #1479.
Description
This PR builds on top of the tool calling implementation to improve the attachments workflow by not including the full file context but rather relying on the agentic capabilities of Jupyternaut
Relates to discussions in the original file attachment PR -- #1419
Code changes
1. Fix tool call UI display bug (c1468ff)
idtotool_idacross the tool call components -- I don't know that this was necessary but I could not get the UI to work properly otherwise.idattribute is a reserved HTML attribute that doesn't properly pass through web components to React props? Not sure this is true either, but again this worked for me for testing this flow.toolcall_list.py,types.py,web-components-plugin.ts, andjai-tool-call.tsx2. Add workspace directory context to file tools (f51c847 + 9211dd3)
cwdparameter toread(),edit(), andwrite()tools indefault_toolkit.pyJupyternautPersona._build_toolkit()to create a context-aware toolkit usingfunctools.partialbind_cwd()helper function that preserves__name__and__doc__attributes for LiteLLM compatibilityUser-facing changes
Improved file handling with attachments
example.txt, the assistant can now successfully read/edit/write them using just the filenameBackwards-incompatible changes
None. The
cwdparameter is optional and defaults toNone, maintaining backwards compatibility with existing code that passes absolute paths.