This example assumes using SiliconFlow; is in scope and apiKey contains your SiliconFlow API key.
1 2 3 4 5 6 7 8 9101112131415
varapiKey=Environment.GetEnvironmentVariable("SILICONFLOW_API_KEY")is{Length:>0}value?value:thrownewAssertInconclusiveException("SILICONFLOW_API_KEY environment variable is not found.");usingvarclient=newSiliconFlowClient(apiKey);// Create tools for reranking, image generation, model listing, and account info.varrerankTool=client.AsRerankTool();vartextToImageTool=client.AsTextToImageTool();varlistModelsTool=client.AsListModelsTool();vargetUserInfoTool=client.AsGetUserInfoTool();// These tools can be passed to any IChatClient that supports function calling.vartools=new[]{rerankTool,textToImageTool,listModelsTool,getUserInfoTool};