-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop default api url for host of clients #209
Changes from 8 commits
b020bd7
ffdebc4
f76498b
6193b74
832dbbe
eac45b0
43989c1
8ee43e7
5ee2758
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
TEST_API_URL=https://test.api.aleph-alpha.com | ||
TEST_API_URL=https://inference-api.your-domain.com | ||
TEST_TOKEN= |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,4 +139,6 @@ cython_debug/ | |
|
||
# IDEs | ||
.vscode/ | ||
.idea/ | ||
.idea/ | ||
|
||
.ruff_cache/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.8.1 | ||
hooks: | ||
- id: ruff | ||
- id: ruff-format | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: 'v1.13.0' | ||
hooks: | ||
- id: mypy | ||
pass_filenames: false | ||
args: ['aleph_alpha_client', 'tests'] | ||
language: system |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ Synchronous client. | |
from aleph_alpha_client import Client, CompletionRequest, Prompt | ||
import os | ||
|
||
client = Client(token=os.getenv("AA_TOKEN")) | ||
client = Client(token=os.getenv("AA_TOKEN"), host="https://inference-api.your-domain.com") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not get the host from the .env, too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch. Probably the better approach, will update. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
prompt = Prompt.from_text("Provide a short description of AI:") | ||
request = CompletionRequest(prompt=prompt, maximum_tokens=20) | ||
result = client.complete(request, model="luminous-extended") | ||
|
@@ -32,7 +32,7 @@ Synchronous client with prompt containing an image. | |
from aleph_alpha_client import Client, CompletionRequest, PromptTemplate, Image | ||
import os | ||
|
||
client = Client(token=os.getenv("AA_TOKEN")) | ||
client = Client(token=os.getenv("AA_TOKEN"), host="https://inference-api.your-domain.com") | ||
image = Image.from_file("path-to-an-image") | ||
prompt_template = PromptTemplate("{{image}}This picture shows ") | ||
prompt = prompt_template.to_prompt(image=prompt_template.placeholder(image)) | ||
|
@@ -50,7 +50,7 @@ Asynchronous client. | |
from aleph_alpha_client import AsyncClient, CompletionRequest, Prompt | ||
|
||
# Can enter context manager within an async function | ||
async with AsyncClient(token=os.environ["AA_TOKEN"]) as client: | ||
async with AsyncClient(token=os.environ["AA_TOKEN"], host="https://inference-api.your-domain.com") as client: | ||
request = CompletionRequest( | ||
prompt=Prompt.from_text("Request"), | ||
maximum_tokens=64, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very important!