Skip to content

Instantly share code, notes, and snippets.

View fabian57fabian's full-sized avatar
Coding for own projects

Fabian Greavu fabian57fabian

Coding for own projects
View GitHub Profile
fabian57fabian /
Last active April 3, 2024 15:33
deepeval class for cohere LLM api (command-r model)
from typing import Optional
from cohere import Client
from deepeval.models.base_model import DeepEvalBaseLLM
class CohereModel(DeepEvalBaseLLM):
def __init__(
cohere_api_key: str,
fabian57fabian /
Created September 25, 2023 22:14
Retrieve git rev, short and tag
import subprocess
from typing import Optional
def get_git_revision_hash() -> str:
return subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
def get_git_revision_short_hash() -> str:
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()
fabian57fabian /
Last active September 22, 2023 12:58
Test MQTT connection on python
import time
import paho.mqtt.client as mqtt
def test_connection(ip, port, _user, _pass, clientid, topic, test_mess="test") -> (bool, str):
Tests a MQTT connection with a test message
@param ip: Hostname
@param port: Port