Creates a new conversation with an agent.
POST
/v1/conversations
Request Body
Les paramètres suivants peuvent être inclus dans le corps de la requête :
Paramètres
agent_id
string
Required
The ID of the agent to start a conversation with.
message
string
An optional initial message to start the conversation.
Successful Response
Les champs suivants sont retournés dans une réponse réussie :
Champs de réponse
id
string
Required
A unique identifier for the conversation.
object
string
Required
The object type, which is always "conversation".
created
integer
Required
The Unix timestamp when the conversation was created.
agent_id
string
Required
The ID of the agent associated with this conversation.
messages
The list of messages in the conversation.
Examples
Exemples de code pour utiliser cet endpoint :
typescript
import { AlphaEdge } from '@alphaedge/alphaedge';
const alphaedge = new AlphaEdge({
apiKey: process.env.ALPHAEDGE_API_KEY,
});
const conversation = await alphaedge.conversations.create({
agent_id: 'agent-abc123',
message: 'Hello!'
});
python
from alphaedge import AlphaEdge
alphaedge = AlphaEdge(api_key="your-api-key")
conversation = alphaedge.conversations.create(
agent_id="agent-abc123",
message="Hello!"
)
curl
curl https://api.alphaedge-ai.com/v1/conversations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ALPHAEDGE_API_KEY" \
-d '{
"agent_id": "agent-abc123",
"message": "Hello!"
}'
Response
Exemple de réponse de l'API :
json
{
"id": "conv-abc123",
"object": "conversation",
"created": 1234567890,
"agent_id": "agent-abc123",
"messages": []
}