SiliconFlow

Use SiliconFlow models with Kern agents.

Siliconflow is a platform for providing endpoints for Large Language models.

Explore Siliconflow’s models here.

Authentication

Set your SILICONFLOW_API_KEY environment variable. Get your key from Siliconflow here.

1export SILICONFLOW_API_KEY=***
1setx SILICONFLOW_API_KEY ***

Example

Use Siliconflow with your Agent:

1from kern.agent import Agent
2from kern.models.siliconflow import Siliconflow
3
4agent = Agent(model=Siliconflow(), markdown=True)
5
6# Print the response in the terminal
7agent.print_response("Share a 2 sentence horror story")
Note View more examples here.

Params

ParameterTypeDefaultDescription
idstr"meta-llama/Meta-Llama-3.1-8B-Instruct"The id of the SiliconFlow model to use
namestr"SiliconFlow"The name of the model
providerstr"SiliconFlow"The provider of the model
api_keyOptional[str]NoneThe API key for SiliconFlow (defaults to SILICONFLOW_API_KEY env var)
base_urlstr"https://api.siliconflow.cn/v1"The base URL for the SiliconFlow API

Siliconflow also supports the params of OpenAI.