> ## Documentation Index
> Fetch the complete documentation index at: https://private-04b27de1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.coding.CodeExtractor

<h2 id="autogen.coding.CodeExtractor" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">CodeExtractor</span>
</h2>

```python theme={null}
CodeExtractor(*args, **kwargs)
```

(Experimental) A code extractor class that extracts code blocks from a message.

<b>Parameters:</b>

| Name       | Description |
| ---------- | ----------- |
| `*args`    |             |
| `**kwargs` |             |

### Instance Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### extract\_code\_blocks

```python theme={null}
extract_code_blocks(self, message: Optional[Union[str, list[Union[UserMessageTextContentPart, UserMessageImageContentPart]]]]) -> list[CodeBlock]
```

(Experimental) Extract code blocks from a message.<br />

<b>Parameters:</b>

| Name      | Description                                                                                                                                                  |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `message` | The message to extract code blocks from.<br /><br />**Type:** Optional\[Union\[str, list\[Union\[UserMessageTextContentPart, UserMessageImageContentPart]]]] |

<b>Returns:</b>

| Type                                                             | Description                                  |
| ---------------------------------------------------------------- | -------------------------------------------- |
| list\[[CodeBlock](/docs/api-reference/autogen/coding/CodeBlock)] | List\[CodeBlock]: The extracted code blocks. |

<br />
