Giter Club home page Giter Club logo

phospho-app / phospho Goto Github PK

View Code? Open in Web Editor NEW
297.0 297.0 18.0 21.26 MB

Text analytics for LLM apps. PostHog for prompts. Extract evaluations, intents and events from text messages. phospho leverages LLM (OpenAI, MistralAI, Ollama, etc.)

Home Page: https://phospho.ai

License: Apache License 2.0

Python 51.49% Jupyter Notebook 8.81% Dockerfile 0.11% Makefile 0.11% Batchfile 0.06% TypeScript 38.89% JavaScript 0.39% CSS 0.15%
ai analytics generative-ai llm nextjs nlp ollama python self-hosted typescript

phospho's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

phospho's Issues

Select different LLM provider from env variables

You should be able to change the LLM provider without changing the code, just by specifying the model, base_url and api_key.
Should work with any openai client compatible server (Mistral, Ollama, vLLM, together AI...)

Right now, you need to change how the OpenAI client is initialized (in the pipeline, not documented yet).

Input and output formating before logging a task

When formatting an OpenAI request, should we format the task input as "{role}: {content}", and not "{content}" ?

In phospho/extractor.py :

def detect_str_from_input(input: RawDataType) -> str:
    # OpenAI inputs: Look for messages list
    if (
        isinstance(input, dict)
        and ("messages" in input.keys())
        and isinstance(input["messages"], list)
        and (len(input["messages"]) > 0)
        and ("content" in input["messages"][-1])
    ):
        role = input["messages"][-1].get("role", None)
        content = input["messages"][-1].get("content", None)
        if role is not None and content is not None:
            return f"{role}: {content}" # Should we really add the role?
        elif content is not None:
            return str(content)

    # Unimplemented. Translate everything to str
    return str(input)

Add type hints

For documentation purposes and external stakeholders, it's best to have types

Add content hints to Message

Instead of

class Message:

    # Typed attributes
    def __init__(self, content: str, payload={}, metadata={}):
        self.content = content # can be empty, even though it doesn't make sense. Cannot be None
        self.payload = payload # Implemented by the dev user, can be empty
        self.metadata = metadata # timestamp, user_id, etc. TODO: define the metadata

Do

class Message:
    content: str
    payload: dict
    metadata: dict

    # Typed attributes
    def __init__(self, content: str, payload={}, metadata={}):
        self.content = content # can be empty, even though it doesn't make sense. Cannot be None
        self.payload = payload # Implemented by the dev user, can be empty
        self.metadata = metadata # timestamp, user_id, etc. TODO: define the metadata

To add type hints and autocompletiton.

Even better, do

from dataclasses import dataclass, field

@dataclass
class Message:
    content: str # can be empty, even though it doesn't make sense. Cannot be None
    payload: dict = field(default_factory=dict) # Implemented by the dev user, can be empty
    metadata: dict = field(default_factory=dict) # timestamp, user_id, etc. TODO: define the metadata

This avoids boilerplate.

Sphinx deployment to github page raises a 404

The python module doc is automatically created with sphinx in github actions, but the deployment to gh-pages doesn't work.
Issues related to path ? (doc is no longer in /docs but in python-module/docs)

Lower the quantum complexity of spline reticulation

There is a big issue with the mainframe computation leading to trailing zeros error in some asynchronous and/or duplicated contexts. Ex: CERN supercomputers.

This problem only affects 0.0001% of the computing instances, but should be addressed diligently.

TODO: Optimize the latency for this use case (hashmaps?)

Add a rate limiter

Enforce the respect of rate limits, especially in async mode and parallel execution

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.