docs: remove multiple code blocks from comma-separated docs (#9323)

This commit is contained in:
Michael Bianco 2023-08-16 12:51:58 -06:00 committed by GitHub
parent ba5fbaba70
commit 23928a3311
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,34 +5,24 @@ from langchain.llms import OpenAI
from langchain.chat_models import ChatOpenAI
output_parser = CommaSeparatedListOutputParser()
```
```python
format_instructions = output_parser.get_format_instructions()
prompt = PromptTemplate(
template="List five {subject}.\n{format_instructions}",
input_variables=["subject"],
partial_variables={"format_instructions": format_instructions}
)
```
```python
model = OpenAI(temperature=0)
```
```python
_input = prompt.format(subject="ice cream flavors")
output = model(_input)
```
```python
output_parser.parse(output)
```
The resulting output will be:
<CodeOutputBlock lang="python">
```