go/resources/conversations/methods/retrieve/index.md +0 −70 deleted
File Deleted View Diff
1## Retrieve a conversation
2
3`client.Conversations.Get(ctx, conversationID) (*Conversation, error)`
4
5**get** `/conversations/{conversation_id}`
6
7Get a conversation
8
9### Parameters
10
11- `conversationID string`
12
13### Returns
14
15- `type Conversation struct{…}`
16
17 - `ID string`
18
19 The unique ID of the conversation.
20
21 - `CreatedAt int64`
22
23 The time at which the conversation was created, measured in seconds since the Unix epoch.
24
25 - `Metadata any`
26
27 Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
28 Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
29
30 - `Object Conversation`
31
32 The object type, which is always `conversation`.
33
34 - `const ConversationConversation Conversation = "conversation"`
35
36### Example
37
38```go
39package main
40
41import (
42 "context"
43 "fmt"
44
45 "github.com/openai/openai-go"
46 "github.com/openai/openai-go/option"
47)
48
49func main() {
50 client := openai.NewClient(
51 option.WithAPIKey("My API Key"),
52 )
53 conversation, err := client.Conversations.Get(context.TODO(), "conv_123")
54 if err != nil {
55 panic(err.Error())
56 }
57 fmt.Printf("%+v\n", conversation.ID)
58}
59```
60
61#### Response
62
63```json
64{
65 "id": "id",
66 "created_at": 0,
67 "metadata": {},
68 "object": "conversation"
69}
70```