Skip to content

feat: add new generic AI communication model #15409

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

Merged
merged 1 commit into from
May 13, 2025

Conversation

sdirix
Copy link
Member

@sdirix sdirix commented Apr 6, 2025

What it does

Adds a new AI communication model for tracking raw LLM requests and
responses. Tracking is automated via the language-model-service.

This model serves as the foundation for:

  • Extracting communication history from Theia AI, allowing LLM testing
    without running the full Theia-based application
  • Replaying LLM communication without using an actual LLM, enabling
    deterministic integration tests
  • Removing the clunky communication recording service, making the
    ai-history package optional

Resolves #15221

Remaining tasks:

  • Integrate feedback regarding naming and recording of the communication model
  • Adapt History View UI
    • Track timestamps and response timestamps differently
    • Do not highlight all semantic requests
    • Show logged streamed responses in a nicer UI
  • Remove communication service, adapt all affected code and make ai-history package optional
    • Update changelog for breaking change

Moved the remaining tasks into a new PR (#15540) to make the PRs smaller.

How to test

Debug the language-model-service.

Alternatively you can check the follow up PR (#15540) to see the new model integrated in the AI History view.

Follow-ups

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Contributed on behalf of STMicroelectronics

Review checklist

Reminder for reviewers

@github-project-automation github-project-automation bot moved this to Waiting on reviewers in PR Backlog Apr 6, 2025
@sdirix sdirix force-pushed the communication-model branch from 1c27668 to a06f488 Compare April 6, 2025 20:11
@sdirix sdirix requested a review from planger April 6, 2025 20:18
Copy link
Contributor

@planger planger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much Stefan!

This looks already very good and it is great to get rid of the clunky manual recording and this should be a solid foundation to extract all sorts of useful data for testing, simulation, etc.

I was wondering how we reflect function calls? I don't see them being recorded at the moment, right?

The remaining comments I'd have are related to naming:

AiSession, AiSemanticRequest, AiRequest

I'm not sure "Ai" is a great prefix. Essentially it is a record of a LanguageModelRequest or session. Also I find the use of the term "Semantic" a bit unclear.

Here are a few ideas, instead of switching to a different prefix, like Ai, and avoiding "semantic":

  • AiSession -> RawLanguageModelSession or LanguageModelInteraction
  • AiSemanticRequest -> ClientRequest (the original request for tracing raw language model requests to a client event)
  • AiRequest -> RawLanguageModelRequest

Thank you!

@sdirix
Copy link
Member Author

sdirix commented Apr 22, 2025

I was wondering how we reflect function calls? I don't see them being recorded at the moment, right?

Tool Calls including their ids, parameters and result are recorded as part of the responses, see here.

The remaining comments I'd have are related to naming:

AiSession, AiSemanticRequest, AiRequest

I'm not sure "Ai" is a great prefix. Essentially it is a record of a LanguageModelRequest or session. Also I find the use of the term "Semantic" a bit unclear.

Here are a few ideas, instead of switching to a different prefix, like Ai, and avoiding "semantic":

  • AiSession -> RawLanguageModelSession or LanguageModelInteraction
  • AiSemanticRequest -> ClientRequest (the original request for tracing raw language model requests to a client event)
  • AiRequest -> RawLanguageModelRequest

With semantic request I wanted to express that it's representing what the user might think of a single request. I'll further think about the naming.

Thanks for the feedback!

@planger
Copy link
Contributor

planger commented Apr 22, 2025

With semantic request I wanted to express that it's representing what the user might think of a single request. I'll further think about the naming.

Thanks! Yes that makes a lot of sense to capture that. It could also be any client, such as a service though, right? Therefore I was leaning towards ClientRequest, but I'm really open to anything. I can also live with "semantic", but this term is a bit convoluted to me. :-)

Adds a new AI communication model for tracking raw LLM requests and
responses. Tracking is automated via the language-model-service.

This model serves as the foundation for:
- Extracting communication history from Theia AI, allowing LLM testing
  without running the full Theia-based application
- Replaying LLM communication without using an actual LLM, enabling
  deterministic integration tests
- Removing the clunky communication recording service, making the
  ai-history package optional

Resolves eclipse-theia#15221

Contributed on behalf of STMicroelectronics
@sdirix sdirix force-pushed the communication-model branch from a06f488 to 9bd59e9 Compare April 30, 2025 21:14
@sdirix sdirix marked this pull request as ready for review April 30, 2025 21:27
@sdirix
Copy link
Member Author

sdirix commented Apr 30, 2025

Hi @planger, Thanks for your input!

I adapted the naming a bit and split the PR into two PRs:

Please check whether you like it.

@sdirix sdirix requested a review from planger April 30, 2025 21:29
Copy link
Contributor

@planger planger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thank you! This looks very clean and useful to me. I tested it with #15540

/**
* An exchange unit representing a logical operation which may involve multiple model requests.
*/
export interface LanguageModelExchange {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nitpick: I am ok with LanguageModelExchange but I was wondering what you think about LanguageModelCompletion as a more direct term for what actually happens (i.e. an LLM request completion). Exchange sounds to me a bit bi-directional and not a perfect fit.

Copy link
Member Author

@sdirix sdirix May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exchange consists of request-response pairs, so it feels bidirectional to me. Personally I like "exchange" better than "completion". I would have never guessed that a "LanguageModelCompletion" is a set of request-response pairs, unrelated to "normal" LLM completion.

@github-project-automation github-project-automation bot moved this from Waiting on reviewers to Needs merge in PR Backlog May 12, 2025
@sdirix sdirix merged commit 6d1a4a1 into eclipse-theia:master May 13, 2025
9 of 11 checks passed
@github-project-automation github-project-automation bot moved this from Needs merge to Done in PR Backlog May 13, 2025
@sdirix sdirix deleted the communication-model branch May 13, 2025 07:42
@github-actions github-actions bot added this to the 1.62.0 milestone May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Generic LLM Interaction Model
2 participants