or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

authentication.mdchat-interface.mdconfiguration.mdindex.md

configuration.mddocs/

0

# Configuration Options

1

2

Session configuration for customizing chat behavior, including proxy settings, conversation tracking, logging control, and moderation bypass options.

3

4

## Capabilities

5

6

### Options Class

7

8

Configuration container that controls various aspects of the chat session including networking, persistence, and behavior settings.

9

10

```python { .api }

11

class Options:

12

"""

13

Configuration options for Chat sessions.

14

15

All attributes have sensible defaults and can be modified after instantiation.

16

"""

17

def __init__(self):

18

self.log: bool = True

19

self.proxies: str or dict or None = None

20

self.track: bool or None = False

21

self.verify: bool = True

22

self.pass_moderation: bool = False

23

self.chat_log: str or None = None

24

self.id_log: str or None = None

25

26

def __repr__(self):

27

return f"<Options log={self.log} proxies={self.proxies} track={self.track} " \

28

f"verify={self.verify} pass_moderation={self.pass_moderation} " \

29

f"chat_log={self.chat_log} id_log={self.id_log}>"

30

```

31

32

### Logging Control

33

34

Enable or disable console output for debugging and monitoring.

35

36

```python { .api }

37

log: bool

38

```

39

40

**Default:** `True`

41

**Description:** Controls whether the library outputs status messages, errors, and debugging information to stderr.

42

43

#### Usage Example

44

45

```python

46

from pychatgpt import Chat, Options

47

48

# Disable logging for production use

49

options = Options()

50

options.log = False

51

52

chat = Chat(email="user@example.com", password="password", options=options)

53

```

54

55

### Proxy Configuration

56

57

Configure HTTP/HTTPS proxy for all network requests.

58

59

```python { .api }

60

proxies: str or dict or None

61

```

62

63

**Default:** `None`

64

**Description:** Proxy server configuration. Can be a string URL for both HTTP/HTTPS or a dictionary with separate configurations.

65

66

#### Usage Examples

67

68

```python

69

from pychatgpt import Chat, Options

70

71

# String proxy (applies to both HTTP and HTTPS)

72

options = Options()

73

options.proxies = "http://proxy.example.com:8080"

74

75

# Dictionary proxy with separate settings

76

options.proxies = {

77

"http": "http://proxy.example.com:8080",

78

"https": "https://secure-proxy.example.com:8443"

79

}

80

81

chat = Chat(email="user@example.com", password="password", options=options)

82

```

83

84

### Conversation Tracking

85

86

Enable persistent conversation storage to files.

87

88

```python { .api }

89

track: bool or None

90

```

91

92

**Default:** `False`

93

**Description:** When enabled, automatically saves conversation history and IDs to files, allowing conversation resumption across sessions.

94

95

#### Usage Example

96

97

```python

98

from pychatgpt import Chat, Options

99

100

options = Options()

101

options.track = True # Enable conversation tracking

102

103

# Optional: specify custom file paths

104

options.chat_log = "/path/to/my_conversations.txt"

105

options.id_log = "/path/to/my_conversation_ids.txt"

106

107

chat = Chat(email="user@example.com", password="password", options=options)

108

109

# Conversations will be automatically saved

110

response, prev_id, conv_id = chat.ask("Hello!")

111

112

# Later, resume conversation by reading from id_log

113

with open(options.id_log, 'r') as f:

114

lines = f.readlines()

115

if len(lines) >= 2:

116

previous_convo_id = lines[0].strip()

117

conversation_id = lines[1].strip()

118

119

# Resume conversation

120

chat_resumed = Chat(

121

email="user@example.com",

122

password="password",

123

options=options,

124

conversation_id=conversation_id,

125

previous_convo_id=previous_convo_id

126

)

127

```

128

129

### SSL Verification

130

131

Control SSL certificate verification for HTTPS requests.

132

133

```python { .api }

134

verify: bool

135

```

136

137

**Default:** `True`

138

**Description:** Whether to verify SSL certificates when making HTTPS requests to OpenAI endpoints.

139

140

### Moderation Bypass

141

142

Skip OpenAI's content moderation pre-checks.

143

144

```python { .api }

145

pass_moderation: bool

146

```

147

148

**Default:** `False`

149

**Description:** When `False`, the library makes a preliminary request to OpenAI's moderation endpoint before sending the actual message. When `True`, skips this step.

150

151

#### Usage Example

152

153

```python

154

from pychatgpt import Chat, Options

155

156

# Skip moderation for faster responses (use with caution)

157

options = Options()

158

options.pass_moderation = True

159

160

chat = Chat(email="user@example.com", password="password", options=options)

161

```

162

163

### Chat Log File Path

164

165

Specify custom file path for conversation history storage.

166

167

```python { .api }

168

chat_log: str or None

169

```

170

171

**Default:** `None` (uses "chat_log.txt" when tracking is enabled)

172

**Description:** File path where conversation history is saved when `track=True`.

173

174

### ID Log File Path

175

176

Specify custom file path for conversation ID storage.

177

178

```python { .api }

179

id_log: str or None

180

```

181

182

**Default:** `None` (uses "id_log.txt" when tracking is enabled)

183

**Description:** File path where conversation IDs are saved when `track=True`. This file contains the previous conversation ID and current conversation ID on separate lines.

184

185

## Complete Configuration Example

186

187

```python

188

from pychatgpt import Chat, Options

189

190

# Create options with all settings

191

options = Options()

192

options.log = True # Enable logging

193

options.proxies = "http://proxy.example.com:8080" # Use proxy

194

options.track = True # Enable conversation tracking

195

options.verify = True # Verify SSL certificates

196

options.pass_moderation = False # Use moderation pre-checks

197

options.chat_log = "./conversations.txt" # Custom chat log path

198

options.id_log = "./conversation_ids.txt" # Custom ID log path

199

200

# Create chat with options

201

chat = Chat(

202

email="user@example.com",

203

password="password",

204

options=options

205

)

206

207

# Use chat normally - all options will be applied

208

response, prev_id, conv_id = chat.ask("Hello, ChatGPT!")

209

```

210

211

## File Format Details

212

213

### Chat Log Format

214

215

When `track=True`, the chat log file contains conversation history in this format:

216

217

```

218

You: Hello, how are you?

219

Chat GPT: Hello! I'm doing well, thank you for asking. How are you today?

220

You: I'm doing great! Can you help me with Python?

221

Chat GPT: Of course! I'd be happy to help you with Python. What specific topic or problem would you like assistance with?

222

```

223

224

### ID Log Format

225

226

The ID log file contains conversation IDs on separate lines:

227

228

```

229

uuid-of-previous-conversation

230

uuid-of-current-conversation

231

```

232

233

These IDs are used to maintain conversation context across sessions.