Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timkoehne/th-koeln-gpt-lab-python-api
Python Interface for GPT-Lab at TH Köln
https://github.com/timkoehne/th-koeln-gpt-lab-python-api
gpt-lab openai python th-koeln
Last synced: 23 days ago
JSON representation
Python Interface for GPT-Lab at TH Köln
- Host: GitHub
- URL: https://github.com/timkoehne/th-koeln-gpt-lab-python-api
- Owner: timkoehne
- Created: 2024-04-22T19:28:49.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-04-22T19:32:37.000Z (8 months ago)
- Last Synced: 2024-04-23T21:41:12.621Z (8 months ago)
- Topics: gpt-lab, openai, python, th-koeln
- Language: Python
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# TH Köln GPT-Lab Python API
This project provides a python interface to access GPT4 through [TH Köln GPT-Lab](https://ki.th-koeln.de/interface.php).
Just like the website this only works from within the university network (vpn) and with a valid CampusID login.# Preparation
This uses your browsers cookies to login so you need to provide it once.You'll need to use the browsers development tools to find these and save them into ```cookies.json``` according to ```cookies_template.json```. After sending a message you should be able to find your cookies in the network tab like this:
![img](extra/where%20to%20find%20cookies.png)After that your login should be valid for a while. If it becomes invalid just login using your browser, since they share the same cookie this also refreshes your api login.
# Usage
## Conversation with continuous context
```python
>>> from th_gpt import TH_GPT
>>> chat = TH_GPT()
>>> chat.send_message("How tall is the Empire State Building in meters?")
'The Empire State Building is 381 meters tall, not including its antennas.'
>>> chat.send_message("How many feet is that?")
'The Empire State Building is 1,250 feet tall, excluding its antennas.'
```## Conversation without continuous context
```python
>>> from th_gpt import TH_GPT
>>> chat = TH_GPT()
>>> chat.send_message_without_context("How tall is the Empire State Building in meters?")
'The Empire State Building is 381 meters tall, not including its antenna.'
>>> chat.send_message_without_context("How many feet is that?")
'Can you specify the measurement you need converted into feet?'```