qwed 0.1.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.
- qwed-0.1.0/.gitignore +43 -0
- qwed-0.1.0/PKG-INFO +33 -0
- qwed-0.1.0/README.md +23 -0
- qwed-0.1.0/pyproject.toml +20 -0
- qwed-0.1.0/qwed/__init__.py +4 -0
- qwed-0.1.0/qwed/client.py +87 -0
- qwed-0.1.0/qwed/models.py +24 -0
qwed-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Environment variables (contains secrets)
|
|
2
|
+
.env
|
|
3
|
+
|
|
4
|
+
# Python
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
*$py.class
|
|
8
|
+
*.so
|
|
9
|
+
.Python
|
|
10
|
+
build/
|
|
11
|
+
develop-eggs/
|
|
12
|
+
dist/
|
|
13
|
+
downloads/
|
|
14
|
+
eggs/
|
|
15
|
+
.eggs/
|
|
16
|
+
lib/
|
|
17
|
+
lib64/
|
|
18
|
+
parts/
|
|
19
|
+
sdist/
|
|
20
|
+
var/
|
|
21
|
+
wheels/
|
|
22
|
+
*.egg-info/
|
|
23
|
+
.installed.cfg
|
|
24
|
+
*.egg
|
|
25
|
+
|
|
26
|
+
# Virtual environments
|
|
27
|
+
venv/
|
|
28
|
+
ENV/
|
|
29
|
+
env/
|
|
30
|
+
|
|
31
|
+
# IDEs
|
|
32
|
+
.vscode/
|
|
33
|
+
.idea/
|
|
34
|
+
*.swp
|
|
35
|
+
*.swo
|
|
36
|
+
|
|
37
|
+
# Logs
|
|
38
|
+
logs/
|
|
39
|
+
*.log
|
|
40
|
+
|
|
41
|
+
# OS
|
|
42
|
+
.DS_Store
|
|
43
|
+
Thumbs.db
|
qwed-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qwed
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python Client for QWED Verification Engine
|
|
5
|
+
Author-email: QWED Team <dev@qwed.tech>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Requires-Dist: pydantic>=2.0.0
|
|
8
|
+
Requires-Dist: requests>=2.25.0
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# QWED Python SDK
|
|
12
|
+
|
|
13
|
+
Official Python client for the QWED Verification Engine.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
```bash
|
|
17
|
+
pip install qwed
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
```python
|
|
22
|
+
from qwed import QwedClient
|
|
23
|
+
|
|
24
|
+
client = QwedClient(api_key="YOUR_API_KEY")
|
|
25
|
+
result = client.verify_natural_language("What is 10 + 10?")
|
|
26
|
+
|
|
27
|
+
print(result.final_answer) # 20.0
|
|
28
|
+
print(result.status) # "VERIFIED"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
Full documentation at: https://github.com/rahuldass19/qwed-open
|
qwed-0.1.0/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# QWED Python SDK
|
|
2
|
+
|
|
3
|
+
Official Python client for the QWED Verification Engine.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
```bash
|
|
7
|
+
pip install qwed
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
```python
|
|
12
|
+
from qwed import QwedClient
|
|
13
|
+
|
|
14
|
+
client = QwedClient(api_key="YOUR_API_KEY")
|
|
15
|
+
result = client.verify_natural_language("What is 10 + 10?")
|
|
16
|
+
|
|
17
|
+
print(result.final_answer) # 20.0
|
|
18
|
+
print(result.status) # "VERIFIED"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
Full documentation at: https://github.com/rahuldass19/qwed-open
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "qwed"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Official Python Client for QWED Verification Engine"
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "QWED Team", email = "dev@qwed.tech"},
|
|
11
|
+
]
|
|
12
|
+
dependencies = [
|
|
13
|
+
"requests>=2.25.0",
|
|
14
|
+
"pydantic>=2.0.0"
|
|
15
|
+
]
|
|
16
|
+
requires-python = ">=3.8"
|
|
17
|
+
readme = "README.md"
|
|
18
|
+
|
|
19
|
+
[tool.hatch.build.targets.wheel]
|
|
20
|
+
packages = ["qwed"]
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import requests
|
|
3
|
+
from typing import Optional, Dict, Any, Union, List
|
|
4
|
+
from .models import VerificationResponse, LogicResponse, FactResponse
|
|
5
|
+
|
|
6
|
+
class QwedClient:
|
|
7
|
+
"""
|
|
8
|
+
Client for the QWED Verification API.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(self, api_key: str, base_url: str = "https://api.qwed.tech/v1"):
|
|
12
|
+
"""
|
|
13
|
+
Initialize the QWED client.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
api_key: Your QWED API key.
|
|
17
|
+
base_url: The base URL of the QWED API. Defaults to production.
|
|
18
|
+
Use "http://localhost:8000" for local development.
|
|
19
|
+
"""
|
|
20
|
+
self.api_key = api_key
|
|
21
|
+
self.base_url = base_url.rstrip("/")
|
|
22
|
+
self.session = requests.Session()
|
|
23
|
+
self.session.headers.update({
|
|
24
|
+
"X-API-Key": self.api_key,
|
|
25
|
+
"Content-Type": "application/json"
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
def verify_natural_language(self, query: str, provider: Optional[str] = None) -> VerificationResponse:
|
|
29
|
+
"""
|
|
30
|
+
Verify a natural language math or general query.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
query: The question to verify (e.g., "What is 10 + 10?").
|
|
34
|
+
provider: Optional LLM provider to use ("azure_openai", "anthropic").
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
VerificationResponse object containing the result.
|
|
38
|
+
"""
|
|
39
|
+
payload = {"query": query}
|
|
40
|
+
if provider:
|
|
41
|
+
payload["provider"] = provider
|
|
42
|
+
|
|
43
|
+
response = self.session.post(f"{self.base_url}/verify/natural_language", json=payload)
|
|
44
|
+
response.raise_for_status()
|
|
45
|
+
return VerificationResponse(**response.json())
|
|
46
|
+
|
|
47
|
+
def verify_logic(self, query: str, provider: Optional[str] = None) -> LogicResponse:
|
|
48
|
+
"""
|
|
49
|
+
Verify a logic puzzle.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
query: The logic puzzle to solve.
|
|
53
|
+
provider: Optional LLM provider.
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
LogicResponse object.
|
|
57
|
+
"""
|
|
58
|
+
payload = {"query": query}
|
|
59
|
+
if provider:
|
|
60
|
+
payload["provider"] = provider
|
|
61
|
+
|
|
62
|
+
response = self.session.post(f"{self.base_url}/verify/logic", json=payload)
|
|
63
|
+
response.raise_for_status()
|
|
64
|
+
return LogicResponse(**response.json())
|
|
65
|
+
|
|
66
|
+
def verify_fact(self, claim: str, context: str, provider: Optional[str] = None) -> FactResponse:
|
|
67
|
+
"""
|
|
68
|
+
Verify a fact against a context.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
claim: The statement to verify.
|
|
72
|
+
context: The text context to verify against.
|
|
73
|
+
provider: Optional LLM provider.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
FactResponse object.
|
|
77
|
+
"""
|
|
78
|
+
payload = {
|
|
79
|
+
"claim": claim,
|
|
80
|
+
"context": context
|
|
81
|
+
}
|
|
82
|
+
if provider:
|
|
83
|
+
payload["provider"] = provider
|
|
84
|
+
|
|
85
|
+
response = self.session.post(f"{self.base_url}/verify/fact", json=payload)
|
|
86
|
+
response.raise_for_status()
|
|
87
|
+
return FactResponse(**response.json())
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Optional, Any, List, Dict
|
|
3
|
+
|
|
4
|
+
class VerificationResponse(BaseModel):
|
|
5
|
+
"""Response from natural language verification."""
|
|
6
|
+
status: str
|
|
7
|
+
final_answer: Optional[Any] = None
|
|
8
|
+
user_query: Optional[str] = None
|
|
9
|
+
translation: Optional[Dict[str, Any]] = None
|
|
10
|
+
verification: Optional[Dict[str, Any]] = None
|
|
11
|
+
latency_ms: Optional[float] = None
|
|
12
|
+
error: Optional[str] = None
|
|
13
|
+
|
|
14
|
+
class LogicResponse(BaseModel):
|
|
15
|
+
"""Response from logic verification."""
|
|
16
|
+
status: str
|
|
17
|
+
model: Optional[Dict[str, Any]] = None
|
|
18
|
+
error: Optional[str] = None
|
|
19
|
+
|
|
20
|
+
class FactResponse(BaseModel):
|
|
21
|
+
"""Response from fact verification."""
|
|
22
|
+
verdict: str
|
|
23
|
+
reasoning: Optional[str] = None
|
|
24
|
+
citations: Optional[List[str]] = None
|