mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
docs: remove multiple code blocks from comma-separated docs (#9323)
This commit is contained in:
parent
ba5fbaba70
commit
23928a3311
@ -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">
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user