workspace working
This commit is contained in:
23
test_ollama_host.py
Normal file
23
test_ollama_host.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import asyncio
|
||||
import aiohttp
|
||||
|
||||
async def test_host(host):
|
||||
url = f"http://{host}/api/embed"
|
||||
payload = {"model": "snowflake-arctic-embed:latest", "input": ["test"]}
|
||||
headers = {"Content-Type": "application/json"}
|
||||
async with aiohttp.ClientSession() as session:
|
||||
try:
|
||||
async with session.post(url, json=payload, headers=headers) as resp:
|
||||
print(f"Host {host}: Status {resp.status}")
|
||||
if resp.status != 200:
|
||||
text = await resp.text()
|
||||
print(f"Error: {text}")
|
||||
except Exception as e:
|
||||
print(f"Exception: {e}")
|
||||
|
||||
async def main():
|
||||
await test_host("localhost:11434")
|
||||
await test_host("0.0.0.0:11434")
|
||||
await test_host("127.0.0.1:11434")
|
||||
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user