Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ai.ancf.lmos:lmos-router-core
Advanced tools
Efficient Agent Routing with SOTA Language and Embedding Models.
This quickstart guide will help you set up and use the agent routing system. Follow the steps below to get started.
First, download lmos-router dependency from maven central
implementation("ai.ancf.lmos:lmos-router-llm:x.y.z")
then create the agent routing specifications using SimpleAgentRoutingSpecProvider
and AgentRoutingSpecBuilder
.
val agentRoutingSpecsProvider = SimpleAgentRoutingSpecProvider()
.add(
AgentRoutingSpecBuilder()
.name("offer-agent")
.description("This agent is responsible for offer management")
.version("1.0.0")
.address(Address(uri = "/agents/offer-agent"))
.build()
)
.add(
AgentRoutingSpecBuilder()
.name("service-agent")
.description("This agent is responsible for service management")
.version("1.0.0")
.address(Address(uri = "/agents/service-agent"))
.build()
)
Next, initialize the LLMAgentRoutingSpecsResolver
with the agentRoutingSpecsProvider
.
val agentRoutingSpecResolver = LLMAgentRoutingSpecsResolver(
agentRoutingSpecsProvider,
modelClient = DefaultModelClient(
DefaultModelClientProperties(openAiApiKey = "your-openai-api-key") //Defaults to System.getenv("OPENAI_API_KEY")
)
)
Set up the context and input messages that will be used to resolve the appropriate agent.
val context = Context(listOf(AssistantMessage("Hello")))
val input = UserMessage("Can you help me find a new phone?")
Finally, use the agentRoutingSpecResolver
to resolve the appropriate agent based on the context and input messages.
val result = agentRoutingSpecResolver.resolve(context, input)
The result
should return offer-agent
, indicating that the "offer-agent" is responsible for handling the user's request. Now you can use the address uri to route the user to the appropriate agent.
For spring cloud gateway, refer to the Demo.
This project routes user queries to the most suitable agent based on their capabilities using Language Model (LLM), Vector-based approaches, and a new Hybrid approach.
The Intelligent Agent Routing System directs user queries to the best-suited agent based on their capabilities using three methods:
Uses advanced language models like OpenAI's GPT-3.5 to understand the context and semantics of user queries.
Pros:
Cons:
Uses vector embeddings to represent queries and agent capabilities, comparing them using cosine similarity.
Pros:
Cons:
Extracts abstract requirements from the query using an LLM and then searches for an agent using semantic similarity.
Pros:
Cons:
Feature | LLM-Based Approach | Vector-Based Approach | Hybrid Approach |
---|---|---|---|
Contextual Understanding | High | Moderate | High |
Flexibility | High | Moderate | High |
Efficiency | Moderate | High | High |
Scalability | Moderate | High | High |
Cost | High | Low | High |
Latency | Higher | Lower | High |
Dependency | High | Low | High |
Setup Complexity | Low | High | High |
Maintenance | Low | High | High |
Contains foundational classes and interfaces:
Handles agent routing specifications using a language model:
Handles agent routing specifications using vector embeddings:
Combines LLM and vector-based approaches:
Spring Boot starter for the LLM-based agent routing system:
Spring Boot starter for the Vector-based agent routing system:
Spring Boot starter for the Hybrid-based agent routing system:
Sample Spring Boot application demonstrating the system:
Evaluates the performance of the LLM-based, Vector-based, and Hybrid resolvers:
Refer to the Benchmarks for detailed instructions.
The benchmarks include confusion matrices and accuracy metrics for all methods.
You can download the dependencies from maven central by adding the following dependencies to your project:
implementation("ai.ancf.lmos:lmos-router-llm-spring-boot-starter:x.y.z")
Or using Maven:
<dependency>
<groupId>ai.ancf.lmos</groupId>
<artifactId>lmos-router-llm-spring-boot-starter</artifactId>
<version>x.y.z</version>
</dependency>
implementation("ai.ancf.lmos:lmos-router-vector-spring-boot-starter:x.y.z")
Or using Maven:
<dependency>
<groupId>ai.ancf.lmos</groupId>
<artifactId>lmos-router-vector-spring-boot-starter</artifactId>
<version>x.y.z</version>
</dependency>
implementation("ai.ancf.lmos:lmos-router-hybrid-spring-boot-starter:x.y.z")
Or using Maven:
<dependency>
<groupId>ai.ancf.lmos</groupId>
<artifactId>lmos-router-hybrid-spring-boot-starter</artifactId>
<version>x.y.z</version>
</dependency>
If you are not using Spring Boot, you can add the following dependencies:
implementation("ai.ancf.lmos:lmos-router-llm:x.y.z")
implementation("ai.ancf.lmos:lmos-router-vector:x.y.z")
implementation("ai.ancf.lmos:lmos-router-hybrid:x.y.z")
or you can build the project from source:
git clone https://github.com/lmos-ai/lmos-router.git
cd lmos-router
Set environment variables: (If running Flow tests, they can be enabled by setting gradle project property runFlowTests=true
)
OPENAI_API_KEY
: Your OpenAI API key.VECTOR_SEED_JSON_FILE_PATH
: Path to the JSON file containing seed vectors.Build the project:
./gradlew build
To run the demo:
Refer to the Demo for detailed instructions.
Contributions are welcome! Please read the contributing guidelines for more information.
This project has adopted the Contributor Covenant in version 2.1 as our code of conduct. Please see the details in our CodeOfConduct.md. All contributors must abide by the code of conduct.
By participating in this project, you agree to abide by its Code of Conduct at all times.
Copyright (c) 2024 Deutsche Telekom AG.
Sourcecode licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License.
This project follows the REUSE standard for software licensing.
Each file contains copyright and license information, and license texts can be found in the ./LICENSES folder. For more information visit https://reuse.software/.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the LICENSE for the specific language governing permissions and limitations under the License.
FAQs
Efficient Agent Routing with SOTA Language and Embedding Models.
We found that ai.ancf.lmos:lmos-router-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.