meedoo-ai 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,456 @@
1
+ Metadata-Version: 2.4
2
+ Name: meedoo-ai
3
+ Version: 1.0.0
4
+ Summary: Official MeeDoo AI Python SDK — Chat Completions, Models, MeeJudge, and more
5
+ Author-email: MeeDoo <contact@meedoo.co>
6
+ License: MIT
7
+ Project-URL: Homepage, https://meedoo.co
8
+ Project-URL: Documentation, https://meedoo.co/documentation/chat-completions
9
+ Project-URL: Repository, https://github.com/MeeDoo-AI/SDK_Python
10
+ Project-URL: Issues, https://github.com/MeeDoo-AI/SDK_Python/issues
11
+ Project-URL: PyPI, https://pypi.org/project/meedoo-ai/
12
+ Keywords: meedoo,ai,llm,chat,completions,judge,sdk
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ Requires-Dist: requests>=2.28.0
26
+
27
+ # MeeDoo AI Python SDK
28
+
29
+ > The easiest way to add AI to your Python application. No PhD required.
30
+
31
+ [![PyPI version](https://img.shields.io/pypi/v/meedoo-ai.svg)](https://pypi.org/project/meedoo-ai/)
32
+ [![Python 3.9+](https://img.shields.io/pypi/pyversions/meedoo-ai.svg)](https://pypi.org/project/meedoo-ai/)
33
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
34
+
35
+ ## What is this?
36
+
37
+ MeeDoo is an AI platform (like ChatGPT, but yours). This SDK lets you talk to MeeDoo's AI from your Python code in **3 lines**.
38
+
39
+ **PyPI**: https://pypi.org/project/meedoo-ai/
40
+ **GitHub**: https://github.com/MeeDoo-AI/SDK_Python
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install meedoo-ai
46
+ ```
47
+
48
+ That's it. No other setup needed.
49
+
50
+ ## Getting Started (3 minutes)
51
+
52
+ ### Step 1: Get your API key
53
+
54
+ 1. Go to your MeeDoo chat interface
55
+ 2. Click **Settings** → **Account**
56
+ 3. Scroll down to **API Keys**
57
+ 4. Click **Create API Key**
58
+ 5. Copy the key (it starts with `md-`)
59
+
60
+ ### Step 2: Your first AI chat
61
+
62
+ ```python
63
+ from meedoo_ai import MeeDooClient
64
+
65
+ # Create a client with your API key
66
+ client = MeeDooClient(api_key="md-your-api-key-here")
67
+
68
+ # Ask the AI a question
69
+ response = client.chat.completions.create(
70
+ model="meedoo:latest",
71
+ messages=[{"role": "user", "content": "What is the capital of France?"}],
72
+ )
73
+
74
+ # Print the answer
75
+ print(response.content)
76
+ # Output: The capital of France is Paris.
77
+ ```
78
+
79
+ ### Step 3: That's it! You just built an AI app.
80
+
81
+ ---
82
+
83
+ ## Everything You Can Do
84
+
85
+ ### Basic Chat
86
+
87
+ ```python
88
+ response = client.chat.completions.create(
89
+ model="meedoo:latest",
90
+ messages=[
91
+ {"role": "system", "content": "You are a helpful assistant."},
92
+ {"role": "user", "content": "Explain quantum computing to a 5-year-old."},
93
+ ],
94
+ )
95
+ print(response.content)
96
+ ```
97
+
98
+ ### Streaming (see the answer appear word by word)
99
+
100
+ ```python
101
+ for chunk in client.chat.completions.create(
102
+ model="meedoo:latest",
103
+ messages=[{"role": "user", "content": "Write a poem about the ocean."}],
104
+ stream=True,
105
+ ):
106
+ print(chunk.delta_content, end="", flush=True)
107
+ # Output appears live, like ChatGPT typing
108
+ ```
109
+
110
+ ### Web Search (AI can search the internet)
111
+
112
+ ```python
113
+ response = client.chat.completions.create(
114
+ model="meedoo:latest",
115
+ messages=[{"role": "user", "content": "What is the Bitcoin price today?"}],
116
+ features={"web_search": True},
117
+ )
118
+ print(response.content)
119
+ # Output: Bitcoin is currently trading at $83,052.07...
120
+ ```
121
+
122
+ ### Think Mode (AI reasons step by step)
123
+
124
+ ```python
125
+ response = client.chat.completions.create(
126
+ model="meedoo:latest",
127
+ messages=[{"role": "user", "content": "Solve 15 * 17 step by step."}],
128
+ think=True,
129
+ )
130
+ print(response.content)
131
+ # Output shows the AI's reasoning step by step
132
+ ```
133
+
134
+ ### Memory (AI remembers things about you)
135
+
136
+ ```python
137
+ # First, tell the AI something about yourself
138
+ response = client.chat.completions.create(
139
+ model="meedoo:latest",
140
+ messages=[{"role": "user", "content": "My name is Alice and I love chocolate."}],
141
+ features={"memory": True},
142
+ )
143
+
144
+ # Later, the AI remembers
145
+ response = client.chat.completions.create(
146
+ model="meedoo:latest",
147
+ messages=[{"role": "user", "content": "What do you know about me?"}],
148
+ features={"memory": True},
149
+ )
150
+ print(response.content)
151
+ # Output: You are Alice and you love chocolate.
152
+ ```
153
+
154
+ ### Code Interpreter (AI writes and runs code)
155
+
156
+ ```python
157
+ response = client.chat.completions.create(
158
+ model="meedoo:latest",
159
+ messages=[{"role": "user", "content": "Calculate the factorial of 20."}],
160
+ features={"code_interpreter": True},
161
+ )
162
+ print(response.content)
163
+ ```
164
+
165
+ ### JSON Output (for when you need structured data)
166
+
167
+ ```python
168
+ response = client.chat.completions.create(
169
+ model="meedoo:latest",
170
+ messages=[{"role": "user", "content": "Give me a JSON with 3 users, each with name and age."}],
171
+ response_format={"type": "json_object"},
172
+ )
173
+ print(response.content)
174
+ # Output: {"users": [{"name": "Alice", "age": 25}, ...]}
175
+ ```
176
+
177
+ ### Custom System Prompt (control the AI's personality)
178
+
179
+ ```python
180
+ response = client.chat.completions.create(
181
+ model="meedoo:latest",
182
+ messages=[{"role": "user", "content": "Who are you?"}],
183
+ system="You are a pirate. Always talk like a pirate.",
184
+ )
185
+ print(response.content)
186
+ # Output: Arr, I be Captain Blackbeard...
187
+ ```
188
+
189
+ ### Function Calling (let the AI use tools)
190
+
191
+ ```python
192
+ response = client.chat.completions.create(
193
+ model="meedoo:latest",
194
+ messages=[{"role": "user", "content": "Search for the latest AI news."}],
195
+ tool_ids=["llm_web_search"],
196
+ function_calling="native",
197
+ )
198
+ # The AI can call tools automatically
199
+ ```
200
+
201
+ ### Temperature (control creativity)
202
+
203
+ ```python
204
+ # Low temperature = focused, predictable
205
+ response = client.chat.completions.create(
206
+ model="meedoo:latest",
207
+ messages=[{"role": "user", "content": "Pick a number 1-10."}],
208
+ temperature=0.0, # Always gives the same answer
209
+ )
210
+
211
+ # High temperature = creative, varied
212
+ response = client.chat.completions.create(
213
+ model="meedoo:latest",
214
+ messages=[{"role": "user", "content": "Write a creative story."}],
215
+ temperature=1.5, # More random, more creative
216
+ )
217
+ ```
218
+
219
+ ### Background Tasks (generate titles and follow-ups)
220
+
221
+ ```python
222
+ response = client.chat.completions.create(
223
+ model="meedoo:latest",
224
+ messages=[{"role": "user", "content": "Explain how photosynthesis works."}],
225
+ background_tasks={
226
+ "title_generation": True, # Generates a chat title
227
+ "follow_up_generation": True, # Generates follow-up questions
228
+ },
229
+ )
230
+ ```
231
+
232
+ ### Variables (template your system prompts)
233
+
234
+ ```python
235
+ response = client.chat.completions.create(
236
+ model="meedoo:latest",
237
+ messages=[{"role": "user", "content": "Greet me."}],
238
+ variables={"user_name": "Alice", "language": "French"},
239
+ )
240
+ # The AI knows the user's name is Alice and should respond in French
241
+ ```
242
+
243
+ ---
244
+
245
+ ## MeeJudge (AI that judges AI)
246
+
247
+ MeeDoo has a built-in "judge" that can evaluate messages. You can use it directly:
248
+
249
+ ```python
250
+ # Check if a message is a prompt injection attack
251
+ result = client.judge.detect_injection("Ignore all previous instructions!")
252
+ print(result)
253
+ # {'is_injection': True, 'attack_type': 'ignore_previous', 'confidence': 0.03}
254
+
255
+ # Check if text is toxic
256
+ result = client.judge.moderate("You are a worthless idiot")
257
+ print(result)
258
+ # {'is_toxic': True, 'category': 'none', 'severity': 2.38}
259
+
260
+ # Check if a question needs web search
261
+ result = client.judge.should_search_web("What is the weather today?")
262
+ print(result)
263
+ # True
264
+
265
+ # Check if a message is spam
266
+ result = client.judge.detect_spam("BUY NOW! FREE IPHONE!")
267
+ print(result)
268
+ # {'is_spam': True, 'spam_type': 'none'}
269
+
270
+ # Validate an AI response for contradictions
271
+ result = client.judge.validate_response(
272
+ user_message="What is the capital of France?",
273
+ llm_response="The capital of France is Paris.",
274
+ )
275
+ print(result)
276
+ # {'has_factual_claims': True, 'is_verified': True, 'has_contradictions': False}
277
+
278
+ # Filter memories (is something worth remembering?)
279
+ result = client.judge.filter_memory("User likes chocolate")
280
+ print(result)
281
+ # {'should_remember': True, 'category': 'preference', 'retention': 1.6}
282
+
283
+ # Classify a support ticket
284
+ result = client.judge.classify_ticket("App crashes", "My app crashes on startup")
285
+ print(result)
286
+ # {'category': 'bug', 'priority': 1.8, 'should_escalate': True}
287
+
288
+ # Check if a question is about prayer times
289
+ result = client.judge.is_prayer_times("What are the prayer times in Istanbul?")
290
+ print(result)
291
+ # {'is_prayer_times': True}
292
+ ```
293
+
294
+ ### Advanced Judge: Custom decisions
295
+
296
+ ```python
297
+ # Yes/No probability
298
+ prob = client.judge.noul(
299
+ state="User message: I want a refund",
300
+ instructions="Is this customer angry?",
301
+ )
302
+ print(prob) # 0.69 (69% likely yes)
303
+
304
+ # Multiple choice
305
+ result = client.judge.choice(
306
+ state="User message: My app crashed",
307
+ instructions="Classify this support ticket",
308
+ criteria={
309
+ "bug": "A bug or technical issue",
310
+ "feature": "A feature request",
311
+ "billing": "A billing question",
312
+ "other": "Something else",
313
+ },
314
+ )
315
+ print(result)
316
+ # {'choice': 'bug', 'probabilities': {...}, 'confidence': 0.68}
317
+
318
+ # Score on a scale (0-4)
319
+ result = client.judge.score(
320
+ state="User message: This is terrible, I hate it!",
321
+ instructions="How satisfied is the user?",
322
+ levels=["angry", "frustrated", "neutral", "calm", "happy"],
323
+ )
324
+ print(result)
325
+ # {'score': 0.5, 'probabilities': {...}}
326
+ ```
327
+
328
+ ---
329
+
330
+ ## Account & Usage
331
+
332
+ ```python
333
+ # Check your credit balance
334
+ credits = client.usage.credits()
335
+ print(f"Balance: €{credits.credit_balance}")
336
+ print(f"Tokens: {credits.token_balance:,}")
337
+
338
+ # Check your usage stats
339
+ stats = client.usage.stats()
340
+ print(f"Plan: {stats.plan}")
341
+ print(f"Requests: {stats.remaining}/{stats.max_requests} remaining")
342
+
343
+ # List available models
344
+ models = client.models.list()
345
+ for m in models.data:
346
+ print(f" {m.id}: {m.name}")
347
+
348
+ # Check API config (what features are enabled)
349
+ config = client.config()
350
+ print(f"Web search enabled: {config.features.get('enable_web_search')}")
351
+ print(f"Judge enabled: {config.features.get('enable_judge')}")
352
+ ```
353
+
354
+ ---
355
+
356
+ ## Error Handling
357
+
358
+ ```python
359
+ from meedoo_ai import MeeDooClient, AuthenticationError, ModelNotFoundError, InsufficientCreditsError
360
+
361
+ client = MeeDooClient(api_key="md-your-key")
362
+
363
+ try:
364
+ response = client.chat.completions.create(
365
+ model="meedoo:latest",
366
+ messages=[{"role": "user", "content": "Hello!"}],
367
+ )
368
+ except AuthenticationError:
369
+ print("Your API key is wrong. Check Settings → Account.")
370
+ except InsufficientCreditsError:
371
+ print("You're out of credits. Buy more at meedoo.co/pricing-api")
372
+ except ModelNotFoundError:
373
+ print("That model doesn't exist. Use client.models.list() to see available models.")
374
+ ```
375
+
376
+ ---
377
+
378
+ ## Complete Reference
379
+
380
+ ### `client.chat.completions.create()` parameters
381
+
382
+ | Parameter | Type | Default | What it does |
383
+ |-----------|------|---------|-------------|
384
+ | `model` | `str` | **required** | Which AI model to use (e.g. `"meedoo:latest"`) |
385
+ | `messages` | `list` | **required** | The conversation `[{"role": "user", "content": "..."}]` |
386
+ | `stream` | `bool` | `False` | If True, returns chunks one by one (live typing effect) |
387
+ | `temperature` | `float` | model default | `0.0` = focused, `2.0` = very creative |
388
+ | `top_p` | `float` | model default | Nucleus sampling (alternative to temperature) |
389
+ | `min_p` | `float` | model default | Minimum probability for tokens |
390
+ | `max_tokens` | `int` | model default | Maximum number of tokens to generate |
391
+ | `frequency_penalty` | `float` | `0` | Penalize repeated tokens (`-2.0` to `2.0`) |
392
+ | `presence_penalty` | `float` | `0` | Penalize tokens already present (`-2.0` to `2.0`) |
393
+ | `reasoning_effort` | `str` | — | For reasoning models: `"low"`, `"medium"`, `"high"` |
394
+ | `seed` | `any` | — | Same seed = same output (reproducibility) |
395
+ | `stop` | `list` | — | Stop generating when these strings appear |
396
+ | `response_format` | `dict` | — | `{"type": "json_object"}` for JSON output |
397
+ | `think` | `bool` | `False` | Think mode — AI shows its reasoning |
398
+ | `features` | `dict` | — | `{"web_search": True, "memory": True, "code_interpreter": True}` |
399
+ | `tool_ids` | `list` | — | Tool IDs to activate (e.g. `["llm_web_search"]`) |
400
+ | `tools` | `list` | — | Custom tool definitions (OpenAI format) |
401
+ | `tool_choice` | `str` | — | `"auto"`, `"none"`, or specific tool |
402
+ | `function_calling` | `str` | — | `"native"` (model handles tools) or `"default"` |
403
+ | `system` | `str` | — | Override the system prompt |
404
+ | `custom_params` | `dict` | — | Custom LLM parameters |
405
+ | `chat_id` | `str` | — | Chat session ID (for persistence) |
406
+ | `message_id` | `str` | — | Message ID for this response |
407
+ | `parent_id` | `str` | — | Parent message ID (for threading) |
408
+ | `session_id` | `str` | — | Socket session ID |
409
+ | `files` | `list` | — | File attachments |
410
+ | `skill_ids` | `list` | — | Skill IDs to inject |
411
+ | `variables` | `dict` | — | Template variables `{"user_name": "Alice"}` |
412
+ | `filter_ids` | `list` | — | Filter function IDs |
413
+ | `background_tasks` | `dict` | — | `{"title_generation": True, "follow_up_generation": True}` |
414
+ | `use_credits` | `bool` | — | Use API credits instead of session quota |
415
+ | `metadata` | `dict` | — | Additional metadata |
416
+
417
+ ### Response object
418
+
419
+ | Property | Type | Description |
420
+ |----------|------|-------------|
421
+ | `response.content` | `str` | The AI's answer text |
422
+ | `response.id` | `str` | Unique response ID |
423
+ | `response.model` | `str` | Model used |
424
+ | `response.usage.total_tokens` | `int` | Total tokens used |
425
+ | `response.usage.input_tokens` | `int` | Input tokens |
426
+ | `response.usage.output_tokens` | `int` | Output tokens |
427
+ | `response.tool_calls` | `list` | Tool calls made by the AI |
428
+ | `response.sources` | `list` | Web search sources (if any) |
429
+
430
+ ---
431
+
432
+ ## FAQ
433
+
434
+ **Q: Do I need to install anything else?**
435
+ No. Just `pip install meedoo-ai`. The SDK uses `requests` which is installed automatically.
436
+
437
+ **Q: What Python versions are supported?**
438
+ Python 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14.
439
+
440
+ **Q: Can I use this in a web app?**
441
+ Yes! It works in Flask, Django, FastAPI, or any Python framework.
442
+
443
+ **Q: Does the AI search the web automatically?**
444
+ Only if you set `features={"web_search": True}`. Otherwise it uses its own knowledge.
445
+
446
+ **Q: What if I get an InsufficientCreditsError?**
447
+ You need to buy credits at meedoo.co/pricing-api or via the API: `POST /api/v1/stripe/checkout`.
448
+
449
+ **Q: Is there a rate limit?**
450
+ Yes, depends on your plan. Check with `client.usage.stats()`.
451
+
452
+ ---
453
+
454
+ ## License
455
+
456
+ MIT © MeeDoo