-
Notifications
You must be signed in to change notification settings - Fork 2
Development (#4) #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 19 additions & 20 deletions
39
integrations/langchain-ferrolabsai/langchain_ferrolabsai/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,30 @@ | ||
| """LangChain integration for Ferro Labs AI Gateway. | ||
|
|
||
| This is a 0.0.1 placeholder release. The full adapter (FerroChatModel, | ||
| FerroEmbeddings, FerroLLM) is under active development. Track progress at: | ||
| Public API:: | ||
|
|
||
| https://github.com/ferro-labs/ai-gateway-workspace/blob/main/docs/OSS-ECOSYSTEM-ROADMAP.md | ||
| from langchain_ferrolabsai import FerroChatModel, FerroEmbeddings, FerroLLM | ||
|
|
||
| Once shipped, the public API will be: | ||
| chat = FerroChatModel(model="gpt-4o", api_key="sk-ferro-...") | ||
| embed = FerroEmbeddings(model="text-embedding-3-small", api_key="sk-ferro-...") | ||
| legacy = FerroLLM(model="gpt-4o", api_key="sk-ferro-...") | ||
|
|
||
| from langchain_ferrolabsai import FerroChatModel, FerroEmbeddings, FerroLLM | ||
| All three classes route through a Ferro Labs AI Gateway endpoint and expose | ||
| the gateway's ``trace_id`` (frozen contract since ``ai-gateway v1.1.0``) via | ||
| ``response_metadata`` — the join key for the v1.2 observability bridge plugins | ||
| (LangSmith, Langfuse, Phoenix, …). | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| __version__ = "0.0.1" | ||
|
|
||
| __all__ = ["__version__"] | ||
|
|
||
|
|
||
| def _not_implemented(name: str) -> None: | ||
| raise NotImplementedError( | ||
| f"langchain_ferrolabsai.{name} is not implemented in 0.0.1. " | ||
| "This release reserves the package name. " | ||
| "Track progress at https://github.com/ferro-labs/ai-gateway-workspace." | ||
| ) | ||
| from .chat_models import FerroChatModel | ||
| from .embeddings import FerroEmbeddings | ||
| from .llms import FerroLLM | ||
|
|
||
| __version__ = "0.1.0" | ||
|
|
||
| def __getattr__(name: str) -> object: | ||
| if name in {"FerroChatModel", "FerroEmbeddings", "FerroLLM"}: | ||
| _not_implemented(name) | ||
| raise AttributeError(f"module 'langchain_ferrolabsai' has no attribute {name!r}") | ||
| __all__ = [ | ||
| "__version__", | ||
| "FerroChatModel", | ||
| "FerroEmbeddings", | ||
| "FerroLLM", | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When endpoints that legitimately return a top-level list include the gateway request-id header, this helper now treats that list as a dict and executes
data["trace_id"] = ..., raisingTypeErrorbefore resource code can handle it. I checked the SDK callers:admin.keys.list(),admin.providers.list(),admin.plugins.list(), andmodels.list()all explicitly support list responses, so any gateway that addsx-request-id/x-trace-idto those responses will regress; only inject metadata after verifying the parsed body is a dict.Useful? React with 👍 / 👎.