{"id":28635546,"url":"https://github.com/comet-ml/comet-llm-legacy","last_synced_at":"2026-07-02T12:38:20.749Z","repository":{"id":266202873,"uuid":"850694372","full_name":"comet-ml/comet-llm-legacy","owner":"comet-ml","description":"This repo was replaced by opik: https://github.com/comet-ml/opik","archived":false,"fork":false,"pushed_at":"2024-09-02T10:39:01.000Z","size":1324,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-07-02T12:38:04.402Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/comet-ml.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-01T14:17:02.000Z","updated_at":"2025-06-11T17:14:34.000Z","dependencies_parsed_at":"2024-12-03T04:31:05.200Z","dependency_job_id":"f21aef8e-97cf-48e6-9c01-e6263c5b916b","html_url":"https://github.com/comet-ml/comet-llm-legacy","commit_stats":null,"previous_names":["comet-ml/comet-llm-legacy"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/comet-ml/comet-llm-legacy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comet-ml%2Fcomet-llm-legacy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comet-ml%2Fcomet-llm-legacy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comet-ml%2Fcomet-llm-legacy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comet-ml%2Fcomet-llm-legacy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/comet-ml","download_url":"https://codeload.github.com/comet-ml/comet-llm-legacy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comet-ml%2Fcomet-llm-legacy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35048062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-02T02:00:06.368Z","response_time":173,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-12T17:10:57.229Z","updated_at":"2026-07-02T12:38:20.719Z","avatar_url":"https://github.com/comet-ml.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cb\u003eCometLLM\u003c/b\u003e was replaced by \u003cb\u003eopik\u003c/b\u003e - see https://github.com/comet-ml/opik\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cpicture\u003e\n        \u003csource alt=\"cometLLM\" media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/comet-ml/comet-llm/raw/main/logo-dark.svg\"\u003e\n        \u003cimg alt=\"cometLLM\" src=\"https://github.com/comet-ml/comet-llm/raw/main/logo.svg\"\u003e\n    \u003c/picture\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://pypi.org/project/comet-llm\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/v/comet-llm\" alt=\"PyPI version\"\u003e\n    \u003c/a\u003e\n    \u003ca rel=\"nofollow\" href=\"https://opensource.org/license/mit/\"\u003e\n        \u003cimg alt=\"GitHub\" src=\"https://img.shields.io/badge/License-MIT-blue.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.comet.com/docs/v2/guides/large-language-models/overview/\" rel=\"nofollow\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/cometLLM-Docs-blue.svg\" alt=\"cometLLM Documentation\"\u003e\n    \u003c/a\u003e\n    \u003ca rel=\"nofollow\" href=\"https://pepy.tech/project/comet-llm\"\u003e\n        \u003cimg style=\"max-width: 100%;\" src=\"https://static.pepy.tech/badge/comet-llm\" alt=\"Downloads\"\u003e\n    \u003c/a\u003e\n    \u003ca rel=\"nofollow\" href=\"https://colab.research.google.com/github/comet-ml/comet-llm/blob/main/examples/CometLLM_Prompts.ipynb\"\u003e\n        \u003cimg src=\"https://colab.research.google.com/assets/colab-badge.svg\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003cb\u003eCometLLM\u003c/b\u003e is a tool to log and visualize your LLM prompts and chains. Use CometLLM to identify effective prompt strategies, streamline your troubleshooting, and ensure reproducible workflows!\n\u003c/p\u003e\n\u003c/p\u003e\n\n![CometLLM Preview](https://github.com/comet-ml/comet-llm/raw/main/comet_llm.gif)\n\n## ⚡️ Quickstart\n\nInstall `comet_llm` Python library with pip:\n\n```bash\npip install comet_llm\n```\n\nIf you don't have already, [create your free Comet account](https://www.comet.com/signup/?utm_source=comet_llm\u0026utm_medium=referral\u0026utm_content=github\u0026framework=llm) and grab your API Key from the account settings page.\n\nNow you are all set to log your first prompt and response:\n\n```python\nimport comet_llm\n\ncomet_llm.log_prompt(\n    prompt=\"What is your name?\",\n    output=\" My name is Alex.\",\n    api_key=\"\u003cYOUR_COMET_API_KEY\u003e\",\n)\n```\n\n## 🎯 Features\n\n- [x] Log your prompts and responses, including prompt template, variables, timestamps and duration and any metadata that you need.\n- [x] Visualize your prompts and responses in the UI.\n- [x] Log your chain execution down to the level of granularity that you need.\n- [x] Visualize your chain execution in the UI.\n- [x] Automatically tracks your prompts when using the OpenAI chat models.\n- [x] Track and analyze user feedback.\n- [ ] Diff your prompts and chain execution in the UI.\n\n## 👀 Examples\n\nTo log a single LLM call as an individual prompt, use `comet_llm.log_prompt`. If you require more granularity, you can log a chain of executions that may include more than one LLM call, context retrieval, or data pre- or post-processing with `comet_llm.start_chain`.\n\n### Log a full prompt and response\n\n```python\nimport comet_llm\n\ncomet_llm.log_prompt(\n    prompt=\"Answer the question and if the question can't be answered, say \\\"I don't know\\\"\\n\\n---\\n\\nQuestion: What is your name?\\nAnswer:\",\n    prompt_template=\"Answer the question and if the question can't be answered, say \\\"I don't know\\\"\\n\\n---\\n\\nQuestion: {{question}}?\\nAnswer:\",\n    prompt_template_variables={\"question\": \"What is your name?\"},\n    metadata= {\n        \"usage.prompt_tokens\": 7,\n        \"usage.completion_tokens\": 5,\n        \"usage.total_tokens\": 12,\n    },\n    output=\" My name is Alex.\",\n    duration=16.598,\n)\n```\n\n[Read the full documentation for more details about logging a prompt](https://www.comet.com/docs/v2/guides/large-language-models/llm-project/#logging-prompts-to-llm-projects).\n\n### Log a LLM chain\n\n```python\nfrom comet_llm import Span, end_chain, start_chain\nimport datetime\nfrom time import sleep\n\n\ndef retrieve_context(user_question):\n    if \"open\" in user_question:\n        return \"Opening hours: 08:00 to 17:00 all days\"\n\n\ndef llm_answering(user_question, current_time, context):\n    prompt_template = \"\"\"You are a helpful chatbot. You have access to the following context:\n    {context}\n    The current time is: {current_time}\n    Analyze the following user question and decide if you can answer it, if the question can't be answered, say \\\"I don't know\\\":\n    {user_question}\n    \"\"\"\n\n    prompt = prompt_template.format(\n        user_question=user_question, current_time=current_time, context=context\n    )\n\n    with Span(\n        category=\"llm-call\",\n        inputs={\"prompt_template\": prompt_template, \"prompt\": prompt},\n    ) as span:\n        # Call your LLM model here\n        sleep(0.1)\n        result = \"Yes we are currently open\"\n        usage = {\"prompt_tokens\": 52, \"completion_tokens\": 12, \"total_tokens\": 64}\n\n        span.set_outputs(outputs={\"result\": result}, metadata={\"usage\": usage})\n\n    return result\n\n\ndef main(user_question, current_time):\n    start_chain(inputs={\"user_question\": user_question, \"current_time\": current_time})\n\n    with Span(\n        category=\"context-retrieval\",\n        name=\"Retrieve Context\",\n        inputs={\"user_question\": user_question},\n    ) as span:\n        context = retrieve_context(user_question)\n\n        span.set_outputs(outputs={\"context\": context})\n\n    with Span(\n        category=\"llm-reasoning\",\n        inputs={\n            \"user_question\": user_question,\n            \"current_time\": current_time,\n            \"context\": context,\n        },\n    ) as span:\n        result = llm_answering(user_question, current_time, context)\n\n        span.set_outputs(outputs={\"result\": result})\n\n    end_chain(outputs={\"result\": result})\n\n\nmain(\"Are you open?\", str(datetime.datetime.now().time()))\n```\n\n[Read the full documentation for more details about logging a chain](https://www.comet.com/docs/v2/guides/large-language-models/llm-project/#logging-chains-to-llm-projects).\n\n## ⚙️ Configuration\n\nYou can configure your Comet credentials and where you are logging data to:\n\n| Name                 | Python parameter name | Environment variable name |\n| -------------------- | --------------------- | ------------------------- |\n| Comet API KEY        | api_key               | COMET_API_KEY             |\n| Comet Workspace name | workspace             | COMET_WORKSPACE           |\n| Comet Project name   | project               | COMET_PROJECT_NAME        |\n\n## 📝 License\n\nCopyright (c) [Comet](https://www.comet.com/site/) 2023-present. `cometLLM` is free and open-source software licensed under the [MIT License](https://github.com/comet-ml/comet-llm/blob/master/LICENSE).\n\n\n\u003cp align=\"center\"\u003e\n    \u003cb\u003eCometLLM\u003c/b\u003e was replaced by \u003cb\u003eopik\u003c/b\u003e - see https://github.com/comet-ml/opik\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomet-ml%2Fcomet-llm-legacy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomet-ml%2Fcomet-llm-legacy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomet-ml%2Fcomet-llm-legacy/lists"}