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