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

Add Context Support to Chat Requests #14839

Open
planger opened this issue Feb 4, 2025 · 0 comments · May be fixed by #14787
Open

Add Context Support to Chat Requests #14839

planger opened this issue Feb 4, 2025 · 0 comments · May be fixed by #14787
Assignees
Labels

Comments

@planger
Copy link
Contributor

planger commented Feb 4, 2025

Users need a way to specify additional context, such as files, symbols, or other relevant data, when submitting chat requests without having to add them directly into the user input message. This allows chat agents to incorporate this additional context more flexibly in comparison to having all context as part of the user message and can determine themselves how they process the provided context.

Key Features

  • Context Elements: Enable extending the chat request with separate context elements without adding them directly to the chat request.
  • Separation of concerns: Large context elements can be included without entangling them in the user’s message.
  • Flexible processing strategies: Agents can use different techniques, such as summarizing or fetching context on demand.
  • Persistent context: The context can remain stable across multiple requests within a conversation without having to re-add them.
  • UI Enhancements:
    • Display a list of added context elements in the chat input.
    • Users can add context via a + button (quick pick) or by typing # (auto-completion).

Add a #file support as an example and use case driver to allow users attaching file contents to their requests.

@planger planger added the TheiaAI label Feb 4, 2025
planger added a commit that referenced this issue Feb 4, 2025
This PR introduces support for adding context elements (e.g., files, symbols, or variables) to chat requests,
allowing chat agents to leverage additional context without embedding it directly in user input.

- Extended the existing *variable* concept with `AIContextVariable`.
- Context variables can provide a dedicated `contextValue` that agents can use separately from the chat request text.
- Context variables can be included in chat requests in two ways:
  1. Providing `AIVariableResolutionRequest` alongside the `ChatRequest`.
  2. Mentioning a context variable directly in the chat request text (e.g., `#file:abc.txt`).

- Extended the chat input widget to display and manage context variables.
- Users can add context variables via:
  1. A `+` button, opening a quick pick list of available context variables.
  2. Typing a context variable (`#` prefix), with auto-completion support.
- Theia’s label provider is used to display context variables in a user-friendly format.

- Enhanced support for variable arguments when adding context variables via the UI.
- Introduced:
  - `AIVariableArgPicker` for UI-based argument selection.
  - `AIVariableArgCompletionProvider` for auto-completion of variable arguments.
- Added a new context variable `#file` that accepts a file path as an argument.
- Refactored `QuickFileSelectService` for consistent file path selection across argument pickers and completion providers.

- `ChatService` now resolves context variables and attaches `ResolvedAIContextVariable` objects to `ChatRequestModel`.
- Variables can both:
  - Replace occurrences in chat text (`ResolvedAIVariable.value`).
  - Provide a separate `contextValue` for the chat model.

Fixes #14839
@planger planger self-assigned this Feb 4, 2025
@planger planger changed the title Add Context Support to Chat Requests Enable Context Variables for Chat Requests Feb 4, 2025
@planger planger linked a pull request Feb 4, 2025 that will close this issue
2 tasks
@planger planger changed the title Enable Context Variables for Chat Requests Add Context Support to Chat Requests Feb 4, 2025
planger added a commit that referenced this issue Feb 11, 2025
This PR introduces support for adding context elements (e.g., files, symbols, or variables) to chat requests,
allowing chat agents to leverage additional context without embedding it directly in user input.

- Extended the existing *variable* concept with `AIContextVariable`.
- Context variables can provide a dedicated `contextValue` that agents can use separately from the chat request text.
- Context variables can be included in chat requests in two ways:
  1. Providing `AIVariableResolutionRequest` alongside the `ChatRequest`.
  2. Mentioning a context variable directly in the chat request text (e.g., `#file:abc.txt`).

- Extended the chat input widget to display and manage context variables.
- Users can add context variables via:
  1. A `+` button, opening a quick pick list of available context variables.
  2. Typing a context variable (`#` prefix), with auto-completion support.
- Theia’s label provider is used to display context variables in a user-friendly format.

- Enhanced support for variable arguments when adding context variables via the UI.
- Introduced:
  - `AIVariableArgPicker` for UI-based argument selection.
  - `AIVariableArgCompletionProvider` for auto-completion of variable arguments.
- Added a new context variable `#file` that accepts a file path as an argument.
- Refactored `QuickFileSelectService` for consistent file path selection across argument pickers and completion providers.

- `ChatService` now resolves context variables and attaches `ResolvedAIContextVariable` objects to `ChatRequestModel`.
- Variables can both:
  - Replace occurrences in chat text (`ResolvedAIVariable.value`).
  - Provide a separate `contextValue` for the chat model.

Fixes #14839
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant