Skip to content

Commit 7ffb21f

Browse files
committed
small changes
1 parent 4302e80 commit 7ffb21f

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using namespace std;
3333
using namespace cohere;
3434

3535
int main() {
36-
Cohere co = Cohere("YOUR_API_KEY");
36+
Cohere co{"YOUR_API_KEY"}; // can rewrite to make it more "Pythonic"
3737
Json chat = co.Chat->chat(
3838
"hello world!",
3939
"command"
@@ -49,7 +49,7 @@ For chat streams, you can perform the following:
4949

5050
```cpp
5151
int main() {
52-
Cohere co = Cohere();
52+
Cohere co("YOUR_API_KEY");
5353
Json chat_stream = co.Chat->chat(
5454
"Tell me about Terry Fox",
5555
"command",

main.cpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,13 @@ int main() {
2323
// Json words = co.Tokens->detokenize({40723,21641}, "command");
2424
// cout << words.dump() << endl;
2525

26-
Cohere co = Cohere(); // enviroment variable: CO_API_KEY
26+
Cohere co; // enviroment variable: CO_API_KEY
2727

28-
ifstream ifs{"prompts.txt"};
29-
30-
vector<string> prompts;
31-
string prompt;
32-
33-
while (ifs >> prompt) {
34-
prompts.push_back(prompt);
35-
}
36-
37-
cout << "{" << prompts[0] << "}" << endl;
38-
39-
for (auto &p: prompts) {
40-
Json chat = co.Chat->chat(p, "command");
41-
cout << chat << endl;
42-
}
28+
Json chat = co.Chat->chat(
29+
"hello world!",
30+
"command"
31+
);
4332

33+
cout << chat.dump() << endl;
4434
return 0;
4535
}

0 commit comments

Comments
 (0)