
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
AGI Open Network China Models - A Simple and Powerful Framework for Chinese AI Models
A simple yet powerful framework for accessing Chinese AI models. Currently supports the full range of SiliconFlow models, with plans to support more Chinese AI service providers in the future.
pip install agi-open-network-cn
from agi_open_network_cn import (
SiliconFlowClient,
SiliconFlowChatModel,
SiliconFlowImageModel,
SiliconFlowAudioModel,
)
# Initialize client
client = SiliconFlowClient(api_key="your-api-key")
# Use ChatGLM
chat_model = SiliconFlowChatModel(client, model_name="chatglm-turbo")
response = chat_model.simple_chat("Tell me about ChatGLM")
print(response)
# Use Stable Diffusion to generate images
image_model = SiliconFlowImageModel(client)
image_url = image_model.simple_generate("A cute Chinese dragon")
print(image_url)
# Speech to text
audio_model = SiliconFlowAudioModel(client)
text = audio_model.simple_transcribe("speech.mp3")
print(text)
# Using advanced parameters
response = chat_model.chat(
messages=[
{"role": "system", "content": "You are a professional Python teacher"},
{"role": "user", "content": "Explain decorators"},
],
temperature=0.7,
max_tokens=2000,
top_p=0.9,
)
# Batch image generation
prompts = [
"Chinese ink painting: Mountains and waters",
"Chinese ink painting: Plum blossoms",
"Chinese ink painting: Bamboo",
]
for prompt in prompts:
image_url = image_model.simple_generate(prompt)
print(f"{prompt}: {image_url}")
from agi_open_network_cn import SiliconFlowVideoModel
video_model = SiliconFlowVideoModel(client)
response = video_model.generate("A video showcasing Chinese traditional culture")
request_id = response["request_id"]
# Poll for results
while True:
status = video_model.get_status(request_id)
if status["status"] == "completed":
print(f"Video URL: {status['url']}")
break
time.sleep(10)
from agi_open_network_cn.exceptions import AGIOpenNetworkError
try:
response = chat_model.simple_chat("Hello")
except AGIOpenNetworkError as e:
print(f"Error occurred: {e}")
We welcome all forms of contributions, including but not limited to:
MIT License
FAQs
AGI Open Network China Models - A Simple and Powerful Framework for Chinese AI Models
We found that agi-open-network-cn demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.