logfire icon indicating copy to clipboard operation
logfire copied to clipboard

Adding Mirascope Third Party Integration Docs Page

Open willbakst opened this issue 1 year ago • 4 comments

  • Added a new third_party/ directory in the docs/integrations/ directory for all future third party integrations.
  • Added the mirascope.md docs page describing the integration to the third_party/ directory.
  • Tried to match existing docs pages wrt. internal links.
  • NOTE: I have purposefully excluded an image for the extraction section since Logfire UI does not yet have Function Calling supported (see #54). I will add that screenshot once that feature is released.

willbakst avatar May 02 '24 21:05 willbakst

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:loudspeaker: Thoughts on this report? Let us know!

codecov[bot] avatar May 03 '24 07:05 codecov[bot]

I don't think I have rights to push to this branch. Can you apply this patch, please?

diff --git a/docs/integrations/third_party/mirascope.md b/docs/integrations/third_party/mirascope.md
index a0e07f89..91ce9b45 100644
--- a/docs/integrations/third_party/mirascope.md
+++ b/docs/integrations/third_party/mirascope.md
@@ -1,5 +1,3 @@
-# Mirascope
-
 [Mirascope](https://github.com/Mirascope/mirascope) is an intuitive approach to building AI-powered applications using LLMs. Their library is the first third party integration with Logfire to make observability and monitoring for LLMs easy and seamless.
 
 You can enable it using their [`@with_logire`](https://docs.mirascope.io/latest/integrations/logfire/#how-to-use-logfire-with-mirascope) decorator, which will work with all of the [model providers that they support](https://docs.mirascope.io/latest/concepts/supported_llm_providers/) (e.g. OpenAI, Anthropic, Groq, and more).
diff --git a/docs/plugins/main.py b/docs/plugins/main.py
index b184ba44..57cf3c9b 100644
--- a/docs/plugins/main.py
+++ b/docs/plugins/main.py
@@ -20,8 +20,8 @@ def on_page_markdown(markdown: str, page: Page, config: Config, files: Files) ->
     markdown = build_environment_variables_table(markdown, page)
     markdown = logfire_print_help(markdown, page)
     markdown = install_logfire(markdown, page)
-    if page.file.src_uri == 'guides/onboarding_checklist/06_add_metrics.md':
-        check_documented_system_metrics(markdown, page)
+    markdown = check_documented_system_metrics(markdown, page)
+    markdown = warning_on_third_party(markdown, page)
     return markdown
 
 
@@ -36,6 +36,9 @@ def check_documented_system_metrics(markdown: str, page: Page) -> str:
 
     This function checks that all the metrics in `DEFAULT_CONFIG` are documented.
     """
+    if page.file.src_uri != 'guides/onboarding_checklist/06_add_metrics.md':
+        return markdown
+
     metrics_documented: set[str] = set()
     for line in markdown.splitlines():
         match = re.search(r'\* `(.*)`: ', line)
@@ -134,3 +137,17 @@ def install_logfire(markdown: str, page: Page) -> str:
     ```
 """
     return re.sub(r'{{ *install_logfire\(.*\) *}}', instructions, markdown)
+
+
+def warning_on_third_party(markdown: str, page: Page) -> str:
+    if not page.file.src_uri.startswith('integrations/third_party/'):
+        return markdown
+
+    note = """
+!!! note "Third-party integrations"
+    Third-party integrations are not officially supported by **Logfire**.
+
+    They are maintained by the community and may not be as reliable as the integrations developed by **Logfire**.
+"""
+
+    return note + markdown

Kludex avatar May 03 '24 08:05 Kludex

I applied the patch and addressed the comments (but have left things unresolved for you to resolve).

@Kludex please let me know if I missed anything.

willbakst avatar May 03 '24 16:05 willbakst

@Kludex I just updated the docs to include a screenshot of extraction now that function calling shows up nice and pretty in the UI :)

willbakst avatar May 03 '24 20:05 willbakst

I don't know exactly what the problem is with this branch - I'm not sure if it's because it was created on an org's main branch, or I can't edit the branch, but I've copied the commits here to https://github.com/pydantic/logfire/pull/133.

I'll merge that PR, thanks @willbakst ! :)

Kludex avatar May 06 '24 10:05 Kludex

Ah yeah not sure what the issue was, maybe cause it's a fork? Thanks for taking care of this and merging in!

willbakst avatar May 06 '24 18:05 willbakst