Skip to content

Send IPython history in the prompt #6

@lucasrcezimbra

Description

@lucasrcezimbra
  • Send the history by default
  • Limit the number of tokens of each IPython row
  • Create a flag to disable the history sent
  • Update docs warning about sending the history and how to disable it

Prompt example:

This is the history of the current IPython session:

\```
In [1]: %llm 'a fibonacci function'

In [2]: def fibonacci(n):
   ...:     if n <= 0:
   ...:         return []
   ...:     elif n == 1:
   ...:         return [0]
   ...:     elif n == 2:
   ...:         return [0, 1]
   ...:
   ...:     fib_sequence = [0, 1]
   ...:     for i in range(2, n):
   ...:         next_value = fib_sequence[-1] + fib_sequence[-2]
   ...:         fib_sequence.append(next_value)
   ...:
   ...:     return fib_sequence
   ...:
   ...: fibonacci(10)
Out[2]: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
\```

User's message:
<user_prompt>

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions