Skip to content
Snippets Groups Projects
Commit 1b8977d6 authored by Jan Frenzel's avatar Jan Frenzel
Browse files

Improve summarize example instructions in README.md

parent 051272b6
No related branches found
No related tags found
1 merge request!2Add Summarize example
......@@ -18,7 +18,7 @@ pip install -r requirements.txt
## Usage
1. Put your API key in the file `my_key`.
1. Create a file `my_key` and put your API key in the file. For security reasons API Key is necessary. You have to obtain the API Key from the llm.scads.ai team. You can find instructions on https://llm.scads.ai/ .
2. Then start the script `main.py` from your bash shell and provide a plain text file:
```bash
......
......@@ -3,8 +3,13 @@
import sys
from openai import OpenAI
my_api_key = ""
with open("my_key") as keyfile:
my_api_key = keyfile.readline()[:-1]
try:
with open("my_key") as keyfile:
my_api_key = keyfile.readline().strip()
except FileNotFoundError:
print("Error: The file 'my_key' was not found. Please make sure the file exists and contains your API key.")
exit(1)
client = OpenAI(base_url="https://llm.scads.ai/v1",api_key=my_api_key)
......@@ -43,7 +48,7 @@ response = client.chat.completions.create(
max_tokens = 2048 # longer answer
)
# Print the joke
# Print the summary
print("""
Summary:
""")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment