# `Twilio.Knowledge.V2.KnowledgeBase.KnowledgeService`
[🔗](https://github.com/jeffhuen/twilio_elixir/blob/main/lib/twilio/knowledge/v2/knowledge_base/knowledge_service.ex#L2)

Service for Knowledge API operations.

Operations: `list`, `create`, `fetch`, `delete`

# `create`

```elixir
@spec create(Twilio.Client.t(), String.t(), map(), keyword()) ::
  {:ok, Twilio.Resources.Knowledge.V2.KnowledgeBase.Knowledge.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}
```

Create a new knowledge source from various data sources such as web content,  files, or raw text. The
knowledge source will be processed and indexed to enable semantic search and retrieval.

## Best practices

To maximize the effectiveness of Knowledge, consider the following best practices:

# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
**Assess and optimize content:** Regularly evaluate your existing Knowledge sources for accuracy, relevance, and coverage.
Identify any gaps or outdated information that could hinder the Assistant's performance.

# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
**Simplify and structure content:** Ensure that the content is clear and concise. Use headings, bullet points, and metadata to make information straightforward
to navigate for both the AI Assistant and your users.

**Prioritize high-impact content:** Focus on updating and
maintaining content that is frequently accessed or critical to customer interactions. Consider using analytics to
determine which Knowledge entries are most valuable.

Operation: `CreateKnowledge` | Tags: Knowledge

# `delete`

```elixir
@spec delete(Twilio.Client.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:ok, map(), map()} | :ok | {:error, Twilio.Error.t()}
```

# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
Permanently delete knowledge source and all its associated data, including  processed chunks and embeddings. This action cannot be undone. The knowledge  resource will no longer be available for search or retrieval operations.

Operation: `DeleteKnowledge` | Tags: Knowledge

# `fetch`

```elixir
@spec fetch(Twilio.Client.t(), String.t(), String.t(), keyword()) ::
  {:ok, Twilio.Resources.Knowledge.V2.KnowledgeBase.Knowledge.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}
```

Fetch detailed information about a specific knowledge source by its ID.  This returns the complete knowledge
source object including  processing status, source details, and configuration information.

Operation: `FetchKnowledge` | Tags: Knowledge

# `list`

```elixir
@spec list(Twilio.Client.t(), String.t(), map(), keyword()) ::
  {:ok, Twilio.Page.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}
```

Retrieve a paginated list of all knowledge sources for a specific knowledge base.  Knowledge sources represent
unstructured data sources such as documents,  websites, or text content that can be used for context and information
retrieval.

Operation: `ListKnowledge` | Tags: Knowledge

## Query Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `page` | integer | The page index. This value is simply for client state. |

# `stream`

```elixir
@spec stream(Twilio.Client.t(), String.t(), map(), keyword()) :: Enumerable.t()
```

Stream: Retrieve a paginated list of all knowledge sources for a specific knowledge base.  Knowledge sources represent
unstructured data sources such as documents,  websites, or text content that can be used for context and information
retrieval. (lazy auto-pagination).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
