Skip to content

Commit

Permalink
fix: escape newline in Python code block (#221)
Browse files Browse the repository at this point in the history
Fixes:
```
    { "role": "user", "content": f"Question: {question}
                                 ^
SyntaxError: unterminated string literal (detected at line 18)
```
  • Loading branch information
bvs-langchain authored May 6, 2024
2 parents d290f9a + 8732441 commit 70920f4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def chat_pipeline(question: str):
context = my_tool(question)
messages = [
{ "role": "system", "content": "You are a helpful assistant. Please respond to the user's request only based on the given context." },
{ "role": "user", "content": f"Question: {question}\nContext: {context}"}
{ "role": "user", "content": f"Question: {question}\\nContext: {context}"}
]
chat_completion = client.chat.completions.create(
model="gpt-3.5-turbo", messages=messages
Expand Down

0 comments on commit 70920f4

Please sign in to comment.