Skip to content

Instantly share code, notes, and snippets.

View alonsosilvaallende's full-sized avatar

Alonso Silva alonsosilvaallende

View GitHub Profile
@alonsosilvaallende
alonsosilvaallende / Exploration-OpenRouter-Langchain.ipynb
Last active July 18, 2023 08:52
OpernRouter-Langchain-Palm2.ipynb
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.
@alonsosilvaallende
alonsosilvaallende / LLM_generating_random_countries.ipynb
Created July 16, 2023 20:54
LLM_picking_countries_at_random.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alonsosilvaallende
alonsosilvaallende / LLM_generating_random_numbers.ipynb
Created July 14, 2023 20:20
LLM_generating_random_numbers.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alonsosilvaallende
alonsosilvaallende / impatient.py
Created July 12, 2023 07:54
Impatient-OpenRouter
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',
print(llm("Tell me a joke"))
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}'
}],
@alonsosilvaallende
alonsosilvaallende / llm.py
Created July 12, 2023 06:14
llmOpenRouter
def llm(text: str) -> str:
return openai.ChatCompletion.create(
model='openai/gpt-4',
headers={
"HTTP-Referer": OPENROUTER_REFERRER
},
messages=[{
'role': 'user',
'content': f'{text}'
}],
OPENROUTER_REFERRER = "https://github.com/alonsosilvaallende/chatplotlib-openrouter"
openai.api_base = "https://openrouter.ai/api/v1"
openai.api_key = os.getenv("YOUR_OPENROUTER_API_KEY")