Server info
Retrieve metadata about the running server, including its binary version and type (DB, AI, or Hybrid).
Every operation works on both Vector DB stores (you supply raw vectors) and AI stores (you supply text or images and Ahnlich AI generates the embeddings for you). Use the Vector DB / AI switch in the sample below.
Parameters
This request takes no arguments.
Behavior
- The server responds with version and type metadata.
- Use it to validate you're connected to the correct server role — useful for environment checks, feature gating, and diagnostics.
Sample query
- Database engine
- AI proxy
- Python
- Node.js
- Go
- Rust
- CLI
Python
import asyncio
from grpclib.client import Channel
from ahnlich_client_py.grpc.services.db_service import DbServiceStub
from ahnlich_client_py.grpc.db import query as db_query
from ahnlich_client_py.grpc.server_types import ServerType
async def info_server():
"""Test server version"""
async with Channel(host="127.0.0.1", port=1369) as channel:
client = DbServiceStub(channel)
response = await client.info_server(db_query.InfoServer())
# response contains server version and type
print(f"Server version: {response.info.version}")
if __name__ == "__main__":
asyncio.run(info_server())
TypeScript
import { createDbClient } from "ahnlich-client-node";
import { InfoServer } from "ahnlich-client-node/grpc/db/query_pb";
async function infoServer() {
const client = createDbClient("127.0.0.1:1369");
const response = await client.infoServer(new InfoServer());
console.log(response.info?.version); // Server version
console.log(response.info?.address); // Server address
console.log(response.info?.numStores); // Number of stores
}
infoServer();
Go
package main
import (
"context"
"fmt"
"log"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
dbsvc "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/services/db_service"
dbquery "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/db/query"
)
const ServerAddr = "127.0.0.1:1369"
type ExampleDBClient struct {
conn *grpc.ClientConn
client dbsvc.DBServiceClient
ctx context.Context
}
func NewDBClient(ctx context.Context) (*ExampleDBClient, error) {
conn, err := grpc.NewClient(ServerAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, fmt.Errorf("failed to dial DB server %q: %w", ServerAddr, err)
}
client := dbsvc.NewDBServiceClient(conn)
return &ExampleDBClient{conn: conn, client: client, ctx: ctx}, nil
}
func (c *ExampleDBClient) Close() error { return c.conn.Close() }
// InfoServer example
func (c *ExampleDBClient) exampleInfoServer() error {
resp, err := c.client.InfoServer(c.ctx, &dbquery.InfoServer{})
if err != nil {
return err
}
fmt.Println("InfoServer:", resp)
return nil
}
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client, err := NewDBClient(ctx)
if err != nil {
log.Fatalf("Failed to create DB client: %v", err)
}
defer client.Close()
if err := client.exampleInfoServer(); err != nil {
log.Fatalf("InfoServer failed: %v", err)
}
}
Rust
use ahnlich_client_rs::db::DbClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Connect to your ahnlich-db server
let db_client = DbClient::new("127.0.0.1:1369".to_string()).await?;
let tracing_id: Option<String> = None;
// Call info_server and print the result
let info = db_client.info_server(tracing_id).await?;
println!("Server info: {:?}", info);
Ok(())
}
INFOSERVER- Python
- Node.js
- Go
- Rust
- CLI
Python
import asyncio
from grpclib.client import Channel
from ahnlich_client_py.grpc.services.ai_service import AiServiceStub
from ahnlich_client_py.grpc.ai import query as ai_query
async def info_server():
async with Channel(host="127.0.0.1", port=1370) as channel:
client = AiServiceStub(channel)
response = await client.info_server(ai_query.InfoServer())
print(response) #InfoServer(info=ServerInfo(address='Ok(0.0.0.0:1370)', version='0.1.0', limit=10073741824, remaining=10067931251))
if __name__ == "__main__":
asyncio.run(info_server())
TypeScript
import { createAiClient } from "ahnlich-client-node";
import { InfoServer } from "ahnlich-client-node/grpc/ai/query_pb";
async function infoServer() {
const client = createAiClient("127.0.0.1:1370");
const response = await client.infoServer(new InfoServer());
console.log(response.info?.version);
}
infoServer();
Go
package main
import (
"context"
"fmt"
"log"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
aiquery "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/ai/query"
aisvc "github.com/deven96/ahnlich/sdk/ahnlich-client-go/grpc/services/ai_service"
)
const AIAddr = "127.0.0.1:1370"
// ExampleAIClient holds the gRPC connection and AI client.
type ExampleAIClient struct {
conn *grpc.ClientConn
client aisvc.AIServiceClient
ctx context.Context
}
// NewAIClient connects to the AI server and returns a client.
func NewAIClient(ctx context.Context) (*ExampleAIClient, error) {
conn, err := grpc.DialContext(ctx, AIAddr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
if err != nil {
return nil, fmt.Errorf("failed to dial AI server %q: %w", AIAddr, err)
}
client := aisvc.NewAIServiceClient(conn)
return &ExampleAIClient{conn: conn, client: client, ctx: ctx}, nil
}
// Close closes the gRPC connection.
func (c *ExampleAIClient) Close() error {
return c.conn.Close()
}
// ---- InfoServer Example ----
// Retrieve server information such as address, version, limits.
func (c *ExampleAIClient) exampleInfoServerAI() error {
resp, err := c.client.InfoServer(c.ctx, &aiquery.InfoServer{})
if err != nil {
return err
}
fmt.Println(" AI InfoServer:", resp)
return nil
}
// ---- MAIN ----
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client, err := NewAIClient(ctx)
if err != nil {
log.Fatalf("Failed to create AI client: %v", err)
}
defer client.Close()
if err := client.exampleInfoServerAI(); err != nil {
log.Fatalf("InfoServer failed: %v", err)
}
}
Rust
use ahnlich_client_rs::ai::AiClient; // <-- note the `ai::` path
use ahnlich_client_rs::error::AhnlichError;
use ahnlich_types::shared::info::ServerInfo;
#[tokio::main]
async fn main() -> Result<(), AhnlichError> {
let addr = "127.0.0.1:1370";
let client = AiClient::new(addr.to_string()).await?;
// Direct info_server call
let server_info: ServerInfo = client.info_server(None).await?;
println!("Server Info: {:?}", server_info);
// Using pipeline
let mut pipeline = client.pipeline(None);
pipeline.info_server();
let pipeline_result = pipeline.exec().await?;
println!("Pipeline Server Info: {:?}", pipeline_result);
Ok(())
}
INFOSERVERResponse
Server metadata including version and type.