Comments (5)
@alexcannan and @Dev-Khant, thank you so much for looking into this. I agree, this is not very high on our Prio list and hence I will close it. Thanks for raising!
from langfuse-python.
@marcklingen @maxdeichmann Does this need to change?
from langfuse-python.
Hi @Dev-Khant and @alexcannan, sorry for being late here. This is something i wanted to take a look at, because it woudl definitely increase DX when using the Python library. Some background here:
- We have a JS/TS and Python package and both of them talk to the same API on the backend
- In the main repo, we have Fern definitions for our API, which then generates OpenAPI docs as well as Python code for that API
- The TS SDK depends on the OpenAPI docs to generate TS code around the API.
- The Python SDK has the
/api
folder which contains the Python code generated by Fern. All the pydantic code is generated by Fern.- Fern definitions in the main repo: https://github.com/langfuse/langfuse/tree/main/fern
- Generated OpenAPI docs: https://github.com/langfuse/langfuse/tree/main/generated
- This Fern generator generates the Python files: https://github.com/langfuse/langfuse/blob/main/fern/server/generators.yml#L13
- Going forward, this is not the best approach, as we have API definitions in Zod, Fern, OpenAPI at the moment. We ended up with this setup as we did not want to change Python code every time we add a field to the API. At the same time, Python code generators from OpenAPI docs did not work well.
What are the ways forward?
- Make changes to the Pydantic code, as you propose, but then we would not be able to re-generate Python code with fern as it would overwrite our changes.
- Look into Fern and try to improve error handling. Unfortunately, we use the hosted version of Fern, i am not sure in how far you can use Fern as well. Creating the code would obv. be required to iterate on that
- Completely remove the the Fern code and replace it with some other code wrappers.
@alexcannan and @Dev-Khant do you have opinions on that? I just asked Fern in how far the community can use Fern as well. Does anyone of you have experience with generating python code from OpanAPI docs?
from langfuse-python.
I don't have any experience for generating python code from OpenAPI docs. But I can look into it
from langfuse-python.
Hmm, I would suggest raising this to the fern developers. It's surprising that their python code generation has type: ignore
flags, that's an orange flag for me. I can attempt to put together a very minimal SDK for my specific use case using the api directly. Actually, as long as I don't trigger any HTTP exceptions the SDK works as expected.
Thank you for the detailed explanation @maxdeichmann. It seems as long as no HTTP exceptions are raised, this is a non-issue for users. And, since the SDK is generated directly from API definitions, the chance of exceptions is relatively low. I'm happy to close this for now, since it seems to be a fern generation issue rather than a langfuse one, but I'll leave that up to y'all.
from langfuse-python.
Related Issues (12)
- [Langchain Integration] Support HuggingFaceHub as LLM HOT 1
- Testing with local Langfuse server
- Host on CallbackHandler should be optional HOT 3
- Add end() method to spans and generations HOT 4
- Missing `backoff` dependency HOT 4
- All Langfuse Issues are in langfuse/langfuse
- test
- Amazon Bedrock and Authropic Claude issue with indenting model_name HOT 2
- Python SDK not compatible with Pydantic 2.0 HOT 4
- bug: `meta.update()` fails when `meta = None` HOT 1
- Replace dependency on langchain with langchain-core
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from langfuse-python.