Skip to content

Repository files navigation

Alibaba Cloud Tongyi Qwen and LangChain Conversation Service Terraform Module

terraform-alicloud-tongyi-langchain

English | 简体中文

Terraform module which creates a complete conversation service infrastructure with Tongyi Qwen and LangChain on Alibaba Cloud. This module implements the solution for Building a conversation service with Qwen and LangChain, which involves the creation and deployment of resources such as PAI-EAS, Virtual Private Cloud (VPC), VSwitch, and File Storage NAS.

Usage

This module creates a comprehensive AI conversation service infrastructure including PAI-EAS service, networking components, and file storage. You can use this module to quickly deploy a production-ready conversation service based on Tongyi Qwen and LangChain.

module "tongyi_langchain" {
  source = "alibabacloud-automation/tongyi-langchain/alicloud"

  vswitch_config = {
    zone_id    = "cn-hangzhou-f"
    cidr_block = "192.168.0.0/24"
  }

  nas_file_system_config = {
    zone_id = "cn-hangzhou-f"
  }
}

Examples

Requirements

Name Version
terraform >= 1.0

Providers

Name Version
alicloud n/a

Modules

No modules.

Resources

Name Type
alicloud_nas_access_group.nas_access_group resource
alicloud_nas_access_rule.nas_access_rule resource
alicloud_nas_file_system.nas_file_system resource
alicloud_nas_mount_target.nas_mount_target resource
alicloud_pai_service.pai_eas resource
alicloud_security_group.security_group resource
alicloud_security_group_rule.security_group_rules resource
alicloud_vpc.vpc resource
alicloud_vswitch.vswitch resource
alicloud_regions.current data source

Inputs

Name Description Type Default Required
common_name_prefix Common name prefix for all resources string "tongyi-langchain" no
nas_access_group_config Configuration for NAS Access Group.
object({
access_group_type = optional(string, "Vpc")
access_group_name = optional(string, "nas-access-group-qwen-demo")
})
{} no
nas_access_rule_config Configuration for NAS Access Rule.
object({
source_cidr_ip = optional(string, "0.0.0.0/0")
})
{} no
nas_file_system_config Configuration for NAS File System. The attribute 'zone_id' is required.
object({
protocol_type = optional(string, "NFS")
file_system_type = optional(string, "standard")
storage_type = optional(string, "Performance")
zone_id = string
description = optional(string, "NAS file system for Qwen and LangChain conversation model")
})
n/a yes
nas_mount_target_config Configuration for NAS Mount Target.
object({
network_type = optional(string, "Vpc")
})
{} no
pai_service_config Configuration for PAI-EAS service.
object({
name = optional(string, "qwen-langchain-service")
instance_count = optional(number, 1)
cpu = optional(number, 8)
gpu = optional(number, 1)
memory = optional(number, 30000)
instance_type = optional(string, "ml.gu7i.c8m30.1-gu30")
enable_webservice = optional(bool, true)
create_timeout = optional(string, "20m")
container_image = optional(string, "eas-registry-vpc.{region}.cr.aliyuncs.com/pai-eas/chat-llm-webui:2.1")
container_port = optional(number, 8000)
model_path = optional(string, "Qwen/Qwen-7B-Chat")
})
{} no
security_group_config Configuration for Security Group.
object({
security_group_name = optional(string, "sg_qwen_demo")
security_group_type = optional(string, "normal")
})
{} no
security_group_rules Map of security group rules configuration.
map(object({
type = string
ip_protocol = string
nic_type = string
policy = string
port_range = string
priority = number
cidr_ip = string
}))
{
"allow_http": {
"cidr_ip": "0.0.0.0/0",
"ip_protocol": "tcp",
"nic_type": "intranet",
"policy": "accept",
"port_range": "80/80",
"priority": 1,
"type": "ingress"
},
"allow_https": {
"cidr_ip": "0.0.0.0/0",
"ip_protocol": "tcp",
"nic_type": "intranet",
"policy": "accept",
"port_range": "443/443",
"priority": 1,
"type": "ingress"
},
"allow_rdp": {
"cidr_ip": "0.0.0.0/0",
"ip_protocol": "tcp",
"nic_type": "intranet",
"policy": "accept",
"port_range": "3389/3389",
"priority": 1,
"type": "ingress"
}
}
no
vpc_config Configuration for VPC. The attribute 'cidr_block' is required.
object({
cidr_block = string
vpc_name = optional(string, "vpc_qwen_demo")
})
{
"cidr_block": "192.168.0.0/16"
}
no
vswitch_config Configuration for VSwitch. The attributes 'zone_id' and 'cidr_block' are required.
object({
zone_id = string
cidr_block = string
vswitch_name = optional(string, "vswitch_qwen_demo")
})
n/a yes

Outputs

Name Description
create_time The creation time of the PAI-EAS service
nas_file_system_id The ID of the NAS file system
nas_mount_target_domain The domain name of the NAS mount target
pai_service_id The ID of the PAI-EAS service
region_id The ID of the deployment region
security_group_id The ID of the security group
service_name The name of the PAI-EAS service
service_status The status of the PAI-EAS service
vpc_id The ID of the VPC
vswitch_id The ID of the VSwitch

Submit Issues

If you have any problems when using this module, please opening a provider issue and let us know.

Note: There does not recommend opening an issue on this repo.

Authors

Created and maintained by Alibaba Cloud Terraform Team(terraform@alibabacloud.com).

License

MIT Licensed. See LICENSE for full details.

Reference