-
Notifications
You must be signed in to change notification settings - Fork 355
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
Implement context-aware agent functionality. #1394
Implement context-aware agent functionality. #1394
Conversation
🦋 Changeset detectedLatest commit: 67d2300 The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@llamaindex/autotool
@llamaindex/cloud
@llamaindex/community
@llamaindex/core
@llamaindex/env
@llamaindex/experimental
llamaindex
@llamaindex/wasm-tools
@llamaindex/anthropic
@llamaindex/clip
@llamaindex/deepinfra
@llamaindex/groq
@llamaindex/huggingface
@llamaindex/ollama
@llamaindex/openai
@llamaindex/portkey-ai
@llamaindex/replicate
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall LGTM, just need some type improve
3a2788f
to
23ae084
Compare
@himself65 About all the comments above. There’s a TypeScript error: I believe it’s currently impossible to implement this correctly with all the necessary types while extending base LLMAgent or AgentRunner classes. The simple approach that should work doesn’t function as intended in TypeScript, unfortunately. In latest version I have rewritten the code using a less general approach that works with OpenaiAgent and AnthropicAgent, along with some other workarounds, but without using 'any'. |
nice work |
- Add ContextAwareAgent mixin for retrieval capabilities for agents - Add contextAware openai agent and anthropic agent - Update agent guide about RAG with context aware agent example
d57deef
to
67d2300
Compare
Context-Aware Agent Implementation
This PR introduces context-awareness functionality for agents, inspired by the discussion in #1224.
Implementation:
withContextAwareness
mixin incontextAwareMixin.ts
OpenAIContextAwareAgent
andAnthropicContextAwareAgent
Motivation:
The goal is to allow agents to access indexed data without explicitly calling retriever tools, reducing latency in real-time scenarios especially with not so fast LMs. This approach is analogous to the ContextChatEngine, which automatically incorporates retriever data into the chat context.
Approach:
The implementation uses a mixin pattern to add context retrieval and injection capabilities to existing agent classes. This method allows for flexibility and easy extension to different agent types.
Feedback on the implementation approach and any potential improvements is welcome.
Just recreated branch and PR (old one: #1235) because of conflicts in prev version. All modules were moved to core after that PR was been created. So its easier to create a new one.