Spaces:
Sleeping
Sleeping
File size: 2,951 Bytes
a591d60 6c8f8c8 a591d60 6c8f8c8 a591d60 e51e040 a591d60 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
---
title: VerboAI Search Engine API
emoji: π
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: mit
---
# Search Engine API
A FastAPI-based search engine that uses DuckDuckGo's lite search interface.
## Setup
1. Install the required dependencies:
```bash
pip install -r requirements.txt
```
2. Run the API server:
```bash
uvicorn main:app --reload
```
The API will be available at `http://localhost:8000`
## API Documentation
Once the server is running, you can access the interactive API documentation at:
- Swagger UI: `http://localhost:8000/docs`
- ReDoc: `http://localhost:8000/redoc`
## API Endpoints
### POST /search
Search for content using a search phrase.
Request body:
```json
{
"search_phrase": "your search query"
}
```
Response:
```json
{
"results": {
"Item_1": {
"title": "Result title",
"snippet": "Result snippet",
"linkText": "Link text"
},
// ... more items
}
}
```
### POST /websiteView
View and browse a website's content in Markdown format.
Request body:
```json
{
"url": "https://example.com"
}
```
Response:
```json
{
"title": "Website Title",
"markdown": "# Website Title\n\nMain content in Markdown format...\n\n## Links\n\n- [Link text](https://example.com/link)\n\n## Images\n\n",
"links": [
{
"text": "Link text",
"url": "https://example.com/link",
"markdown": "[Link text](https://example.com/link)"
}
],
"images": [
{
"src": "https://example.com/image.jpg",
"alt": "Image description",
"markdown": ""
}
],
"url": "https://example.com"
}
```
### POST /searchWithContent
Search for content and retrieve the full content of the top N results.
Request body:
```json
{
"search_phrase": "your search query",
"top_n": 5
}
```
Response:
```json
{
"results": {
"Item_1": {
"title": "Result title",
"snippet": "Result snippet",
"linkText": "https://example.com",
"content": {
"title": "Website Title",
"markdown": "# Website Title\n\nMain content in Markdown format...",
"links": [...],
"images": [...],
"url": "https://example.com"
}
},
// ... more items up to top_n
}
}
```
The `content` field for each result contains the full website content in Markdown format, including:
- Title as a level 1 heading
- Main content
- Links section with Markdown-formatted links
- Images section with Markdown-formatted images
## Error Handling
The API will return appropriate HTTP status codes and error messages in case of failures:
- 500: Internal server error
- 422: Validation error (invalid request body) |