Llama-2-13b-chat
开发环境
http://dev-cn.your-api-server.com
开发环境
http://dev-cn.your-api-server.com
POST
https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/llama_2_13b
创建chat
返回说明
请求示例(多轮)
响应示例(多轮)
{
"id": "as-hn4futxccq",
"object": "chat.completion",
"created": 1693290436,
"result": " Sure, I can help you with that! Shanghai is a city located in eastern China, and its weather is influenced by its coastal position and subtropical maritime climate. Here's what you can expect:\n\n1. Seasonal weather: Shanghai has four distinct seasons, with hot and humid summers, and cold and dry winters. The best time to visit Shanghai is in the spring (March to May) and autumn (September to November), when the weather is mild and comfortable.\n2. Temperature: The average temperature in Shanghai ranges from 2°C (36°F) in January (the coldest month) to 28°C (82°F) in July (the hottest month).\n3. Humidity: Shanghai is known for its high humidity, especially during the summer months. The average relative humidity is around 60-70%, but it can feel much higher due to the heat and moisture in the air.\n4. Sunshine: Shanghai experiences a significant amount of sunshine throughout the year, with an average of 1,900 hours of sunshine per year.\n5. Rainfall: Shanghai receives most of its rainfall during the summer months, with an average of 10-15 rainy days per month from June to August.\n6. Typhoons: Shanghai is susceptible to typhoons, which are tropical cyclones that form in the Pacific Ocean and can bring strong winds, heavy rainfall, and flooding to the city. The typhoon season in Shanghai typically runs from June to September.\n\nOverall, the weather in Shanghai can be quite hot and humid during the summer months, and cold and dry during the winter months. It's important to pack accordingly and be prepared for the season you're visiting in.",
"is_truncated": false,
"need_clear_history": false,
"usage": {
"prompt_tokens": 147,
"completion_tokens": 345,
"total_tokens": 492
}
}
请求示例(流式)
响应示例(流式)
data: {"id":"as-wyjuy3n4vb","object":"chat.completion","created":1693290799,"sentence_id":0,"is_end":false,"is_truncated":false,"result":" Hello! As a helpful and respectful assistant, I\'d be happy to recommend some Chinese self-driving tour routes for you!\\n\\nBefore I begin, I just want to clarify that it\'s important to always prioritize safety when traveling, especially when driving. It\'s essential to follow all local traffic laws and regulations, and to be mindful of your own and others\' well-being on the road.\\n\\nWith that said, ","need_clear_history":false,"usage":{"prompt_tokens":11,"completion_tokens":91,"total_tokens":102}}
data: {"id":"as-wyjuy3n4vb","object":"chat.completion","created":1693290801,"sentence_id":1,"is_end":false,"is_truncated":false,"result":"here are some popular Chinese self-driving tour routes that you may consider:\\n\\n1. The Golden Route: This route takes you through some of China\'s most iconic destinations, including Beijing, Xi\'an, Lhasa, and Shanghai. You\'ll have the opportunity to explore the Forbidden City, the Great Wall, and the Potala Palace, among other famous landmarks.\\n2. The Yellow Mountains Route: This route takes you through the stunning Yellow ","need_clear_history":false,"usage":{"prompt_tokens":11,"completion_tokens":91,"total_tokens":193}}
data: {"id":"as-wyjuy3n4vb","object":"chat.completion","created":1693290803,"sentence_id":2,"is_end":false,"is_truncated":false,"result":"Mountains in Anhui Province, known for their breathtaking scenery and unique rock formations. You\'ll have the chance to hike, bike, and take in the natural beauty of this UNESCO World Heritage Site.\\n3. The Silk Road Route: This route takes you through the ancient Silk Road, which connects China with Central Asia and the Middle East. You\'ll have the opportunity to explore historic sites like ","need_clear_history":false,"usage":{"prompt_tokens":11,"completion_tokens":87,"total_tokens":280}}
data: {"id":"as-wyjuy3n4vb","object":"chat.completion","created":1693290806,"sentence_id":3,"is_end":false,"is_truncated":false,"result":"the Terracotta Warriors in Xi\'an, the ancient city of Loulan in Xinjiang, and the majestic Karakoram Highway.\\n4. The Tibetan Plateau Route: This route takes you through the breathtaking landscapes of the Tibetan Plateau, including the Nyingchi Prefecture and the Mount Kailash region. You\'ll have the chance to experience the unique culture and stunning natural beauty of this remote and sacred region.\\n5. The Coastal Route: ","need_clear_history":false,"usage":{"prompt_tokens":11,"completion_tokens":88,"total_tokens":368}}
data: {"id":"as-wyjuy3n4vb","object":"chat.completion","created":1693290808,"sentence_id":4,"is_end":false,"is_truncated":false,"result":"This route takes you along China\'s stunning coastline, including the cities of Qingdao, Tianjin, and Shanghai. You\'ll have the opportunity to explore historic sites like the Great Wall, enjoy delicious seafood, and take in the vibrant city life of these bustling coastal cities.\\n\\nThese are just a few examples of the many Chinese self-driving tour routes available. Before embarking on your journey, I recommend doing ","need_clear_history":false,"usage":{"prompt_tokens":11,"completion_tokens":88,"total_tokens":456}}
data: {"id":"as-wyjuy3n4vb","object":"chat.completion","created":1693290810,"sentence_id":5,"is_end":true,"is_truncated":false,"result":"thorough research on the routes and destinations that interest you, and planning your itinerary accordingly. Additionally, be sure to check the current travel advisories and local health and safety guidelines before traveling.\\n\\nI hope this information is helpful in planning your Chinese self-driving tour! If you have any further questions or need more information, please don\'t hesitate to ask.","need_clear_history":false,"usage":{"prompt_tokens":11,"completion_tokens":79,"total_tokens":535}}
错误码
名称 | 描述 |
---|---|
error_code | 错误码 |
error_msg | 错误描述信息,帮助理解和解决发生的错误 |
{
"error_code": 110,
"error_msg": "Access token invalid or no longer valid"
}
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/llama_2_13b?access_token =' \
--header 'Content-Type: application/json' \
--data-raw '{
"messages\t": [
{
"role\t": "string",
"content": "string"
}
],
"stream": true,
"temperature\t": 0,
"top_k\t": 0,
"top_p\t": 0,
"penalty_score": 0,
"stop\t": [
"string"
],
"user_id": "string"
}'
响应示例响应示例
{
"id": "string",
"object": "string",
"created": 0,
"result": "string",
"is_truncated": true,
"need_clear_history": true,
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
}
}
请求参数
Query 参数
access_token
string
必需
Body 参数application/json