marcolardera / chatgpt-cli

Simple yet effective command line client for chatting with ChatGPT using the official API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Readme should explain how to refer to the context files.

mk-pmb opened this issue · comments

commented
$ ./chatgpt.sh -c hi.txt -c cu.txt
ChatGPT CLI
Model in use: gpt-3.5-turbo
Context file: hi.txt
Context file: cu.txt
───────────────────────────────────────────────────────────────────────────
[0] >>> I requested my ChatGPT client shows you some text files for this
conversation. Did you receive any? Do they have names?

No, I'm sorry, but as an AI language model, I don't have the capability
to receive or view files. I can only generate text based on the input I
receive.

… then how do I refer to them?

Edit: For a moment I felt clever.

[0] >>> Did you receive some system mesage along with this question?

No, I did not receive any system message along with your question.
Is there anything else I can help you with?

Let's say you have a file named "poem.txt" like this:

Roses are red
Violets are blue,
Sugar is sweet
And so are you

chatgpt -c poem.txt

[0] >>> Hello, plese comment the poem above

Sure, here's a comment for the poem:                                                                                                                                                                                                          

The poem is a classic example of a short and simple rhyming verse. It follows the traditional AABB rhyme scheme, where the first two lines rhyme with each other and the last two lines rhyme with each other. The use of familiar imagery    
like roses, violets, and sugar adds a touch of sweetness and romance to the poem. Overall, it's a charming and endearing expression of affection. 

I often use the word "above" to refer the context ("help me debugging the code above" or just "this code"). There are probably many other phrases that works like that. On the other side ChatGPT don't have the notion of a "file sent by a client" or similar concepts.

commented

Thanks, that will help at least with the case of only one context file. How can we address multiple files?

Just a basic example comparing two code files.

file_1 :

integers=[1, 2, 3, 4, 5]

squares=[x*x for x in integers]

print(squares)

file_2 :

integers=[1, 2, 3, 4, 5]

squares=map(lambda x:x*x, integers)

print(squares)

ChatGPT:

chatgpt -c file_1 -c file_2

Model in use: gpt-3.5-turbo
Context file: file_1
Context file: file_2

[0] >>> Hello, explain the difference between this two code snippets

The difference between these two code snippets is the way the square of each integer in the integers list is calculated.                                                                                                                      

In the first code snippet, a list comprehension is used to calculate the squares of each integer. It iterates over each element in the integers list and calculates the square by multiplying the element with itself. The result is then     
stored in the squares list.                                                                                                                                                                                                                   

In the second code snippet, the map() function is used along with a lambda function to calculate the squares. The map() function applies the lambda function to each element in the integers list and returns a map object. The lambda        
function simply calculates the square of the element. The squares variable holds this map object.                                                                                                                                             

While both approaches achieve the same result of calculating the squares of the integers, the first code snippet directly creates a list of squared values, while the second code snippet returns a map object.

In general it seems to me that the trick is referring the context files just as you do for previous messages in the conversation. However there may be cases where this is more difficult. If you have any please share it!