-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add lepton, quick start notebook, examples
- Loading branch information
1 parent
d7d5a60
commit 83ab759
Showing
8 changed files
with
265 additions
and
12 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
GROQ_API_KEY=gsk_asdsaxxxxxxxxxx | ||
OPENAI_API_KEY=sk_xxxxxxx | ||
ANYSCALE_API_KEY=esecret_xxxxxxxx | ||
OPENAI_API_KEY=sk-xxxxxxxxx | ||
GOOGLE_API_KEY=xxxxxxxxx | ||
MISTRAL_API_KEY=xxxxxxxxx | ||
TOGETHER_API_KEY=xxxxxxxxx | ||
ANTHROPIC_API_KEY=sk-xxxxxxxx | ||
FIREWORKS_API_KEY=rxxxxxxxx | ||
REPLICATE_API_KEY=rxxx | ||
LEPTON_API_KEY=xxxxxxxxx | ||
DEEPINFRA_API_KEY=xxxxxxx |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from api4all import EngineFactory | ||
|
||
# All the API keys should be in the .env file in the same directory as this file | ||
|
||
messages = [ | ||
{"role": "system", | ||
"content": "You are a helpful assistant for my Calculus class."}, | ||
{"role": "user", | ||
"content": "What is the current status of the economy?"}, | ||
{"role": "assistant", | ||
"content": "I'm sorry, but as a Calculus assistant, I don't have the ability to provide real-time economic updates. However, I can help you understand economic concepts from a mathematical perspective. For example, I can explain how calculus is used in economics for optimization and understanding change."}, | ||
{"role": "user", | ||
"content": "Oh, I see. Can you explain how calculus is used in economics?"}, | ||
{"role": "assistant", | ||
"content": "Sure! In economics, calculus is used for optimization. For example, businesses often want to maximize profits or minimize costs. With calculus, we can find the 'optimal' point by setting the derivative of the profit or cost function to zero and solving for the variable. Calculus is also used to understand how economic quantities change. For example, the derivative of a function gives the rate of change of the function, which can represent things like the change in cost for producing one more unit of a good (marginal cost), or the change in revenue from selling one more unit of a good (marginal revenue)."}, | ||
{"role": "user", | ||
"content": "Interesting. Can you tell me more about the Fundamental Theorem of Calculus?"} | ||
] | ||
|
||
|
||
# engine = EngineFactory.create_engine(provider="google", model="google/gemini-1.0-pro", messages=messages, temperature=0.5, max_tokens=256, top_p=0.9, stop=None) | ||
engine = EngineFactory.create_engine(provider="together", model="mistralai/Mixtral-8x7B-Instruct-v0.1", messages=messages, temperature=0.5, max_tokens=256, top_p=0.9, stop=None) | ||
# engine = EngineFactory.create_engine(provider="anthropic", model="anthropic/claude-3-haiku", messages=messages, temperature=0.5, max_tokens=256, top_p=0.9, stop=None) | ||
# engine = EngineFactory.create_engine(provider="mistral", model="mistral/mistral-small-latest", messages=messages, temperature=0.5, max_tokens=256, top_p=0.9, stop=None) | ||
|
||
|
||
response = engine.generate_response() | ||
|
||
# See the response and also checkout the log in logfile.log | ||
print(response) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from api4all import EngineFactory | ||
import os | ||
|
||
os.environ["TOGETHER_API_KEY"] = "xxxxx" # Replace with your API key | ||
os.environ["GOOGLE_API_KEY"] = "xxxxx" | ||
os.environ["ANTHROPIC_API_KEY"] = "xxxxx" | ||
os.environ["MISTRAL_API_KEY"] = "xxxxx" | ||
|
||
messages = [ | ||
{"role": "system", | ||
"content": "You are a helpful assistant for my Calculus class."}, | ||
{"role": "user", | ||
"content": "What is the current status of the economy?"}, | ||
{"role": "assistant", | ||
"content": "I'm sorry, but as a Calculus assistant, I don't have the ability to provide real-time economic updates. However, I can help you understand economic concepts from a mathematical perspective. For example, I can explain how calculus is used in economics for optimization and understanding change."}, | ||
{"role": "user", | ||
"content": "Oh, I see. Can you explain how calculus is used in economics?"}, | ||
{"role": "assistant", | ||
"content": "Sure! In economics, calculus is used for optimization. For example, businesses often want to maximize profits or minimize costs. With calculus, we can find the 'optimal' point by setting the derivative of the profit or cost function to zero and solving for the variable. Calculus is also used to understand how economic quantities change. For example, the derivative of a function gives the rate of change of the function, which can represent things like the change in cost for producing one more unit of a good (marginal cost), or the change in revenue from selling one more unit of a good (marginal revenue)."}, | ||
{"role": "user", | ||
"content": "Interesting. Can you tell me more about the Fundamental Theorem of Calculus?"} | ||
] | ||
|
||
|
||
# engine = EngineFactory.create_engine(provider="google", model="google/gemini-1.0-pro", messages=messages, temperature=0.5, max_tokens=256, top_p=0.9, stop=None) | ||
engine = EngineFactory.create_engine(provider="together", model="mistralai/Mixtral-8x7B-Instruct-v0.1", messages=messages, temperature=0.5, max_tokens=256, top_p=0.9, stop=None) | ||
# engine = EngineFactory.create_engine(provider="anthropic", model="anthropic/claude-3-haiku", messages=messages, temperature=0.5, max_tokens=256, top_p=0.9, stop=None) | ||
# engine = EngineFactory.create_engine(provider="mistral", model="mistral/mistral-small-latest", messages=messages, temperature=0.5, max_tokens=256, top_p=0.9, stop=None) | ||
|
||
|
||
response = engine.generate_response() | ||
|
||
# See the response and also checkout the log in logfile.log | ||
print(response) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "UMV-mLLMafW1" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip install api4all -q" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "b_1w6U_cycvS" | ||
}, | ||
"source": [ | ||
"## Run\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "N8MBeKVoahc9" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from api4all import EngineFactory\n", | ||
"import os\n", | ||
"os.environ[\"TOGETHER_API_KEY\"] = \"xxx\"\n", | ||
"os.environ[\"MISTRAL_API_KEY\"] = \"xxxx\"\n", | ||
"\n", | ||
"messages = [\n", | ||
" {\"role\": \"system\",\n", | ||
" \"content\": \"You are a helpful assistent for the White House\"},\n", | ||
" {\"role\": \"user\",\n", | ||
" \"content\": \"What is the current status of the economy?\"}\n", | ||
"]\n", | ||
"\n", | ||
"engine = EngineFactory.create_engine(provider=\"together\", model=\"google/gemma-7b-it\", messages=messages, temperature=0.5, max_tokens=256, top_p=0.9, stop=None)\n", | ||
"# engine = EngineFactory.create_engine(provider=\"mistral\", model=\"mistral/mistral-small-latest\", messages=messages, temperature=0.5, max_tokens=256, top_p=0.9, stop=None)\n", | ||
"\n", | ||
"response = engine.generate_response()\n", | ||
"\n", | ||
"# See the response and also check the logfile.log\n", | ||
"print(response)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"colab": { | ||
"provenance": [] | ||
}, | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |