Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import openai | |
openai.api_base = "https://openrouter.ai/api/v1" | |
openai.api_key = os.getenv("OPENAI_API_KEY") | |
OPENROUTER_REFERRER = "https://github.com/alonsosilvaallende/chatplotlib-openrouter" | |
def llm(text: str) -> str: | |
return openai.ChatCompletion.create( | |
model='openai/gpt-4-32K', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print(llm("Tell me a joke")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def llm(text: str) -> str: | |
return openai.ChatCompletion.create( | |
model='openai/gpt-4-32k', | |
headers={ | |
"HTTP-Referer": OPENROUTER_REFERRER | |
}, | |
messages=[{ | |
'role': 'user', | |
'content': f'{text}' | |
}], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def llm(text: str) -> str: | |
return openai.ChatCompletion.create( | |
model='openai/gpt-4', | |
headers={ | |
"HTTP-Referer": OPENROUTER_REFERRER | |
}, | |
messages=[{ | |
'role': 'user', | |
'content': f'{text}' | |
}], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OPENROUTER_REFERRER = "https://github.com/alonsosilvaallende/chatplotlib-openrouter" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openai.api_base = "https://openrouter.ai/api/v1" | |
openai.api_key = os.getenv("YOUR_OPENROUTER_API_KEY") |