workspace working
This commit is contained in:
26
test_ollama_auth.py
Normal file
26
test_ollama_auth.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import asyncio
|
||||
import aiohttp
|
||||
import json
|
||||
|
||||
async def test_embed():
|
||||
url = "http://localhost:11434/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"Status: {resp.status}")
|
||||
if resp.status == 200:
|
||||
data = await resp.json()
|
||||
print("Success:", data.keys())
|
||||
else:
|
||||
text = await resp.text()
|
||||
print("Error:", text)
|
||||
except Exception as e:
|
||||
print(f"Exception: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(test_embed())
|
||||
Reference in New Issue
Block a user