micro--go-micro
beeaad748e
* feat: add LlamaIndex SDK for Go Micro services Add LlamaIndex integration package that enables LlamaIndex agents to discover and call Go Micro microservices through the MCP gateway. Follows the same pattern as the existing LangChain SDK. - GoMicroToolkit with from_gateway() factory and tool filtering - FunctionTool integration via llama_index.core.tools - Auth support, error handling, and retry configuration - Examples for basic agent and RAG + microservices workflows - Unit tests with mocked gateway responses https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * docs: update status for OTel, WebSocket, and LlamaIndex SDK completion Reflect recently completed work in roadmap and status documents: - Q2 progress: 85% -> 95% (WebSocket, LlamaIndex SDK done) - Q3 progress: 40% -> 50% (OpenTelemetry integration done) - Transports: 2 -> 3 (added WebSocket) - Agent SDKs: 1 -> 2 (added LlamaIndex) - Test coverage: 568 -> 1,000+ lines https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: add WithMCP convenience option, improve startup banner, and blog post - Add mcp.WithMCP(":3000") service option for one-line MCP setup - Improve `micro run` startup banner to show Agent playground, MCP tools, and WebSocket endpoints prominently - Add blog post: "Building the AI-Native Future of Go Micro with Claude" covering WebSocket transport, OTel integration, LlamaIndex SDK, and Anthropic's Claude Max sponsorship - Update blog index and navigation links https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc --------- Co-authored-by: Claude <noreply@anthropic.com>
45 行
1.3 KiB
Python
45 行
1.3 KiB
Python
"""Basic LlamaIndex agent example using Go Micro services.
|
|
|
|
This example shows how to create a simple LlamaIndex agent that can
|
|
interact with Go Micro services through the MCP gateway.
|
|
"""
|
|
|
|
from go_micro_llamaindex import GoMicroToolkit
|
|
from llama_index.core.agent import ReActAgent
|
|
from llama_index.llms.openai import OpenAI
|
|
|
|
|
|
def main():
|
|
"""Run basic agent example."""
|
|
# Initialize toolkit from MCP gateway
|
|
print("Connecting to MCP gateway...")
|
|
toolkit = GoMicroToolkit.from_gateway("http://localhost:3000")
|
|
|
|
# Get available tools
|
|
tools = toolkit.get_tools()
|
|
print(f"\nDiscovered {len(tools)} tools:")
|
|
for tool in tools:
|
|
print(f" - {tool.metadata.name}: {tool.metadata.description}")
|
|
|
|
# Create LlamaIndex ReAct agent
|
|
print("\nCreating LlamaIndex agent...")
|
|
llm = OpenAI(model="gpt-4", temperature=0)
|
|
agent = ReActAgent.from_tools(tools, llm=llm, verbose=True)
|
|
|
|
# Example queries
|
|
queries = [
|
|
"Create a user named Alice with email alice@example.com",
|
|
"Get the user we just created",
|
|
]
|
|
|
|
for query in queries:
|
|
print(f"\n{'='*60}")
|
|
print(f"Query: {query}")
|
|
print("=" * 60)
|
|
response = agent.chat(query)
|
|
print(f"\nResult: {response}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|