更新最新代码
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from zhipuai import ZhipuAI
|
||||
def gml_chat(prompt):
|
||||
client = ZhipuAI(api_key="92a0e4868cda21d22fe6fd0f4c0bf6fb.oZ4IE9PPDOhsLKPp")
|
||||
|
||||
response = client.chat.completions.create(
|
||||
model="glm-3-turbo",
|
||||
messages=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": prompt
|
||||
}
|
||||
],
|
||||
top_p=0.7,
|
||||
temperature=0.95,
|
||||
max_tokens=1024,
|
||||
stream=True,
|
||||
)
|
||||
content = ""
|
||||
for trunk in response:
|
||||
# print(trunk.choices[0].delta)
|
||||
content = content + trunk.choices[0].delta.content
|
||||
print(trunk)
|
||||
return content
|
||||
gml_chat("我刚才告诉你我的名字了")
|
||||
|
||||
Reference in New Issue
Block a user