ethosnet/docs/api_docs.md
2024-10-08 00:16:08 +03:00

2.9 KiB

EthosNet API Documentation

Base URL

All API requests should be made to: http://your-domain.com/api/v1/

Authentication

Authentication is required for most endpoints. Include the JWT token in the Authorization header:

Authorization: Bearer <your_token>

Endpoints

Ethics

Evaluate Ethics

Evaluates the ethics of a given AI decision.

  • URL: /ethics/evaluate
  • Method: POST
  • Auth required: Yes
  • Data constraints:
{
  "decision": "[AI decision to evaluate]"
}
  • Success Response:
    • Code: 200
    • Content:
{
  "id": "eval_123",
  "decision_score": 75.5,
  "explanation": "The decision aligns with ethical guidelines...",
  "concerns": ["Potential privacy issues", "..."],
  "improvement_suggestions": ["Consider anonymizing data", "..."]
}

Get Ethical Guidelines

Retrieves the current set of ethical guidelines.

  • URL: /ethics/guidelines
  • Method: GET
  • Auth required: Yes
  • Success Response:
    • Code: 200
    • Content:
[
  "AI systems should respect human rights and privacy",
  "AI decision-making should be transparent and explainable",
  "..."
]

Knowledge Base

Add Knowledge Entry

Adds a new entry to the knowledge base.

  • URL: /knowledge/add
  • Method: POST
  • Auth required: Yes
  • Data constraints:
{
  "title": "[Entry title]",
  "content": "[Entry content]",
  "tags": ["tag1", "tag2"],
  "author_id": "[Author's ID]"
}
  • Success Response:
    • Code: 201
    • Content:
{
  "id": "entry_123",
  "title": "Introduction to AI Ethics",
  "content": "AI ethics is the branch of ethics that...",
  "tags": ["AI", "ethics", "introduction"],
  "author_id": "user_456",
  "created_at": "2023-06-15T10:30:00Z"
}

Search Knowledge Base

Searches the knowledge base for entries matching the query.

  • URL: /knowledge/search
  • Method: GET
  • Auth required: Yes
  • URL Params: query=[search string]
  • Success Response:
    • Code: 200
    • Content:
[
  {
    "id": "entry_123",
    "title": "Introduction to AI Ethics",
    "content": "AI ethics is the branch of ethics that...",
    "tags": ["AI", "ethics", "introduction"],
    "author_id": "user_456",
    "created_at": "2023-06-15T10:30:00Z"
  },
  {
    "id": "entry_124",
    "title": "Ethical Considerations in Machine Learning",
    "content": "When developing machine learning models...",
    "tags": ["AI", "ethics", "machine learning"],
    "author_id": "user_789",
    "created_at": "2023-06-16T14:45:00Z"
  }
]

Error Responses

  • Condition: If the request is invalid or an error occurs.
  • Code: 400 BAD REQUEST or 500 INTERNAL SERVER ERROR
  • Content:
{
  "error": "Error message describing the issue"
}

This documentation will be expanded as new endpoints are added to the API.